Skip to content

Commit

Permalink
Release: v14.0.0 (#1315)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedAlaaInstabug authored Nov 19, 2024
1 parent f3ce218 commit 6692f7b
Show file tree
Hide file tree
Showing 67 changed files with 5,668 additions and 4,029 deletions.
16 changes: 11 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ commands:
type: boolean
default: false
steps:
- run:
name: Uninstall Existing CocoaPods
command: gem uninstall -x cocoapods
- run:
name: Install CocoaPods
command: gem install cocoapods:1.14.0
- restore_cache:
name: Restore Pods Cache
keys:
Expand Down Expand Up @@ -252,7 +258,7 @@ jobs:
# ios/upload_sourcemap.sh files respectively.
sync_generated_files:
macos:
xcode: 13.4.1
xcode: 15.4.0
resource_class: macos.m1.medium.gen1
steps:
- advanced-checkout/shallow-checkout
Expand All @@ -275,7 +281,7 @@ jobs:
type: boolean
default: false
macos:
xcode: 13.4.1
xcode: 15.4.0
resource_class: macos.m1.medium.gen1
working_directory: ~/project/examples/default
environment:
Expand All @@ -295,7 +301,7 @@ jobs:
-scheme InstabugExample \
-resultBundlePath coverage/result.xcresult \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
-destination 'platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.5' \
test | xcpretty
- when:
condition: << parameters.collect_coverage >>
Expand All @@ -315,7 +321,7 @@ jobs:
type: steps
default: []
macos:
xcode: 13.4.1
xcode: 15.4.0
resource_class: macos.m1.medium.gen1
environment:
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
Expand Down Expand Up @@ -414,7 +420,7 @@ jobs:

publish:
macos:
xcode: 13.4.1
xcode: 15.4.0
resource_class: macos.m1.medium.gen1
working_directory: '~'
steps:
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [14.0.0](https://github.com/Instabug/Instabug-React-Native/compare/v13.4.0...14.0.0) (November 19, 2024)

### Added

- Add support for opting into session syncing ([#1292](https://github.com/Instabug/Instabug-React-Native/pull/1292)).

### Changed

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

### Fixed

- Replace thrown errors with logs ([#1220](https://github.com/Instabug/Instabug-React-Native/pull/1220))

## [13.4.0](https://github.com/Instabug/Instabug-React-Native/compare/v13.3.0...v13.4.0) (October 2, 2024)

### Added
Expand Down
14 changes: 14 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,17 @@ dependencies {
testImplementation "org.mockito:mockito-android:3.4.0"
testImplementation 'junit:junit:4.13.2'
}

rootProject.allprojects {
repositories {
google()
jcenter()
maven {
url "https://mvn.instabug.com/nexus/repository/instabug-internal/"
credentials {
username "instabug"
password System.getenv('INSTABUG_REPOSITORY_PASSWORD')
}
}
}
}
2 changes: 1 addition & 1 deletion android/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ task jacocoTestReport(type: JacocoReport) {
'**/*Binding.*'
]

def jClasses = "${project.buildDir}/intermediates/javac/debug/classes"
def jClasses = "${project.buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes"
def javaClasses = fileTree(dir: jClasses, excludes: excludes)
def sourceDirs = ["${project.projectDir}/src/main/java"]
classDirectories.from = files(javaClasses)
Expand Down
2 changes: 1 addition & 1 deletion android/native.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project.ext.instabug = [
version: '13.4.1'
version: '14.0.0'
]

dependencies {
Expand Down
16 changes: 16 additions & 0 deletions android/src/main/java/com/instabug/reactlibrary/ArgsRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
import com.instabug.library.sessionreplay.model.SessionMetadata;
import com.instabug.library.ui.onboarding.WelcomeMessage;

import java.util.ArrayList;
Expand Down Expand Up @@ -58,6 +59,7 @@ static Map<String, Object> getAll() {
putAll(nonFatalExceptionLevel);
putAll(locales);
putAll(placeholders);
putAll(launchType);
}};
}

Expand Down Expand Up @@ -238,4 +240,18 @@ static Map<String, Object> getAll() {
put("team", Key.CHATS_TEAM_STRING_NAME);
put("insufficientContentMessage", Key.COMMENT_FIELD_INSUFFICIENT_CONTENT);
}};

public static ArgsMap<String> launchType = new ArgsMap<String>() {{
put("cold", SessionMetadata.LaunchType.COLD);
put("warm",SessionMetadata.LaunchType.WARM );
put("unknown","unknown");
}};

// Temporary workaround to be removed in future release
// This is used for mapping native `LaunchType` values into React Native enum values.
public static HashMap<String,String> launchTypeReversed = new HashMap<String,String>() {{
put(SessionMetadata.LaunchType.COLD,"cold");
put(SessionMetadata.LaunchType.WARM,"warm" );
}};

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ final class Constants {

final static String IBG_ON_NEW_MESSAGE_HANDLER = "IBGonNewMessageHandler";
final static String IBG_ON_NEW_REPLY_RECEIVED_CALLBACK = "IBGOnNewReplyReceivedCallback";
final static String IBG_SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION = "IBGSessionReplayOnSyncCallback";

}
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
package com.instabug.reactlibrary;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.instabug.chat.Replies;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.instabug.library.OnSessionReplayLinkReady;
import com.instabug.library.SessionSyncListener;
import com.instabug.library.sessionreplay.SessionReplay;
import com.instabug.library.sessionreplay.model.SessionMetadata;
import com.instabug.reactlibrary.utils.EventEmitterModule;
import com.instabug.reactlibrary.utils.MainThreadHandler;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;

import javax.annotation.Nonnull;

public class RNInstabugSessionReplayModule extends ReactContextBaseJavaModule {
public class RNInstabugSessionReplayModule extends EventEmitterModule {

public RNInstabugSessionReplayModule(ReactApplicationContext reactApplicationContext) {
super(reactApplicationContext);
}

@ReactMethod
public void addListener(String event) {
super.addListener(event);
}

@ReactMethod
public void removeListeners(Integer count) {
super.removeListeners(count);
}

@Nonnull
@Override
public String getName() {
Expand Down Expand Up @@ -79,7 +100,7 @@ public void run() {
e.printStackTrace();
}
}
});
});
}

@ReactMethod
Expand All @@ -97,6 +118,96 @@ public void onSessionReplayLinkReady(@Nullable String link) {
}
});

}

