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

Skip to content

[MOB-12640] Unify Repro Steps List Item Title String #1002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
### Added

- 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)).
- 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)).

### Deprecated

- 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)).
- 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)).

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ static Map<String, Object> getAll() {
put("reproStepsListDescription", Key.REPRO_STEPS_LIST_DESCRIPTION);
put("reproStepsListEmptyStateDescription", Key.REPRO_STEPS_LIST_EMPTY_STATE_DESCRIPTION);
put("reproStepsListItemTitle", Key.REPRO_STEPS_LIST_ITEM_NUMBERING_TITLE);
put("reproStepsListItemNumberingTitle", Key.REPRO_STEPS_LIST_ITEM_NUMBERING_TITLE);
put("okButtonTitle", Key.BUG_ATTACHMENT_DIALOG_OK_BUTTON);
put("audio", Key.CHATS_TYPE_AUDIO);
put("image", Key.CHATS_TYPE_IMAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ public void tearDown() {
// Ignore deprecated keys
keys.remove("discardAlertCancel");
keys.remove("discardAlertAction");
keys.remove("reproStepsListItemTitle");

// when
InstabugCustomTextPlaceHolder expectedPlaceHolders = new InstabugCustomTextPlaceHolder();
Expand Down
1 change: 1 addition & 0 deletions ios/RNInstabug/ArgsRegistry.m
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ + (ArgsDictionary *) locales {
@"reproStepsListDescription": kIBGReproStepsListHeader,
@"reproStepsListEmptyStateDescription": kIBGReproStepsListEmptyStateLabel,
@"reproStepsListItemTitle": kIBGReproStepsListItemName,
@"reproStepsListItemNumberingTitle": kIBGReproStepsListItemName,
@"conversationTextFieldHint": kIBGChatReplyFieldPlaceholderStringName,
@"insufficientContentTitle" : kIBGInsufficientContentTitleStringName,
@"insufficientContentMessage" : kIBGInsufficientContentMessageStringName,
Expand Down
6 changes: 6 additions & 0 deletions src/modules/Instabug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ export const getTags = async (callback?: (tags: string[]) => void): Promise<stri
* @param string String value to override the default one.
*/
export const setString = (key: strings | StringKey, string: string) => {
// Suffix the repro steps list item numbering title with a # to unify the string key's
// behavior between Android and iOS
if (Platform.OS === 'android' && key === StringKey.reproStepsListItemNumberingTitle) {
string = `${string} #`;
}

NativeInstabug.setString(string, key);
};

Expand Down
1 change: 1 addition & 0 deletions src/native/NativeConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ interface NativeStringKey {
reproStepsListEmptyStateDescription: any;
reproStepsListHeader: any;
reproStepsListItemTitle: any;
reproStepsListItemNumberingTitle: any;
reproStepsProgressDialogBody: any;
requestFeatureDescription: any;
screenRecording: any;
Expand Down
2 changes: 2 additions & 0 deletions src/utils/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ export enum StringKey {
reproStepsListDescription = constants.reproStepsListDescription,
reproStepsListEmptyStateDescription = constants.reproStepsListEmptyStateDescription,
reproStepsListHeader = constants.reproStepsListHeader,
/** @deprecated Use {@link reproStepsListItemNumberingTitle} instead */
reproStepsListItemTitle = constants.reproStepsListItemTitle,
reproStepsListItemNumberingTitle = constants.reproStepsListItemNumberingTitle,
reproStepsProgressDialogBody = constants.reproStepsProgressDialogBody,
requestFeatureDescription = constants.requestFeatureDescription,
screenRecording = constants.screenRecording,
Expand Down
4 changes: 3 additions & 1 deletion test/mocks/mockInstabug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import type { InstabugNativeModule } from '../../src/native/NativeInstabug';
const mockInstabug: InstabugNativeModule = {
addListener: jest.fn(),
removeListeners: jest.fn(),
getConstants: jest.fn().mockReturnValue({}),
getConstants: jest.fn().mockReturnValue({
reproStepsListItemNumberingTitle: 'reproStepsListItemNumberingTitle',
}),
setEnabled: jest.fn(),
init: jest.fn(),
setUserData: jest.fn(),
Expand Down
13 changes: 13 additions & 0 deletions test/modules/Instabug.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@ describe('Instabug Module', () => {
expect(NativeInstabug.setString).toBeCalledWith(string, key);
});

it('should suffix the repro steps list item numbering title string on Android', () => {
Platform.OS = 'android';

const key = StringKey.reproStepsListItemNumberingTitle;
const string = 'Page';
const expected = 'Page #';

Instabug.setString(key, string);

expect(NativeInstabug.setString).toBeCalledTimes(1);
expect(NativeInstabug.setString).toBeCalledWith(expected, key);
});

it('should call the native method identifyUser', () => {
const email = '[email protected]';
const name = 'Instabug';
Expand Down