Skip to content

Commit 36e0945

Browse files
Merge branch 'dev' into feat/support-app-flows
2 parents 3a1880b + 683747d commit 36e0945

Some content is hidden

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

54 files changed

+1100
-36
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@
66

77
- Adds symbol files upload script ([#1137](https://github.com/Instabug/Instabug-React-Native/pull/1137))
88
- Support enabling NDK crash capturing on Android ([#1132](https://github.com/Instabug/Instabug-React-Native/pull/1132)).
9+
- Add `SessionReplay.getSessionReplayLink` API which retrieves the current session's replay link ([#1142](https://github.com/Instabug/Instabug-React-Native/pull/1142)).
10+
- Support setting the Code Push version after SDK initialization ([#1143](https://github.com/Instabug/Instabug-React-Native/pull/1143)).
911
- Add support for App Flows APIs `APM.startFlow`, `APM.setFlowAttribute` and `APM.endFlow` ([#1138](https://github.com/Instabug/Instabug-React-Native/pull/1138)).
1012

1113
### Deprecated
1214

1315
- Deprecate Execution Traces APIs `APM.startExecutionTrace`, `Trace.end` and `Trace.setAttribute` in favor of the new App Flows APIs ([#1138](https://github.com/Instabug/Instabug-React-Native/pull/1138)).
1416

17+
## [12.8.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.7.1...v12.8.0) (February 25, 2024)
18+
19+
### Added
20+
21+
- Add `SessionReplay.getSessionReplayLink` API which retrieves the current session's replay link ([#1142](https://github.com/Instabug/Instabug-React-Native/pull/1142)).
22+
- Support setting the Code Push version after SDK initialization ([#1143](https://github.com/Instabug/Instabug-React-Native/pull/1143)).
23+
24+
### Changed
25+
26+
- Bump Instabug Android SDK to v12.8.0 ([#1149](https://github.com/Instabug/Instabug-React-Native/pull/1149)). [See release notes](https://github.com/Instabug/android/releases/tag/v12.8.0).
27+
1528
## [12.7.1](https://github.com/Instabug/Instabug-React-Native/compare/v12.7.0...v12.7.1) (February 15, 2024)
1629

1730
### Changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ android {
5757
minSdkVersion getExtOrDefault('minSdkVersion').toInteger()
5858
targetSdkVersion getExtOrDefault('targetSdkVersion').toInteger()
5959
versionCode 1
60-
versionName "12.7.1"
60+
versionName "12.8.0"
6161
multiDexEnabled true
6262
ndk {
6363
abiFilters "armeabi-v7a", "x86"

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: '12.7.1'
2+
version: '12.8.0'
33
]
44

55
dependencies {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,20 @@ public void run() {
160160
});
161161
}
162162

163+
@ReactMethod
164+
public void setCodePushVersion(@Nullable String version) {
165+
MainThreadHandler.runOnMainThread(new Runnable() {
166+
@Override
167+
public void run() {
168+
try {
169+
Instabug.setCodePushVersion(version);
170+
} catch (Exception e) {
171+
e.printStackTrace();
172+
}
173+
}
174+
});
175+
}
176+
163177

164178
/**
165179
* Adds tag(s) to issues before sending them

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package com.instabug.reactlibrary;
22

3+
import androidx.annotation.Nullable;
4+
5+
import com.facebook.react.bridge.Promise;
36
import com.facebook.react.bridge.ReactApplicationContext;
47
import com.facebook.react.bridge.ReactContextBaseJavaModule;
58
import com.facebook.react.bridge.ReactMethod;
9+
import com.instabug.chat.Replies;
10+
import com.instabug.library.OnSessionReplayLinkReady;
611
import com.instabug.library.sessionreplay.SessionReplay;
712
import com.instabug.reactlibrary.utils.MainThreadHandler;
813

@@ -76,4 +81,22 @@ public void run() {
7681
}
7782
});
7883
}
84+
85+
@ReactMethod
86+
public void getSessionReplayLink(Promise promise) {
87+
MainThreadHandler.runOnMainThread(new Runnable() {
88+
@Override
89+
public void run() {
90+
SessionReplay.getSessionReplayLink(new OnSessionReplayLinkReady() {
91+
@Override
92+
public void onSessionReplayLinkReady(@Nullable String link) {
93+
94+
promise.resolve(link);
95+
}
96+
});
97+
}
98+
});
99+
100+
101+
}
79102
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ public void tearDown() {
199199
Instabug.setPrimaryColor(color);
200200
}
201201

202+
@Test
203+
public void testSetCodePushVersion() {
204+
String codePushVersion = "123";
205+
206+
rnModule.setCodePushVersion(codePushVersion);
207+
208+
mockInstabug.verify(() -> Instabug.setCodePushVersion(codePushVersion));
209+
}
210+
202211
@Test
203212
public void testIdentifyUserWithNoId() {
204213
// given

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
package com.instabug.reactlibrary;
22

33
import static org.mockito.Matchers.any;
4+
import static org.mockito.Mockito.doAnswer;
5+
import static org.mockito.Mockito.mock;
46
import static org.mockito.Mockito.mockStatic;
7+
import static org.mockito.Mockito.timeout;
58
import static org.mockito.Mockito.times;
69
import static org.mockito.Mockito.verify;
10+
import static org.mockito.Mockito.when;
711

12+
import android.os.Handler;
813
import android.os.Looper;
914

1015
import com.facebook.react.bridge.Arguments;
1116
import com.facebook.react.bridge.JavaOnlyArray;
17+
import com.facebook.react.bridge.Promise;
1218
import com.facebook.react.bridge.ReadableArray;
1319
import com.facebook.react.bridge.WritableArray;
20+
import com.instabug.chat.Replies;
1421
import com.instabug.featuresrequest.ActionType;
1522
import com.instabug.featuresrequest.FeatureRequests;
1623
import com.instabug.library.Feature;
24+
import com.instabug.library.OnSessionReplayLinkReady;
1725
import com.instabug.library.sessionreplay.SessionReplay;
1826
import com.instabug.reactlibrary.utils.MainThreadHandler;
1927

@@ -96,6 +104,29 @@ public void testSetInstabugLogsEnabled() {
96104
mockSessionReplay.verifyNoMoreInteractions();
97105
}
98106

107+
@Test
108+
public void testGetSessionReplayLink() {
109+
Promise promise = mock(Promise.class);
110+
String link="instabug link";
111+
112+
mockSessionReplay.when(() -> SessionReplay.getSessionReplayLink(any())).thenAnswer(
113+
invocation -> {
114+
OnSessionReplayLinkReady callback = (OnSessionReplayLinkReady) invocation.getArguments()[0];
115+
callback.onSessionReplayLinkReady(link);
116+
return callback;
117+
});
118+
sessionReplayModule.getSessionReplayLink(promise);
119+
120+
121+
mockSessionReplay.verify(() -> SessionReplay.getSessionReplayLink(any()));
122+
mockSessionReplay.verifyNoMoreInteractions();
123+
124+
125+
verify(promise).resolve(link);
126+
127+
128+
}
129+
99130
@Test
100131
public void testSetUserStepsEnabled() {
101132

examples/default/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GOOGLE_MAPS_API_KEY = API_KEY

examples/default/android/app/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apply plugin: "com.android.application"
22
apply plugin: "com.facebook.react"
3+
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
34

45
import com.android.build.OutputFile
56

@@ -156,6 +157,12 @@ android {
156157

157158
}
158159
}
160+
externalNativeBuild {
161+
cmake {
162+
path file('src/main/cpp/CMakeLists.txt')
163+
version '3.22.1'
164+
}
165+
}
159166
}
160167

161168
dependencies {

examples/default/android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@
2222
<category android:name="android.intent.category.LAUNCHER" />
2323
</intent-filter>
2424
</activity>
25+
<meta-data
26+
android:name="com.google.android.geo.API_KEY"
27+
android:value="@string/GOOGLE_MAPS_API_KEY" />
2528
</application>
2629
</manifest>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
# For more information about using CMake with Android Studio, read the
3+
# documentation: https://d.android.com/studio/projects/add-native-code.html.
4+
# For more examples on how to use CMake, see https://github.com/android/ndk-samples.
5+
6+
# Sets the minimum CMake version required for this project.
7+
cmake_minimum_required(VERSION 3.22.1)
8+
9+
# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
10+
# Since this is the top level CMakeLists.txt, the project name is also accessible
11+
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
12+
# build script scope).
13+
project("native-lib")
14+
15+
# Creates and names a library, sets it as either STATIC
16+
# or SHARED, and provides the relative paths to its source code.
17+
# You can define multiple libraries, and CMake builds them for you.
18+
# Gradle automatically packages shared libraries with your APK.
19+
#
20+
# In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define
21+
# the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME}
22+
# is preferred for the same purpose.
23+
#
24+
# In order to load a library into your app from Java/Kotlin, you must call
25+
# System.loadLibrary() and pass the name of the library defined here;
26+
# for GameActivity/NativeActivity derived applications, the same library name must be
27+
# used in the AndroidManifest.xml file.
28+
add_library(${CMAKE_PROJECT_NAME} SHARED
29+
# List C/C++ source files with relative paths to this CMakeLists.txt.
30+
native-lib.cpp
31+
crasher.c
32+
crasher_2.c
33+
crasher_3.c
34+
crasher_4.cpp
35+
)
36+
find_library( # Sets the name of the path variable.
37+
log-lib
38+
39+
# Specifies the name of the NDK library that
40+
# you want CMake to locate.
41+
log)
42+
43+
44+
# Specifies libraries CMake should link to your target library. You
45+
# can link libraries from various origins, such as libraries defined in this
46+
# build script, prebuilt third-party libraries, or Android system libraries.
47+
target_link_libraries(${CMAKE_PROJECT_NAME}
48+
# List libraries link to the target library
49+
android
50+
log
51+
${log-lib}
52+
)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
#include <jni.h>
3+
#include <sys/user.h>
4+
#include <unistd.h>
5+
#include <stdlib.h>
6+
#include "crasher_2.h"
7+
8+
/************* SIGSEGV *******************************/
9+
JNIEXPORT void JNICALL
10+
Java_com_instabug_react_example_nativeLibs_CppNativeLib_causeSIGSEGVCrash(JNIEnv *env, jobject thiz) {
11+
causeSIGSEGVCrashF1();
12+
}
13+
14+
/*****************************************************/
15+
16+
/************* SIGABRT *******************************/
17+
void JNICALL
18+
Java_com_instabug_react_example_nativeLibs_CppNativeLib_causeSIGABRTCrash(JNIEnv *env, jobject thiz) {
19+
causeSIGABRTCrashF1();
20+
}
21+
/****************************************************/
22+
23+
/************* SIGFPE *******************************/
24+
void JNICALL
25+
Java_com_instabug_react_example_nativeLibs_CppNativeLib_causeSIGFPECrash(JNIEnv *env, jobject thiz) {
26+
causeSIGFPECrashF1();
27+
}
28+
/***************************************************/
29+
30+
/************* SIGILL *******************************/
31+
32+
void JNICALL
33+
Java_com_instabug_react_example_nativeLibs_CppNativeLib_causeSIGILLCrash(JNIEnv *env, jobject thiz) {
34+
causeSIGILLCrashF1();
35+
}
36+
/***************************************************/
37+
38+
/************* SIGBUS *******************************/
39+
void JNICALL
40+
Java_com_instabug_react_example_nativeLibs_CppNativeLib_causeSIGBUSCrash(JNIEnv *env, jobject thiz) {
41+
causeSIGBUSCrashF1();
42+
}
43+
/***************************************************/
44+
45+
/************* SIGTRAP *******************************/
46+
void JNICALL
47+
Java_com_instabug_react_example_nativeLibs_CppNativeLib_causeSIGTRAPCrash(JNIEnv *env, jobject thiz) {
48+
causeSIGTRAPCrashF1();
49+
}
50+
/***************************************************/
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
3+
#include <jni.h>
4+
#include <sys/user.h>
5+
#include <unistd.h>
6+
#include <stdlib.h>
7+
#include "crasher_3.h"
8+
9+
/************* SIGSEGV *******************************/
10+
void causeSIGSEGVCrashF1() {
11+
causeSIGSEGVCrashF2();
12+
}
13+
/*****************************************************/
14+
15+
/************* SIGABRT *******************************/
16+
void causeSIGABRTCrashF1() {
17+
causeSIGABRTCrashF2();
18+
}
19+
/****************************************************/
20+
21+
/************* SIGFPE *******************************/
22+
23+
24+
void causeSIGFPECrashF1() {
25+
causeSIGFPECrashF2();
26+
}
27+
/***************************************************/
28+
29+
/************* SIGILL *******************************/
30+
31+
void causeSIGILLCrashF1() {
32+
causeSIGILLCrashF2();
33+
}
34+
/***************************************************/
35+
36+
/************* SIGBUS *******************************/
37+
38+
void causeSIGBUSCrashF1() {
39+
causeSIGBUSCrashF2();
40+
}
41+
/***************************************************/
42+
43+
/************* SIGTRAP *******************************/
44+
void causeSIGTRAPCrashF1() {
45+
causeSIGTRAPCrashF2();
46+
}
47+
/***************************************************/

0 commit comments

Comments
 (0)