Skip to content

Commit a30a507

Browse files
authored
Merge pull request #676 from Instabug/release/10.13.0
[MOB-8381] Release/10.13.0
2 parents 6b4ea10 + 7d05bf8 commit a30a507

File tree

113 files changed

+6348
-5443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+6348
-5443
lines changed

.npmignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.github/
2+
.circleci/
3+
14
*.iml
25
.idea/
36
.DS_Store
@@ -7,10 +10,20 @@ android/android.iml
710
android/gradlew
811
android/gradlew.bat
912
android/local.properties
13+
android/.project
14+
android/.settings
15+
*Test.java
1016

1117
ios/.DS_Store
1218

1319
build/
1420
InstabugSample/
1521
node_modules/
1622
coverage/
23+
__tests__/
24+
25+
Dangerfile
26+
babel.config.js
27+
codecov.yml
28+
typescript_validator.js
29+
.prettierrc.js

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 10.13.0 (2022-03-17)
2+
3+
* Adds Instabug Experiments APIs
4+
* Adds defensive type checking in Instabug logging APIs
5+
* Bumps Instabug iOS SDK to v10.11.9
6+
* Bumps Instabug Android SDK to v10.13.0
7+
* Adapts the strict requirement of newer Expo versions to use the React header with the iOS import statements
8+
* Fixes an issue with GraphQL requests not being grouped correctly
9+
* Excludes unnecessary files from the published npm package
10+
111
## 10.11.0 (2021-12-23)
212

313
* Adds GraphQL support for APM network traces with proper grouping

