Skip to content

Commit e2da956

Browse files
authored
[MOB-8875] Bump Native SDKs v11 (#709)
* Bump Native SDKs to v11.0.0 * Remove `Surveys.setThresholdForReshowingSurveyAfterDismiss` * Add `Instabug.addPrivateView` * Add `Instabug.removePrivateView` * Remove unresolved android imports * Remove `surveysCustomThanks-*` Strings Remove the following strings: 1. surveysCustomThanksTitle 2. surveysCustomThanksSubtitle * Add `BugReporting.setAutoScreenRecordingDurationIOS` This replaces `BugReporting.setAutoScreenRecordingMaxDuration`. * Update `Surveys.hasRespondedToSurvey` on iOS * Fix Surveys warnings on iOS * Update `RCTLogLevel` and `IBGLogLevel` mapping * Bump Android SDK to v11.2.0 * Bump iOS SDK to v11.0.2
1 parent fbb75ee commit e2da956

File tree

209 files changed

+12486
-11171
lines changed

Some content is hidden

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

209 files changed

+12486
-11171
lines changed

InstabugSample/ios/InstabugSampleTests/InstabugBugReportingTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ - (void) testgivenBoolean$setAutoScreenRecordingEnabled_whenQuery_thenShouldCall
165165
XCTAssertTrue(IBGBugReporting.autoScreenRecordingEnabled);
166166
}
167167

