Skip to content

Commit 59b7a79

Browse files
author
Ali Abdelfattah
authored
Merge branch 'master' into release/v9.1.8
2 parents cde26d5 + 2203d90 commit 59b7a79

File tree

17 files changed

+203
-200
lines changed

17 files changed

+203
-200
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
test_android:
101101
working_directory: ~/project/InstabugSample
102102
docker:
103-
- image: circleci/android:api-28-node
103+
- image: circleci/android@sha256:793ae9aa1777ba7fc375109978b307ed03a49be468295a8778d588eba0670e4b
104104
environment:
105105
JVM_OPTS: -Xmx3200m
106106
steps:

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
## v9.1.8 (2020-09-14)
21

3-
* Bump Native SDKs to v9.1.7
2+
## v9.1.8 (2020-09-16)
3+
4+
* Adds support for react-navigation v5
5+
* Adds support for the Azerbaijani locale
6+
* Bumps Instabug native SDKs to v9.1.7
7+
* Fixes an issue with `onReportSubmitHandler` on iOS
48

59
## v9.1.7 (2020-08-10)
610

InstabugSample/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
jcenter()
1515
}
1616
dependencies {
17-
classpath("com.android.tools.build:gradle:3.4.1")
17+
classpath('com.android.tools.build:gradle:3.6.0')
1818
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1919

2020
// NOTE: Do not place your application dependencies here; they belong
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

InstabugSample/yarn.lock

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
15601560
dependencies:
15611561
delayed-stream "~1.0.0"
15621562

1563-
commander@^2.19.0, commander@~2.20.0:
1563+
commander@^2.19.0:
15641564
version "2.20.0"
15651565
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
15661566

@@ -2561,12 +2561,13 @@ growly@^1.3.0:
25612561
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
25622562

25632563
handlebars@^4.1.2:
2564-
version "4.1.2"
2565-
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67"
2564+
version "4.7.6"
2565+
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e"
25662566
dependencies:
2567+
minimist "^1.2.5"
25672568
neo-async "^2.6.0"
2568-
optimist "^0.6.1"
25692569
source-map "^0.6.1"
2570+
wordwrap "^1.0.0"
25702571
optionalDependencies:
25712572
uglify-js "^3.1.4"
25722573

@@ -2756,7 +2757,7 @@ inquirer@^6.4.1:
27562757
through "^2.3.6"
27572758

27582759
instabug-reactnative@../:
2759-
version "8.7.1"
2760+
version "9.1.7"
27602761

27612762
invariant@^2.2.4:
27622763
version "2.2.4"
@@ -3936,13 +3937,9 @@ [email protected]:
39363937
version "0.0.8"
39373938
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
39383939

3939-
minimist@^1.1.1, minimist@^1.2.0:
3940-
version "1.2.0"
3941-
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
3942-
3943-
minimist@~0.0.1:
3944-
version "0.0.10"
3945-
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
3940+
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5:
3941+
version "1.2.5"
3942+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
39463943

39473944
minipass@^2.2.1, minipass@^2.3.5:
39483945
version "2.5.0"
@@ -4049,8 +4046,8 @@ [email protected]:
40494046
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
40504047

40514048
neo-async@^2.6.0:
4052-
version "2.6.1"
4053-
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
4049+
version "2.6.2"
4050+
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
40544051

40554052
nice-try@^1.0.4:
40564053
version "1.0.5"
@@ -4249,13 +4246,6 @@ open@^6.2.0:
42494246
dependencies:
42504247
is-wsl "^1.1.0"
42514248

4252-
optimist@^0.6.1:
4253-
version "0.6.1"
4254-
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686"
4255-
dependencies:
4256-
minimist "~0.0.1"
4257-
wordwrap "~0.0.2"
4258-
42594249
optionator@^0.8.1, optionator@^0.8.2:
42604250
version "0.8.2"
42614251
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
@@ -5553,11 +5543,8 @@ uglify-es@^3.1.9:
55535543
source-map "~0.6.1"
55545544

55555545
uglify-js@^3.1.4:
5556-
version "3.6.0"
5557-
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"
5558-
dependencies:
5559-
commander "~2.20.0"
5560-
source-map "~0.6.1"
5546+
version "3.10.3"
5547+
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.10.3.tgz#f0d2f99736c14de46d2d24649ba328be3e71c3bf"
55615548

55625549
55635550
version "1.0.2"
@@ -5742,10 +5729,6 @@ wordwrap@^1.0.0, wordwrap@~1.0.0:
57425729
version "1.0.0"
57435730
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
57445731

5745-
wordwrap@~0.0.2:
5746-
version "0.0.3"
5747-
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
5748-
57495732
wrap-ansi@^2.0.0:
57505733
version "2.1.0"
57515734
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"

README.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,24 +203,40 @@ Instabug Repro Steps are enabled by default. It captures a screenshot of each sc
203203
204204
We support the 2 most popular React Native navigation libraries:
205205
206-
* **react-navigation**
207-
1) Set the `onNavigationStateChange` to `Instabug.onNavigationStateChange` in your App wrapper as follows:
208-
209-
```javascript
210-
export default () => (
211-
<App
212-
onNavigationStateChange={ Instabug.onNavigationStateChange } />
213-
);
214-
```
215-
216-
* **react-native-navigation**
217-
1) Register `Instabug.componentDidAppearListener` listener using:
218-
219-
```javascript
220-
Navigation.events().registerComponentDidAppearListener( Instabug.componentDidAppearListener );
221-
```
206+
* **react-navigation**
207+
208+
* **v5**
209+
set the `onStateChange` to `Instabug.onStateChange` in your NavigationContainer as follows:
210+
211+
```javascript
212+
<NavigationContainer
213+
onStateChange={ Instabug.onStateChange } />
214+
```
215+
216+
* **<=v4**
217+
set the `onNavigationStateChange` to `Instabug.onNavigationStateChange` in your App wrapper as follows:
218+
219+
```javascript
220+
export default () => (
221+
<App
222+
onNavigationStateChange={ Instabug.onNavigationStateChange } />
223+
);
224+
```
225+
* **react-native-navigation**
226+
227+
Register `Instabug.componentDidAppearListener` listener using:
228+
```javascript
229+
Navigation.events().registerComponentDidAppearListener( Instabug.componentDidAppearListener );
230+
```
231+
232+
Alternatively, you can report your screen changes manually using the following API
233+
234+
```javascript
235+
Instabug.reportScreenChange('screenName');
236+
```
222237
223238
You can disable Repro Steps using the following API:
239+
224240
```javascript
225241
Instabug.setReproStepsMode(Instabug.reproStepsMode.disabled);
226242
```

