Skip to content

Commit 6692f7b

Browse files
Release: v14.0.0 (#1315)
1 parent f3ce218 commit 6692f7b

File tree

67 files changed

+5668
-4029
lines changed

Some content is hidden

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

67 files changed

+5668
-4029
lines changed

.circleci/config.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ commands:
4646
type: boolean
4747
default: false
4848
steps:
49+
- run:
50+
name: Uninstall Existing CocoaPods
51+
command: gem uninstall -x cocoapods
52+
- run:
53+
name: Install CocoaPods
54+
command: gem install cocoapods:1.14.0
4955
- restore_cache:
5056
name: Restore Pods Cache
5157
keys:
@@ -252,7 +258,7 @@ jobs:
252258
# ios/upload_sourcemap.sh files respectively.
253259
sync_generated_files:
254260
macos:
255-
xcode: 13.4.1
261+
xcode: 15.4.0
256262
resource_class: macos.m1.medium.gen1
257263
steps:
258264
- advanced-checkout/shallow-checkout
@@ -275,7 +281,7 @@ jobs:
275281
type: boolean
276282
default: false
277283
macos:
278-
xcode: 13.4.1
284+
xcode: 15.4.0
279285
resource_class: macos.m1.medium.gen1
280286
working_directory: ~/project/examples/default
281287
environment:
@@ -295,7 +301,7 @@ jobs:
295301
-scheme InstabugExample \
296302
-resultBundlePath coverage/result.xcresult \
297303
-sdk iphonesimulator \
298-
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
304+
-destination 'platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.5' \
299305
test | xcpretty
300306
- when:
301307
condition: << parameters.collect_coverage >>
@@ -315,7 +321,7 @@ jobs:
315321
type: steps
316322
default: []
317323
macos:
318-
xcode: 13.4.1
324+
xcode: 15.4.0
319325
resource_class: macos.m1.medium.gen1
320326
environment:
321327
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
@@ -414,7 +420,7 @@ jobs:
414420

415421
publish:
416422
macos:
417-
xcode: 13.4.1
423+
xcode: 15.4.0
418424
resource_class: macos.m1.medium.gen1
419425
working_directory: '~'
420426
steps:

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## [14.0.0](https://github.com/Instabug/Instabug-React-Native/compare/v13.4.0...14.0.0) (November 19, 2024)
4+
5+
### Added
6+
7+
- Add support for opting into session syncing ([#1292](https://github.com/Instabug/Instabug-React-Native/pull/1292)).
8+
9+
### Changed
10+
11+
- Bump Instabug iOS SDK to v14.0.0 ([#1312](https://github.com/Instabug/Instabug-React-Native/pull/1312)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/14.0.0).
12+
- Bump Instabug Android SDK to v14.0.0 ([#1312](https://github.com/Instabug/Instabug-React-Native/pull/1312)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.0.0).
13+
14+
### Fixed
15+
16+
- Replace thrown errors with logs ([#1220](https://github.com/Instabug/Instabug-React-Native/pull/1220))
17+
318
## [13.4.0](https://github.com/Instabug/Instabug-React-Native/compare/v13.3.0...v13.4.0) (October 2, 2024)
419

520
### Added

android/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,17 @@ dependencies {
7979
testImplementation "org.mockito:mockito-android:3.4.0"
8080
testImplementation 'junit:junit:4.13.2'
8181
}
82+
83+
rootProject.allprojects {
84+
repositories {
85+
google()
86+
jcenter()
87+
maven {
88+
url "https://mvn.instabug.com/nexus/repository/instabug-internal/"
89+
credentials {
90+
username "instabug"
91+
password System.getenv('INSTABUG_REPOSITORY_PASSWORD')
92+
}
93+
}
94+
}
95+
}

android/jacoco.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ task jacocoTestReport(type: JacocoReport) {
3737
'**/*Binding.*'
3838
]
3939

40-
def jClasses = "${project.buildDir}/intermediates/javac/debug/classes"
40+
def jClasses = "${project.buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes"
4141
def javaClasses = fileTree(dir: jClasses, excludes: excludes)
4242
def sourceDirs = ["${project.projectDir}/src/main/java"]
4343
classDirectories.from = files(javaClasses)

android/native.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project.ext.instabug = [
2-
version: '13.4.1'
2+
version: '14.0.0'
33
]
44

55
dependencies {

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.instabug.library.invocation.InstabugInvocationEvent;
1616
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
1717
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
18+
import com.instabug.library.sessionreplay.model.SessionMetadata;
1819
import com.instabug.library.ui.onboarding.WelcomeMessage;
1920

2021
import java.util.ArrayList;
@@ -58,6 +59,7 @@ static Map<String, Object> getAll() {
5859
putAll(nonFatalExceptionLevel);
5960
putAll(locales);
6061
putAll(placeholders);
62+
putAll(launchType);
6163
}};
6264
}
6365

@@ -238,4 +240,18 @@ static Map<String, Object> getAll() {
238240
put("team", Key.CHATS_TEAM_STRING_NAME);
239241
put("insufficientContentMessage", Key.COMMENT_FIELD_INSUFFICIENT_CONTENT);
240242
}};
243+
244+
public static ArgsMap<String> launchType = new ArgsMap<String>() {{
245+
put("cold", SessionMetadata.LaunchType.COLD);
246+
put("warm",SessionMetadata.LaunchType.WARM );
247+
put("unknown","unknown");
248+
}};
249+
250+
// Temporary workaround to be removed in future release
251+
// This is used for mapping native `LaunchType` values into React Native enum values.
252+
public static HashMap<String,String> launchTypeReversed = new HashMap<String,String>() {{
253+
put(SessionMetadata.LaunchType.COLD,"cold");
254+
put(SessionMetadata.LaunchType.WARM,"warm" );
255+
}};
256+
241257
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ final class Constants {
99

1010
final static String IBG_ON_NEW_MESSAGE_HANDLER = "IBGonNewMessageHandler";
1111
final static String IBG_ON_NEW_REPLY_RECEIVED_CALLBACK = "IBGOnNewReplyReceivedCallback";
12+
final static String IBG_SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION = "IBGSessionReplayOnSyncCallback";
13+
1214
}

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

Lines changed: 115 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
11
package com.instabug.reactlibrary;
22

3+
4+
import androidx.annotation.NonNull;
35
import androidx.annotation.Nullable;
46

7+
import com.facebook.react.bridge.Arguments;
58
import com.facebook.react.bridge.Promise;
69
import com.facebook.react.bridge.ReactApplicationContext;
7-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
810
import com.facebook.react.bridge.ReactMethod;
9-
import com.instabug.chat.Replies;
11+
import com.facebook.react.bridge.ReadableArray;
12+
import com.facebook.react.bridge.ReadableMap;
13+
import com.facebook.react.bridge.WritableArray;
14+
import com.facebook.react.bridge.WritableMap;
1015
import com.instabug.library.OnSessionReplayLinkReady;
16+
import com.instabug.library.SessionSyncListener;
1117
import com.instabug.library.sessionreplay.SessionReplay;
18+
import com.instabug.library.sessionreplay.model.SessionMetadata;
19+
import com.instabug.reactlibrary.utils.EventEmitterModule;
1220
import com.instabug.reactlibrary.utils.MainThreadHandler;
21+
import java.util.ArrayList;
22+
import java.util.List;
23+
import java.util.concurrent.CountDownLatch;
1324

1425
import javax.annotation.Nonnull;
1526

16-
public class RNInstabugSessionReplayModule extends ReactContextBaseJavaModule {
27+
public class RNInstabugSessionReplayModule extends EventEmitterModule {
1728

1829
public RNInstabugSessionReplayModule(ReactApplicationContext reactApplicationContext) {
1930
super(reactApplicationContext);
2031
}
2132

33+
@ReactMethod
34+
public void addListener(String event) {
35+
super.addListener(event);
36+
}
37+
38+
@ReactMethod
39+
public void removeListeners(Integer count) {
40+
super.removeListeners(count);
41+
}
42+
2243
@Nonnull
2344
@Override
2445
public String getName() {
@@ -79,7 +100,7 @@ public void run() {
79100
e.printStackTrace();
80101
}
81102
}
82-
});
103+
});
83104
}
84105

85106
@ReactMethod
@@ -97,6 +118,96 @@ public void onSessionReplayLinkReady(@Nullable String link) {
97118
}
98119
});
99120

121+
}
122+
123+
public ReadableMap getSessionMetadataMap(SessionMetadata sessionMetadata){
124+
WritableMap params = Arguments.createMap();
125+
params.putString("appVersion",sessionMetadata.getAppVersion());
126+
params.putString("OS",sessionMetadata.getOs());
127+
params.putString("device",sessionMetadata.getDevice());
128+
params.putDouble("sessionDurationInSeconds",(double)sessionMetadata.getSessionDurationInSeconds());
129+
params.putBoolean("hasLinkToAppReview",sessionMetadata.getLinkedToReview());
130+
params.putArray("networkLogs",getNetworkLogsArray(sessionMetadata.getNetworkLogs()));
131+
132+
String launchType = sessionMetadata.getLaunchType();
133+
Long launchDuration = sessionMetadata.getLaunchDuration();
100134

135+
if (launchType != null) {
136+
params.putString("launchType",ArgsRegistry.launchTypeReversed.get(sessionMetadata.getLaunchType()) );
137+
} else {
138+
params.putString("launchType",ArgsRegistry.launchType.get("unknown"));
139+
}
140+
141+
if (launchDuration != null) {
142+
params.putDouble("launchDuration", (double)launchDuration);
143+
} else {
144+
params.putDouble("launchDuration", 0.0);
145+
}
146+
147+
return params;
148+
}
149+
150+
public ReadableArray getNetworkLogsArray(List<SessionMetadata.NetworkLog> networkLogList ) {
151+
WritableArray networkLogs = Arguments.createArray();
152+
153+
if (networkLogList != null) {
154+
for (SessionMetadata.NetworkLog log : networkLogList) {
155+
WritableMap networkLog = Arguments.createMap();
156+
networkLog.putString("url", log.getUrl());
157+
networkLog.putDouble("duration", log.getDuration());
158+
networkLog.putInt("statusCode", log.getStatusCode());
159+
160+
networkLogs.pushMap(networkLog);
161+
}
162+
}
163+
164+
return networkLogs;
101165
}
166+
167+
private boolean shouldSync = true;
168+
private CountDownLatch latch;
169+
@ReactMethod
170+
public void setSyncCallback() {
171+
MainThreadHandler.runOnMainThread(new Runnable() {
172+
@Override
173+
public void run() {
174+
try {
175+
SessionReplay.setSyncCallback(new SessionSyncListener() {
176+
@Override
177+
public boolean onSessionReadyToSync(@NonNull SessionMetadata sessionMetadata) {
178+
179+
sendEvent(Constants.IBG_SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION,getSessionMetadataMap(sessionMetadata));
180+
181+
latch = new CountDownLatch(1);
182+
183+
try {
184+
latch.await();
185+
} catch (InterruptedException e) {
186+
e.printStackTrace();
187+
return true;
188+
}
189+
190+
return shouldSync;
191+
}
192+
});
193+
}
194+
catch(Exception e){
195+
e.printStackTrace();
196+
}
197+
198+
}
199+
});
200+
}
201+
202+
@ReactMethod
203+
public void evaluateSync(boolean result) {
204+
shouldSync = result;
205+
206+
if (latch != null) {
207+
latch.countDown();
208+
}
209+
}
210+
211+
212+
102213
}

android/src/main/java/com/instabug/reactlibrary/utils/EventEmitterModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import com.facebook.react.bridge.ReactApplicationContext;
77
import com.facebook.react.bridge.ReactContextBaseJavaModule;
8+
import com.facebook.react.bridge.ReadableMap;
89
import com.facebook.react.bridge.WritableMap;
910
import com.facebook.react.modules.core.DeviceEventManagerModule;
1011

@@ -16,7 +17,7 @@ public EventEmitterModule(ReactApplicationContext context) {
1617
}
1718

1819
@VisibleForTesting
19-
public void sendEvent(String event, @Nullable WritableMap params) {
20+
public void sendEvent(String event, @Nullable ReadableMap params) {
2021
if (listenerCount > 0) {
2122
getReactApplicationContext()
2223
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)

0 commit comments

Comments
 (0)