168-
- (void) testgivenArgs$setAutoScreenRecordingMaxDuration_whenQuery_thenShouldCallNativeApi {
168+
- (void) testgivenArgs$setAutoScreenRecordingDuration_whenQuery_thenShouldCallNativeApi {
169169
CGFloat duration = 12.3;
170-
[self.instabugBridge setAutoScreenRecordingMaxDuration:duration];
170+
[self.instabugBridge setAutoScreenRecordingDuration:duration];
171171
XCTAssertEqual(IBGBugReporting.autoScreenRecordingDuration, duration);
172172
}
173173

InstabugSample/ios/InstabugSampleTests/InstabugSurveysTests.m

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ - (void) testAutoShowingSurveysEnabled {
6969
OCMVerify([mock setAutoShowingEnabled:isEnabled]);
7070
}
7171

72-
- (void) testSetThresholdForReshowingSurveyAfterDismiss {
73-
id mock = OCMClassMock([IBGSurveys class]);
74-
NSInteger sessionCount = 1;
75-
NSInteger daysCount = 2;
76-
77-
OCMStub([mock setThresholdForReshowingSurveyAfterDismiss:sessionCount daysCount:daysCount]);
78-
[self.instabugBridge setThresholdForReshowingSurveyAfterDismiss:sessionCount daysCount:daysCount];
79-
OCMVerify([mock setThresholdForReshowingSurveyAfterDismiss:sessionCount daysCount:daysCount]);
80-
}
81-
8272
- (void) testSetShouldShowSurveysWelcomeScreen {
8373
id mock = OCMClassMock([IBGSurveys class]);
8474
BOOL isEnabled = YES;
@@ -101,13 +91,13 @@ - (void) testHasRespondedToSurveyWithToken {
10191
XCTestExpectation *expectation = [self expectationWithDescription:@"Testing hasRespondedToSurveyWithToken callback"];
10292
RCTResponseSenderBlock callback = ^void(NSArray *response) {
10393
BOOL actualValue = [response[0] boolValue];
104-
XCTAssertTrue(actualValue);
94+
XCTAssertFalse(actualValue);
10595
[expectation fulfill];
10696
};
10797

108-
OCMStub([mock hasRespondedToSurveyWithToken:surveyToken]).andReturn(YES);
98+
OCMStub([mock hasRespondedToSurveyWithToken:surveyToken completionHandler:[OCMArg invokeBlock]]);
10999
[self.instabugBridge hasRespondedToSurvey:surveyToken callback:callback];
110-
OCMVerify([mock hasRespondedToSurveyWithToken:surveyToken]);
100+
OCMVerify([mock hasRespondedToSurveyWithToken:surveyToken completionHandler:[OCMArg isNotNil]]);
111101
[self waitForExpectationsWithTimeout:EXPECTATION_TIMEOUT handler:nil];
112102
}
113103

__tests__/bugReporting.spec.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Testing BugReporting Module', () => {
3030
const setOnInvokeHandler = sinon.spy(NativeModules.IBGBugReporting, 'setOnInvokeHandler');
3131
const setOnSDKDismissedHandler = sinon.spy(NativeModules.IBGBugReporting, 'setOnSDKDismissedHandler');
3232
const setAutoScreenRecordingEnabled = sinon.spy(NativeModules.IBGBugReporting, 'setAutoScreenRecordingEnabled');
33-
const setAutoScreenRecordingMaxDuration = sinon.spy(NativeModules.IBGBugReporting, 'setAutoScreenRecordingMaxDuration');
33+
const setAutoScreenRecordingDuration = sinon.spy(NativeModules.IBGBugReporting, 'setAutoScreenRecordingDuration');
3434
const setViewHierarchyEnabled = sinon.spy(NativeModules.IBGBugReporting, 'setViewHierarchyEnabled');
3535
const didSelectPromptOptionHandler = sinon.spy(NativeModules.IBGBugReporting, 'setDidSelectPromptOptionHandler');
3636
const setFloatingButtonEdge = sinon.spy(NativeModules.IBGBugReporting, 'setFloatingButtonEdge');
@@ -211,12 +211,10 @@ describe('Testing BugReporting Module', () => {
211211

212212
});
213213

214-
it('should call the native method setAutoScreenRecordingMaxDuration', () => {
215-
216-
BugReporting.setAutoScreenRecordingMaxDuration(30);
217-
218-
expect(setAutoScreenRecordingMaxDuration.calledOnceWithExactly(30)).toBe(true);
219-
214+
it('should call the native method setAutoScreenRecordingDuration on iOS', () => {
215+
Platform.OS = 'ios';
216+
BugReporting.setAutoScreenRecordingDurationIOS(30);
217+
expect(setAutoScreenRecordingDuration.calledOnceWithExactly(30)).toBe(true);
220218
});
221219

222220
it('should call the native method setViewHierarchyEnabled', () => {

__tests__/index.spec.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ describe('Instabug Module', () => {
5656
const showWelcomeMessageWithMode = sinon.spy(NativeModules.Instabug, 'showWelcomeMessageWithMode');
5757
const setWelcomeMessageMode = sinon.spy(NativeModules.Instabug, 'setWelcomeMessageMode');
5858
const setFileAttachment = sinon.spy(NativeModules.Instabug, 'setFileAttachment');
59-
const hideView = sinon.spy(NativeModules.Instabug, 'hideView');
59+
const addPrivateView = sinon.spy(NativeModules.Instabug, 'addPrivateView');
60+
const removePrivateView = sinon.spy(NativeModules.Instabug, 'removePrivateView');
6061
const show = sinon.spy(NativeModules.Instabug, 'show');
6162
const setPreSendingHandler = sinon.spy(NativeModules.Instabug, 'setPreSendingHandler');
6263
const callPrivateApi = sinon.spy(NativeModules.Instabug, 'callPrivateApi');
@@ -78,10 +79,10 @@ describe('Instabug Module', () => {
7879
disable.resetHistory();
7980
isRunningLive.resetHistory();
8081
setFileAttachment.resetHistory();
81-
hideView.resetHistory();
82+
addPrivateView.resetHistory();
83+
removePrivateView.resetHistory();
8284
setPreSendingHandler.resetHistory();
8385
IBGEventEmitter.removeAllListeners();
84-
8586
});
8687

8788
it('componentDidAppearListener should call the native method reportScreenChange', () => {
@@ -500,24 +501,20 @@ describe('Instabug Module', () => {
500501

501502
});
502503

503-
it('should call the native method hideView nativeTag when platform is ios', () => {
504+
it('should call the native method addPrivateView', () => {
504505

505-
Platform.OS = 'ios';
506506
<Text ref={(c) => this.textView = c} />
507-
Instabug.setPrivateView(this.textView);
508-
509-
expect(hideView.calledOnceWithExactly(findNodeHandle(this.textView))).toBe(true);
507+
Instabug.addPrivateView(this.textView);
510508

509+
expect(addPrivateView.calledOnceWithExactly(findNodeHandle(this.textView))).toBe(true);
511510
});
512511

513-
it('should call the native method hideView with [nativeTag] when platform is android', () => {
512+
it('should call the native method removePrivateView', () => {
514513

515-
Platform.OS = 'android';
516514
<Text ref={(c) => this.textView = c} />
517-
Instabug.setPrivateView(this.textView);
518-
519-
expect(hideView.calledOnceWithExactly([findNodeHandle(this.textView)])).toBe(true);
515+
Instabug.removePrivateView(this.textView);
520516

517+
expect(removePrivateView.calledOnceWithExactly(findNodeHandle(this.textView))).toBe(true);
521518
});
522519

523520
it('should call the native method show', () => {

__tests__/surveys.spec.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ describe("Surveys Module", () => {
1919
NativeModules.IBGSurveys,
2020
"showSurveysIfAvailable"
2121
);
22-
const setThresholdForReshowingSurveyAfterDismiss = sinon.spy(
23-
NativeModules.IBGSurveys,
24-
"setThresholdForReshowingSurveyAfterDismiss"
25-
);
2622
const getAvailableSurveys = sinon.spy(
2723
NativeModules.IBGSurveys,
2824
"getAvailableSurveys"
@@ -73,19 +69,6 @@ describe("Surveys Module", () => {
7369
expect(showSurveysIfAvailable.calledOnce).toBe(true);
7470
});
7571

76-
it("should call the native method setThresholdForReshowingSurveyAfterDismiss", () => {
77-
const sessionCount = 2;
78-
const daysCount = 3;
79-
Surveys.setThresholdForReshowingSurveyAfterDismiss(sessionCount, daysCount);
80-
81-
expect(
82-
setThresholdForReshowingSurveyAfterDismiss.calledOnceWithExactly(
83-
sessionCount,
84-
daysCount
85-
)
86-
).toBe(true);
87-
});
88-
8972
it("should call the native method getAvailableSurveys", () => {
9073
const callback = jest.fn();
9174
Surveys.getAvailableSurveys(callback);

android/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ android {
3232
dependencies {
3333
implementation "androidx.multidex:multidex:2.0.1"
3434
implementation 'com.facebook.react:react-native:+'
35-
api('com.instabug.library:instabug:10.13.0') {
36-
exclude group: 'com.android.support:appcompat-v7'
37-
}
35+
implementation 'com.instabug.library:instabug:11.2.0'
36+
3837
testImplementation "org.mockito:mockito-inline:3.4.0"
3938
testImplementation "org.mockito:mockito-android:3.4.0"
4039
testImplementation 'junit:junit:4.13.2'
41-
4240
}
4341

4442

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

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import com.instabug.apm.APM;
3030
import com.instabug.bug.BugReporting;
3131
import com.instabug.bug.instabugdisclaimer.Internal;
32-
import com.instabug.bug.invocation.InvocationMode;
33-
import com.instabug.bug.invocation.InvocationOption;
3432
import com.instabug.bug.invocation.Option;
3533
import com.instabug.chat.Replies;
3634
import com.instabug.crash.CrashReporting;
@@ -218,9 +216,6 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
218216
private final String WELCOME_MESSAGE_LIVE_WELCOME_STEP_TITLE = "liveWelcomeMessageTitle";
219217
private final String WELCOME_MESSAGE_LIVE_WELCOME_STEP_CONTENT = "liveWelcomeMessageContent";
220218

221-
private final String CUSTOM_SURVEY_THANKS_TITLE = "surveysCustomThanksTitle";
222-
private final String CUSTOM_SURVEY_THANKS_SUBTITLE = "surveysCustomThanksSubTitle";
223-
224219
private final String STORE_RATING_THANKS_TITLE = "surveysStoreRatingThanksTitle";
225220
private final String STORE_RATING_THANKS_SUBTITLE = "surveysStoreRatingThanksSubtitle";
226221

@@ -1658,26 +1653,6 @@ public void run() {
16581653
});
16591654
}
16601655

1661-
/**
1662-
* Set after how many sessions should the dismissed survey would show again.
1663-
*
1664-
* @param sessionsCount number of sessions that the dismissed survey will be shown after.
1665-
* @param daysCount number of days that the dismissed survey will show after
1666-
*/
1667-
@ReactMethod
1668-
public void setThresholdForReshowingSurveyAfterDismiss(final int sessionsCount, final int daysCount) {
1669-
MainThreadHandler.runOnMainThread(new Runnable() {
1670-
@Override
1671-
public void run() {
1672-
try {
1673-
Surveys.setThresholdForReshowingSurveyAfterDismiss(sessionsCount, daysCount);
1674-
} catch (Exception e) {
1675-
e.printStackTrace();
1676-
}
1677-
}
1678-
});
1679-
}
1680-
16811656
/**
16821657
* Returns an array containing the available surveys.
16831658
* @param availableSurveysCallback - Callback with the returned value of the available surveys
@@ -1963,24 +1938,41 @@ public void networkLog(String jsonObject) throws JSONException {
19631938

19641939

19651940
@ReactMethod
1966-
public void hideView(final ReadableArray ids) {
1941+
public void addPrivateView(final int reactTag) {
19671942
MainThreadHandler.runOnMainThread(new Runnable() {
19681943
@Override
19691944
public void run() {
19701945
UIManagerModule uiManagerModule = getReactApplicationContext().getNativeModule(UIManagerModule.class);
19711946
uiManagerModule.prependUIBlock(new UIBlock() {
19721947
@Override
19731948
public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
1974-
final View[] arrayOfViews = new View[ids.size()];
1975-
for (int i = 0; i < ids.size(); i++) {
1976-
int viewId = (int) ids.getDouble(i);
1977-
try {
1978-
arrayOfViews[i] = nativeViewHierarchyManager.resolveView(viewId);
1979-
} catch(Exception e) {
1980-
e.printStackTrace();
1981-
}
1949+
try {
1950+
final View view = nativeViewHierarchyManager.resolveView(reactTag);
1951+
Instabug.addPrivateViews(view);
1952+
} catch(Exception e) {
1953+
e.printStackTrace();
1954+
}
1955+
}
1956+
});
1957+
}
1958+
});
1959+
}
1960+
1961+
@ReactMethod
1962+
public void removePrivateView(final int reactTag) {
1963+
MainThreadHandler.runOnMainThread(new Runnable() {
1964+
@Override
1965+
public void run() {
1966+
UIManagerModule uiManagerModule = getReactApplicationContext().getNativeModule(UIManagerModule.class);
1967+
uiManagerModule.prependUIBlock(new UIBlock() {
1968+
@Override
1969+
public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
1970+
try {
1971+
final View view = nativeViewHierarchyManager.resolveView(reactTag);
1972+
Instabug.removePrivateViews(view);
1973+
} catch(Exception e) {
1974+
e.printStackTrace();
19821975
}
1983-
Instabug.setViewsAsPrivate(arrayOfViews);
19841976
}
19851977
});
19861978
}
@@ -2076,10 +2068,6 @@ private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) {
20762068
return InstabugCustomTextPlaceHolder.Key.LIVE_WELCOME_MESSAGE_TITLE;
20772069
case WELCOME_MESSAGE_LIVE_WELCOME_STEP_CONTENT:
20782070
return InstabugCustomTextPlaceHolder.Key.LIVE_WELCOME_MESSAGE_CONTENT;
2079-
case CUSTOM_SURVEY_THANKS_TITLE:
2080-
return InstabugCustomTextPlaceHolder.Key.SURVEYS_CUSTOM_THANKS_TITLE;
2081-
case CUSTOM_SURVEY_THANKS_SUBTITLE:
2082-
return InstabugCustomTextPlaceHolder.Key.SURVEYS_CUSTOM_THANKS_SUBTITLE;
20832071
case STORE_RATING_THANKS_TITLE:
20842072
return InstabugCustomTextPlaceHolder.Key.SURVEYS_STORE_RATING_THANKS_TITLE;
20852073
case STORE_RATING_THANKS_SUBTITLE:
@@ -2308,9 +2296,6 @@ public Map<String, Object> getConstants() {
23082296
constants.put("welcomeMessageLiveWelcomeStepTitle", WELCOME_MESSAGE_LIVE_WELCOME_STEP_TITLE);
23092297
constants.put("welcomeMessageLiveWelcomeStepContent", WELCOME_MESSAGE_LIVE_WELCOME_STEP_CONTENT);
23102298

2311-
constants.put(CUSTOM_SURVEY_THANKS_TITLE, CUSTOM_SURVEY_THANKS_TITLE);
2312-
constants.put(CUSTOM_SURVEY_THANKS_SUBTITLE, CUSTOM_SURVEY_THANKS_SUBTITLE);
2313-
23142299
constants.put(STORE_RATING_THANKS_TITLE, STORE_RATING_THANKS_TITLE);
23152300
constants.put(STORE_RATING_THANKS_SUBTITLE, STORE_RATING_THANKS_SUBTITLE);
23162301

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,27 +166,6 @@ public void onDismiss() {
166166
});
167167
}
168168

169-
/**
170-
* @deprecated
171-
* Set after how many sessions should the dismissed survey would show again.
172-
*
173-
* @param sessionsCount number of sessions that the dismissed survey will be shown after.
174-
* @param daysCount number of days that the dismissed survey will show after
175-
*/
176-
@ReactMethod
177-
public void setThresholdForReshowingSurveyAfterDismiss(final int sessionsCount, final int daysCount) {
178-
MainThreadHandler.runOnMainThread(new Runnable() {
179-
@Override
180-
public void run() {
181-
try {
182-
Surveys.setThresholdForReshowingSurveyAfterDismiss(sessionsCount, daysCount);
183-
} catch (Exception e) {
184-
e.printStackTrace();
185-
}
186-
}
187-
});
188-
}
189-
190169
/**
191170
* Returns an array containing the available surveys.
192171
* @param availableSurveysCallback - Callback with the returned value of the available surveys

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,6 @@ public void tearDown() {
106106
Surveys.showSurveyIfAvailable();
107107
}
108108

109-
@Test
110-
public void givenIntArgs$setThresholdForReshowingSurveyAfterDismiss_whenQuery_thenShouldCallNativeApiWithIntArgs() {
111-
// when
112-
surveysModule.setThresholdForReshowingSurveyAfterDismiss(2,2);
113-
// then
114-
verify(Surveys.class,times(1));
115-
Surveys.setThresholdForReshowingSurveyAfterDismiss(2,2);
116-
}
117-
118-
119109
@Test
120110
public void given$getAvailableSurveys_whenQuery_thenShouldCallNativeApiAndInvokeCallback() throws Exception {
121111
// given

0 commit comments

Comments
 (0)