__tests__/index.spec.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ describe('Instabug Module', () => {
6363
const hideView = sinon.spy(NativeModules.Instabug, 'hideView');
6464
const show = sinon.spy(NativeModules.Instabug, 'show');
6565
const setPreSendingHandler = sinon.spy(NativeModules.Instabug, 'setPreSendingHandler');
66-
const submitReport = sinon.spy(NativeModules.Instabug, 'submitReport');
6766
const callPrivateApi = sinon.spy(NativeModules.Instabug, 'callPrivateApi');
6867
const sendHandledJSCrash = sinon.spy(NativeModules.Instabug, 'sendHandledJSCrash');
6968
const sendJSCrash = sinon.spy(NativeModules.Instabug, 'sendJSCrash');
@@ -81,10 +80,9 @@ describe('Instabug Module', () => {
8180
isRunningLive.resetHistory();
8281
setFileAttachment.resetHistory();
8382
hideView.resetHistory();
84-
submitReport.resetHistory();
8583
setPreSendingHandler.resetHistory();
8684
IBGEventEmitter.removeAllListeners();
87-
85+
8886
});
8987

9088
it('componentDidAppearListener should call the native method reportScreenChange', () => {
@@ -583,9 +581,9 @@ describe('Instabug Module', () => {
583581
Instabug.onReportSubmitHandler(jest.fn());
584582
InstabugUtils.isOnReportHandlerSet.mockImplementation(() => true);
585583
const isReportHandlerSet = InstabugUtils.isOnReportHandlerSet();
586-
584+
587585
expect(isReportHandlerSet).toBe(true);
588-
586+
589587
});
590588

591589
it('should call the native method setPreSendingHandler with a function', () => {
@@ -619,7 +617,6 @@ describe('Instabug Module', () => {
619617
IBGEventEmitter.emit(IBGConstants.PRESENDING_HANDLER, report);
620618

621619
expect(IBGEventEmitter.getListeners(IBGConstants.PRESENDING_HANDLER).length).toEqual(1);
622-
expect(submitReport.calledOnce).toBe(true);
623620

624621
});
625622

@@ -634,7 +631,7 @@ describe('Instabug Module', () => {
634631
fileAttachments: ['path']
635632
};
636633
NativeModules.Instabug.getReport.mockResolvedValue(report);
637-
const jsonObject = {stack: 'error'};
634+
const jsonObject = { stack: 'error' };
638635
const callback = (rep) => {
639636
expect(rep).toBeInstanceOf(Report);
640637
expect(rep.tags).toBe(report.tags);
@@ -658,7 +655,7 @@ describe('Instabug Module', () => {
658655
Instabug.onReportSubmitHandler(jest.fn());
659656
IBGEventEmitter.emit(IBGConstants.SEND_HANDLED_CRASH, {});
660657
expect(IBGEventEmitter.getListeners(IBGConstants.SEND_HANDLED_CRASH).length).toEqual(0);
661-
658+
662659
});
663660

664661
it('should invoke callback on emitting the event IBGSendUnhandledJSCrash', async (done) => {
@@ -672,7 +669,7 @@ describe('Instabug Module', () => {
672669
fileAttachments: ['path']
673670
};
674671
NativeModules.Instabug.getReport.mockResolvedValue(report);
675-
const jsonObject = {stack: 'error'};
672+
const jsonObject = { stack: 'error' };
676673
const callback = (rep) => {
677674
expect(rep).toBeInstanceOf(Report);
678675
expect(rep.tags).toBe(report.tags);
@@ -696,7 +693,7 @@ describe('Instabug Module', () => {
696693
Instabug.onReportSubmitHandler(jest.fn());
697694
IBGEventEmitter.emit(IBGConstants.SEND_UNHANDLED_CRASH, {});
698695
expect(IBGEventEmitter.getListeners(IBGConstants.SEND_UNHANDLED_CRASH).length).toEqual(0);
699-
696+
700697
});
701698

702699
it('should invoke the native method callPrivateApi', () => {

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

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ public void setPreSendingHandler(final Callback preSendingHandler) {
13691369
MainThreadHandler.runOnMainThread(new Runnable() {
13701370
@Override
13711371
public void run() {
1372-
Report.OnReportCreatedListener listener = new Report.OnReportCreatedListener() {
1372+
Instabug.onReportSubmitHandler(new Report.OnReportCreatedListener() {
13731373
@Override
13741374
public void onReportCreated(Report report) {
13751375
WritableMap reportParam = Arguments.createMap();
@@ -1381,18 +1381,7 @@ public void onReportCreated(Report report) {
13811381
sendEvent(getReactApplicationContext(), "IBGpreSendingHandler", reportParam);
13821382
currentReport = report;
13831383
}
1384-
};
1385-
1386-
Method method = getMethod(Instabug.class, "onReportSubmitHandler_Private", Report.OnReportCreatedListener.class);
1387-
if (method != null) {
1388-
try {
1389-
method.invoke(null, listener);
1390-
} catch (IllegalAccessException e) {
1391-
e.printStackTrace();
1392-
} catch (InvocationTargetException e) {
1393-
e.printStackTrace();
1394-
}
1395-
}
1384+
});
13961385
}
13971386
});
13981387

@@ -1469,21 +1458,7 @@ public void addFileAttachmentWithDataToReport(String data, String fileName) {
14691458
}
14701459
}
14711460

1472-
@ReactMethod
1473-
public void submitReport() {
1474-
Method method = getMethod(Instabug.class, "setReport", Report.class);
1475-
if (method != null) {
1476-
try {
1477-
method.invoke(null, currentReport);
1478-
currentReport = null;
1479-
} catch (IllegalAccessException e) {
1480-
e.printStackTrace();
1481-
} catch (InvocationTargetException e) {
1482-
e.printStackTrace();
1483-
}
1484-
}
1485-
}
1486-
1461+
14871462
@ReactMethod
14881463
public void getReport(Promise promise) {
14891464
try {

android/upload_sourcemap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
cd ..
33
cd ..
44
cd ..
5-
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
5+
if [ -s "$HOME/.nvm/nvm.sh" ]; then
66
. "$HOME/.nvm/nvm.sh"
77
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
88
. "$(brew --prefix nvm)/nvm.sh"

index.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export namespace Surveys {
114114
function showSurvey(surveyToken: string): void;
115115
function hasRespondedToSurvey(
116116
surveyToken: string,
117-
surveyTokenCallback: () => void
117+
surveyTokenCallback: (hasResponded: boolean) => void
118118
): void;
119119
function setShouldShowWelcomeScreen(shouldShowWelcomeScreen: boolean): void;
120120
function setAppStoreURL(appStoreURL: string): void;
@@ -233,6 +233,12 @@ export function onNavigationStateChange(
233233
currentState: any,
234234
action: any
235235
): void;
236+
export function onStateChange(
237+
state: any
238+
): void;
239+
export function reportScreenChange(
240+
screenName: string
241+
): void;
236242
export function componentDidAppearListener(componentObj:
237243
{ componentId: any, componentName: any, passProps: any }
238244
): void;

0 commit comments

Comments
 (0)