Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46a2f95

Browse files
authored
[MOB-12640] Unify Repro Steps List Item Title String (#1002)
1 parent 46cff11 commit 46a2f95

File tree

9 files changed

+30
-1
lines changed

9 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
### Added
66

77
- Add new strings (`StringKey.discardAlertStay` and `StringKey.discardAlertDiscard`) for overriding the discard alert buttons for consistency between iOS and Android ([#1001](https://github.com/Instabug/Instabug-React-Native/pull/1001)).
8+
- Add a new string (`StringKey.reproStepsListItemNumberingTitle`) for overriding the repro steps list item (screen) title for consistency between iOS and Android ([#1002](https://github.com/Instabug/Instabug-React-Native/pull/1002)).
89

910
### Deprecated
1011

1112
- Deprecate the old `StringKey.discardAlertCancel` and `StringKey.discardAlertAction` string keys for overriding the discard alert buttons as they had incosistent behavior between iOS and Android ([#1001](https://github.com/Instabug/Instabug-React-Native/pull/1001)).
13+
- Deprecate the old `StringKey.reproStepsListItemNumberingTitle` string key for overriding the repro steps list item (screen) title as it had incosistent behavior between iOS and Android ([#1002](https://github.com/Instabug/Instabug-React-Native/pull/1002)).
1214

1315
## [11.13.0](https://github.com/Instabug/Instabug-React-Native/compare/v11.12.0...v11.13.0) (July 10, 2023)
1416

android/src/main/java/com/instabug/reactlibrary/ArgsRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ static Map<String, Object> getAll() {
246246
put("reproStepsListDescription", Key.REPRO_STEPS_LIST_DESCRIPTION);
247247
put("reproStepsListEmptyStateDescription", Key.REPRO_STEPS_LIST_EMPTY_STATE_DESCRIPTION);
248248
put("reproStepsListItemTitle", Key.REPRO_STEPS_LIST_ITEM_NUMBERING_TITLE);
249+
put("reproStepsListItemNumberingTitle", Key.REPRO_STEPS_LIST_ITEM_NUMBERING_TITLE);
249250
put("okButtonTitle", Key.BUG_ATTACHMENT_DIALOG_OK_BUTTON);
250251
put("audio", Key.CHATS_TYPE_AUDIO);
251252
put("image", Key.CHATS_TYPE_IMAGE);

android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ public void tearDown() {
459459
// Ignore deprecated keys
460460
keys.remove("discardAlertCancel");
461461
keys.remove("discardAlertAction");
462+
keys.remove("reproStepsListItemTitle");
462463

463464
// when
464465
InstabugCustomTextPlaceHolder expectedPlaceHolders = new InstabugCustomTextPlaceHolder();

ios/RNInstabug/ArgsRegistry.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ + (ArgsDictionary *) locales {
255255
@"reproStepsListDescription": kIBGReproStepsListHeader,
256256
@"reproStepsListEmptyStateDescription": kIBGReproStepsListEmptyStateLabel,
257257
@"reproStepsListItemTitle": kIBGReproStepsListItemName,
258+
@"reproStepsListItemNumberingTitle": kIBGReproStepsListItemName,
258259
@"conversationTextFieldHint": kIBGChatReplyFieldPlaceholderStringName,
259260
@"insufficientContentTitle" : kIBGInsufficientContentTitleStringName,
260261
@"insufficientContentMessage" : kIBGInsufficientContentMessageStringName,

src/modules/Instabug.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ export const getTags = async (callback?: (tags: string[]) => void): Promise<stri
226226
* @param string String value to override the default one.
227227
*/
228228
export const setString = (key: strings | StringKey, string: string) => {
229+
// Suffix the repro steps list item numbering title with a # to unify the string key's
230+
// behavior between Android and iOS
231+
if (Platform.OS === 'android' && key === StringKey.reproStepsListItemNumberingTitle) {
232+
string = `${string} #`;
233+
}
234+
229235
NativeInstabug.setString(string, key);
230236
};
231237

src/native/NativeConstants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ interface NativeStringKey {
176176
reproStepsListEmptyStateDescription: any;
177177
reproStepsListHeader: any;
178178
reproStepsListItemTitle: any;
179+
reproStepsListItemNumberingTitle: any;
179180
reproStepsProgressDialogBody: any;
180181
requestFeatureDescription: any;
181182
screenRecording: any;

src/utils/Enums.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ export enum StringKey {
195195
reproStepsListDescription = constants.reproStepsListDescription,
196196
reproStepsListEmptyStateDescription = constants.reproStepsListEmptyStateDescription,
197197
reproStepsListHeader = constants.reproStepsListHeader,
198+
/** @deprecated Use {@link reproStepsListItemNumberingTitle} instead */
198199
reproStepsListItemTitle = constants.reproStepsListItemTitle,
200+
reproStepsListItemNumberingTitle = constants.reproStepsListItemNumberingTitle,
199201
reproStepsProgressDialogBody = constants.reproStepsProgressDialogBody,
200202
requestFeatureDescription = constants.requestFeatureDescription,
201203
screenRecording = constants.screenRecording,

test/mocks/mockInstabug.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import type { InstabugNativeModule } from '../../src/native/NativeInstabug';
33
const mockInstabug: InstabugNativeModule = {
44
addListener: jest.fn(),
55
removeListeners: jest.fn(),
6-
getConstants: jest.fn().mockReturnValue({}),
6+
getConstants: jest.fn().mockReturnValue({
7+
reproStepsListItemNumberingTitle: 'reproStepsListItemNumberingTitle',
8+
}),
79
setEnabled: jest.fn(),
810
init: jest.fn(),
911
setUserData: jest.fn(),

test/modules/Instabug.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,19 @@ describe('Instabug Module', () => {
298298
expect(NativeInstabug.setString).toBeCalledWith(string, key);
299299
});
300300

301+
it('should suffix the repro steps list item numbering title string on Android', () => {
302+
Platform.OS = 'android';
303+
304+
const key = StringKey.reproStepsListItemNumberingTitle;
305+
const string = 'Page';
306+
const expected = 'Page #';
307+
308+
Instabug.setString(key, string);
309+
310+
expect(NativeInstabug.setString).toBeCalledTimes(1);
311+
expect(NativeInstabug.setString).toBeCalledWith(expected, key);
312+
});
313+
301314
it('should call the native method identifyUser', () => {
302315
const email = '[email protected]';
303316
const name = 'Instabug';

0 commit comments

Comments
 (0)