InstabugSample/__tests__/instabugUtils.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ describe('Test global error handler', () => {
3333
handler({name: 'TypeError', message: 'This is a type error.'}, false);
3434
const expected = {
3535
message: 'TypeError - This is a type error.',
36+
e_message: 'This is a type error.',
37+
e_name: 'TypeError',
3638
os: 'ios',
3739
platform: 'react_native',
3840
exception: [],
@@ -48,6 +50,8 @@ describe('Test global error handler', () => {
4850
handler({name: 'TypeError', message: 'This is a type error.'}, false);
4951
const expected = {
5052
message: 'TypeError - This is a type error.',
53+
e_message: 'This is a type error.',
54+
e_name: 'TypeError',
5155
os: 'android',
5256
platform: 'react_native',
5357
exception: [],

InstabugSample/ios/InstabugSampleTests/InstabugSampleTests.m

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,4 +397,29 @@ - (void)testClearLogs {
397397
OCMVerify([mock clearAllLogs]);
398398
}
399399

400+
- (void)testAddExperiments {
401+
id mock = OCMClassMock([Instabug class]);
402+
NSArray *experiments = @[@"exp1", @"exp2"];
403+
404+
OCMStub([mock addExperiments:experiments]);
405+
[self.instabugBridge addExperiments:experiments];
406+
OCMVerify([mock addExperiments:experiments]);
407+
}
408+
409+
- (void)testRemoveExperiments {
410+
id mock = OCMClassMock([Instabug class]);
411+
NSArray *experiments = @[@"exp1", @"exp2"];
412+
413+
OCMStub([mock removeExperiments:experiments]);
414+
[self.instabugBridge removeExperiments:experiments];
415+
OCMVerify([mock removeExperiments:experiments]);
416+
}
417+
418+
- (void)testClearAllExperiments {
419+
id mock = OCMClassMock([Instabug class]);
420+
OCMStub([mock clearAllExperiments]);
421+
[self.instabugBridge clearAllExperiments];
422+
OCMVerify([mock clearAllExperiments]);
423+
}
424+
400425
@end

InstabugSample/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3555,7 +3555,7 @@ ini@^1.3.4:
35553555
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
35563556

35573557
instabug-reactnative@../:
3558-
version "10.9.1"
3558+
version "10.11.0"
35593559

35603560
internal-slot@^1.0.3:
35613561
version "1.0.3"
@@ -5104,9 +5104,9 @@ nan@^2.14.0:
51045104
integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==
51055105

51065106
nanoid@^3.1.23:
5107-
version "3.1.29"
5108-
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.29.tgz#214fb2d7a33e1a5bef4757b779dfaeb6a4e5aeb4"
5109-
integrity sha512-dW2pUSGZ8ZnCFIlBIA31SV8huOGCHb6OwzVCc7A69rb/a+SgPBwfmLvK5TKQ3INPbRkcI8a/Owo0XbiTNH19wg==
5107+
version "3.2.0"
5108+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.2.0.tgz#62667522da6673971cca916a6d3eff3f415ff80c"
5109+
integrity sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==
51105110

51115111
nanomatch@^1.2.9:
51125112
version "1.2.13"

README.md

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,7 @@ Updating to a new version? Check the [Update Guide](#update-guide) before bumpin
3636
cd ios && pod install && cd ..
3737
```
3838

39-
3. **For React Native >= 0.60**, simply run the command:
40-
41-
```bash
42-
react-native add-instabug
43-
```
44-
45-
**For React Native < 0.60**, link the bridging files in the `instabug-reactnative` package:
39+
3. **For React Native < 0.60**, link the bridging files in the `instabug-reactnative` package:
4640

4741
```bash
4842
react-native link instabug-reactnative
@@ -55,14 +49,14 @@ Updating to a new version? Check the [Update Guide](#update-guide) before bumpin
5549
```javascript
5650
import Instabug from 'instabug-reactnative';
5751
```
58-
* ### iOS
59-
Initialize it in the `constructor` or `componentWillMount`. This line will let the Instabug SDK work with the default behavior. The SDK will be invoked when the device is shaken. You can customize this behavior through the APIs.
52+
### iOS
53+
- Initialize it in the `constructor` or `componentWillMount`. This line will let the Instabug SDK work with the default behavior. The SDK will be invoked when the device is shaken. You can customize this behavior through the APIs.
6054

6155
```javascript
6256
Instabug.start('IOS_APP_TOKEN', [Instabug.invocationEvent.shake]);
6357
```
64-
* ### Android
65-
1. Open `android/app/src/main/java/[...]/MainApplication.java`
58+
### Android
59+
- Open `android/app/src/main/java/[...]/MainApplication.java`
6660
* Make sure to import the package class:
6761
`import com.instabug.reactlibrary.RNInstabugReactnativePackage;`
6862
* **For React Native >= 0.60**
@@ -101,18 +95,7 @@ import Instabug from 'instabug-reactnative';
10195
* You can change the invocation event from here, simply by replacing the `"shake"` with any of the following `"button"`, `"none"`, `"screenshot"`, or `"swipe"`. You can change the primary color by replacing the `"#1D82DC"` with any color of your choice.
10296
In the case that you are using the floating button as an invocation event, you can change the floating button edge and the floating button offset using the last two methods, by replacing `"left"` to `"right"`, and by changing the offset number.
10397
104-
You can find your app token by selecting the SDK tab from your [**Instabug dashboard**](https://dashboard.instabug.com/app/sdk/).
105-
106-
2. Make sure the following snippet is added to your project level `build.gradle`. This should be added automatically upon linking. If not, you can add it manually.
107-
```dart
108-
allprojects {
109-
repositories {
110-
maven {
111-
url "https://sdks.instabug.com/nexus/repository/instabug-cp"
112-
}
113-
}
114-
}
115-
```
98+
_You can find your app token by selecting the SDK tab from your [**Instabug dashboard**](https://dashboard.instabug.com)._
11699
117100
## Microphone and Photo Library Usage Description (iOS Only)
118101
@@ -202,52 +185,6 @@ You can disable Repro Steps using the following API:
202185
Instabug.setReproStepsMode(Instabug.reproStepsMode.disabled);
203186
```
204187
205-
## Update Guide
206-
### Updating to versions 8.0-8.4.x
207-
208-
When updating to version 8.0 through 8.4.x, you'll need to perform the steps below.
209-
210-
1. Unlink Instabug
211-
```bash
212-
react-native unlink instabug-reactnative
213-
```
214-
215-
2. Install the new version of Instabug
216-
```bash
217-
npm install instabug-reactnative
218-
```
219-
220-
3. Link Instabug
221-
```bash
222-
react-native link instabug-reactnative
223-
```
224-
225-
### Updating to version 8.5
226-
227-
_Only for apps using React Native >= 0.60. If you're using a lower version, you don't need to perform any extra steps when updating._
228-
229-
Version 8.5 adds support for React Native 0.60. To use Instabug 8.5 with React Native 0.60, you'll need to perform the following steps.
230-
231-
1. Unlink Instabug
232-
```bash
233-
react-native unlink instabug-reactnative
234-
```
235-
236-
2. Install the new version of Instabug
237-
```bash
238-
npm install instabug-reactnative
239-
```
240-
241-
3. Add Instabug to your project
242-
```bash
243-
react-native add-instabug
244-
```
245-
246-
## Features that are not supported yet
247-
248-
- Push Notification Support for In-App Messaging
249-
- [User Steps](https://help.instabug.com/en/articles/2515300-instabug-report-logs-user-steps).
250-
251188
## Documentation
252189
253190
For more details about the supported APIs and how to use them, check our [**Documentation**](https://docs.instabug.com/docs/react-native-overview).

__tests__/crashReporting.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ describe('CrashReporting Module', () => {
4949

5050
const expectedObject = {
5151
message: 'TypeError - Invalid type',
52+
e_message: 'Invalid type',
53+
e_name: 'TypeError',
5254
os: 'ios',
5355
platform: 'react_native',
5456
exception: 'javascriptStackTrace'
@@ -66,6 +68,8 @@ describe('CrashReporting Module', () => {
6668

6769
const expectedObject = {
6870
message: 'TypeError - Invalid type',
71+
e_message: 'Invalid type',
72+
e_name: 'TypeError',
6973
os: 'android',
7074
platform: 'react_native',
7175
exception: 'javascriptStackTrace'
@@ -84,6 +88,8 @@ describe('CrashReporting Module', () => {
8488
const errorObject = { name: 'TypeError', message: 'Invalid type' };
8589
const expectedObject = {
8690
message: 'TypeError - Invalid type',
91+
e_message: 'Invalid type',
92+
e_name: 'TypeError',
8793
os: 'android',
8894
platform: 'react_native',
8995
exception: 'javascriptStackTrace'

__tests__/index.spec.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ describe('Instabug Module', () => {
6666
const sendHandledJSCrash = sinon.spy(NativeModules.Instabug, 'sendHandledJSCrash');
6767
const sendJSCrash = sinon.spy(NativeModules.Instabug, 'sendJSCrash');
6868
const reportScreenChange = sinon.spy(NativeModules.Instabug, 'reportScreenChange');
69+
const addExperiments = sinon.spy(NativeModules.Instabug, 'addExperiments');
70+
const removeExperiments = sinon.spy(NativeModules.Instabug, 'removeExperiments');
71+
const clearAllExperiments = sinon.spy(NativeModules.Instabug, 'clearAllExperiments');
6972

7073
beforeEach(() => {
7174
startWithToken.resetHistory();
@@ -301,7 +304,7 @@ describe('Instabug Module', () => {
301304
const message = 'log';
302305
Instabug.logVerbose(message);
303306

304-
expect(logVerbose.calledOnceWithExactly(message)).toBe(true);
307+
expect(logVerbose.calledOnce).toBe(true);
305308

306309
});
307310

@@ -310,7 +313,7 @@ describe('Instabug Module', () => {
310313
const message = 'log';
311314
Instabug.logDebug(message);
312315

313-
expect(logDebug.calledOnceWithExactly(message)).toBe(true);
316+
expect(logDebug.calledOnce).toBe(true);
314317

315318
});
316319

@@ -319,7 +322,7 @@ describe('Instabug Module', () => {
319322
const message = 'log';
320323
Instabug.logInfo(message);
321324

322-
expect(logInfo.calledOnceWithExactly(message)).toBe(true);
325+
expect(logInfo.calledOnce).toBe(true);
323326

324327
});
325328

@@ -328,7 +331,7 @@ describe('Instabug Module', () => {
328331
const message = 'log';
329332
Instabug.logWarn(message);
330333

331-
expect(logWarn.calledOnceWithExactly(message)).toBe(true);
334+
expect(logWarn.calledOnce).toBe(true);
332335

333336
});
334337

@@ -337,7 +340,7 @@ describe('Instabug Module', () => {
337340
const message = 'log';
338341
Instabug.logError(message);
339342

340-
expect(logError.calledOnceWithExactly(message)).toBe(true);
343+
expect(logError.calledOnce).toBe(true);
341344

342345
});
343346

@@ -699,4 +702,20 @@ describe('Instabug Module', () => {
699702

700703
});
701704

705+
it('should call native addExperiments method', () => {
706+
const experiments = ['exp1', 'exp2'];
707+
Instabug.addExperiments(experiments);
708+
expect(addExperiments.calledOnceWithExactly(experiments)).toBeTruthy();
709+
});
710+
711+
it('should call native removeExperiments method', () => {
712+
const experiments = ['exp1', 'exp2'];
713+
Instabug.removeExperiments(experiments);
714+
expect(removeExperiments.calledOnceWithExactly(experiments)).toBeTruthy();
715+
});
716+
717+
it('should call native clearAllExperiments method', () => {
718+
Instabug.clearAllExperiments();
719+
expect(clearAllExperiments.calledOnce).toBeTruthy();
720+
});
702721
});

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ android {
2929
dependencies {
3030
implementation 'com.android.support:multidex:1.0.3'
3131
implementation 'com.facebook.react:react-native:+'
32-
api('com.instabug.library:instabug:10.11.0') {
32+
api('com.instabug.library:instabug:10.13.0') {
3333
exclude group: 'com.android.support:appcompat-v7'
3434
}
3535
testImplementation "org.mockito:mockito-inline:3.4.0"

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,52 @@ private void sendEvent(ReactApplicationContext reactContext,
23612361
.emit(eventName, params);
23622362
}
23632363

2364+
@ReactMethod
2365+
public void addExperiments(final ReadableArray experiments) {
2366+
MainThreadHandler.runOnMainThread(new Runnable() {
2367+
@Override
2368+
public void run() {
2369+
try {
2370+
Object[] objectArray = ArrayUtil.toArray(experiments);
2371+
String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class);
2372+
Instabug.addExperiments(Arrays.asList(stringArray));
2373+
} catch (Exception e) {
2374+
e.printStackTrace();
2375+
}
2376+
}
2377+
});
2378+
}
2379+
2380+
@ReactMethod
2381+
public void removeExperiments(final ReadableArray experiments) {
2382+
MainThreadHandler.runOnMainThread(new Runnable() {
2383+
@Override
2384+
public void run() {
2385+
try {
2386+
Object[] objectArray = ArrayUtil.toArray(experiments);
2387+
String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class);
2388+
Instabug.removeExperiments(Arrays.asList(stringArray));
2389+
} catch (Exception e) {
2390+
e.printStackTrace();
2391+
}
2392+
}
2393+
});
2394+
}
2395+
2396+
@ReactMethod
2397+
public void clearAllExperiments() {
2398+
MainThreadHandler.runOnMainThread(new Runnable() {
2399+
@Override
2400+
public void run() {
2401+
try {
2402+
Instabug.clearAllExperiments();
2403+
} catch (Exception e) {
2404+
e.printStackTrace();
2405+
}
2406+
}
2407+
});
2408+
}
2409+
23642410
@Override
23652411
public Map<String, Object> getConstants() {
23662412
final Map<String, Object> constants = new HashMap<>();

0 commit comments

Comments
 (0)