public ReadableMap getSessionMetadataMap(SessionMetadata sessionMetadata){
WritableMap params = Arguments.createMap();
params.putString("appVersion",sessionMetadata.getAppVersion());
params.putString("OS",sessionMetadata.getOs());
params.putString("device",sessionMetadata.getDevice());
params.putDouble("sessionDurationInSeconds",(double)sessionMetadata.getSessionDurationInSeconds());
params.putBoolean("hasLinkToAppReview",sessionMetadata.getLinkedToReview());
params.putArray("networkLogs",getNetworkLogsArray(sessionMetadata.getNetworkLogs()));

String launchType = sessionMetadata.getLaunchType();
Long launchDuration = sessionMetadata.getLaunchDuration();

if (launchType != null) {
params.putString("launchType",ArgsRegistry.launchTypeReversed.get(sessionMetadata.getLaunchType()) );
} else {
params.putString("launchType",ArgsRegistry.launchType.get("unknown"));
}

if (launchDuration != null) {
params.putDouble("launchDuration", (double)launchDuration);
} else {
params.putDouble("launchDuration", 0.0);
}

return params;
}

public ReadableArray getNetworkLogsArray(List<SessionMetadata.NetworkLog> networkLogList ) {
WritableArray networkLogs = Arguments.createArray();

if (networkLogList != null) {
for (SessionMetadata.NetworkLog log : networkLogList) {
WritableMap networkLog = Arguments.createMap();
networkLog.putString("url", log.getUrl());
networkLog.putDouble("duration", log.getDuration());
networkLog.putInt("statusCode", log.getStatusCode());

networkLogs.pushMap(networkLog);
}
}

return networkLogs;
}

private boolean shouldSync = true;
private CountDownLatch latch;
@ReactMethod
public void setSyncCallback() {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
public void run() {
try {
SessionReplay.setSyncCallback(new SessionSyncListener() {
@Override
public boolean onSessionReadyToSync(@NonNull SessionMetadata sessionMetadata) {

sendEvent(Constants.IBG_SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION,getSessionMetadataMap(sessionMetadata));

latch = new CountDownLatch(1);

try {
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
return true;
}

return shouldSync;
}
});
}
catch(Exception e){
e.printStackTrace();
}

}
});
}

@ReactMethod
public void evaluateSync(boolean result) {
shouldSync = result;

if (latch != null) {
latch.countDown();
}
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;

Expand All @@ -16,7 +17,7 @@ public EventEmitterModule(ReactApplicationContext context) {
}

@VisibleForTesting
public void sendEvent(String event, @Nullable WritableMap params) {
public void sendEvent(String event, @Nullable ReadableMap params) {
if (listenerCount > 0) {
getReactApplicationContext()
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
Expand Down
Loading

0 comments on commit 6692f7b

Please sign in to comment.