Skip to content

snapshot dream 11 #1066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
498bfe6
feat(example): add user steps demos (#1047)
a7medev Dec 13, 2023
8675d6f
docs: update changelog headers for date and compare link fixes (#1063)
abdelhamid-f-nasser Jan 7, 2024
4c7ce2d
chore: fix react native boost install via patch (#1087)
abdelhamid-f-nasser Jan 8, 2024
e545cf1
fix(android): resolve `JsonException` handling error (#1089)
abdelhamid-f-nasser Jan 8, 2024
524e807
chore(ios): bump sdk to v12.5.0 (#1085)
abdelhamid-f-nasser Jan 8, 2024
7d3c28b
chore(android): bump sdk to v12.5.1 (#1088)
abdelhamid-f-nasser Jan 8, 2024
547fa36
fix(android): remove current view update delay (#1080)
abdelhamid-f-nasser Jan 9, 2024
7d0e4c0
chore(android): integrate packages conflict snapshot
abdelhamid-f-nasser Nov 3, 2023
ba6e86c
chore(android): integrate early crashes snapshot
abdelhamid-f-nasser Nov 14, 2023
52ccf51
fix: disable namespace support for AGP 7.3.0
abdelhamid-f-nasser Nov 3, 2023
5ea430b
chore(ios): integrate crashes attachment snapshot
abdelhamid-f-nasser Nov 17, 2023
b1cdf9e
chore(android): integrate crashes attachment logs snapshot
abdelhamid-f-nasser Nov 17, 2023
d2825af
chore(android): integrate crash linking to V3 fix snapshot
abdelhamid-f-nasser Nov 27, 2023
78237d3
chore(android): Integrate ANR_CP_reportScreenChange snapshot
abdelhamid-f-nasser Nov 30, 2023
03d3a5e
chore(android): integrate revert ANR in report screen change snapshot
a7medev Dec 3, 2023
a4da3b6
chore(android): integrate ANR snapshot
abdelhamid-f-nasser Dec 7, 2023
90af8a1
chore: update Podfile.lock
abdelhamid-f-nasser Dec 7, 2023
0241ed5
chore(ios): integrate code push snapshot
abdelhamid-f-nasser Dec 11, 2023
f451550
chore(android): integrate code push snapshot
abdelhamid-f-nasser Dec 11, 2023
9ae9276
feat(android): support code push
abdelhamid-f-nasser Dec 11, 2023
1fe20cc
feat(ios): support code push
abdelhamid-f-nasser Dec 11, 2023
067554d
feat: support code push
abdelhamid-f-nasser Dec 11, 2023
d87f14a
chore(android): integrate current view discrepancy fix snapshot
a7medev Dec 11, 2023
aa988eb
Revert "chore(android): integrate current view discrepancy fix snapshot"
a7medev Dec 12, 2023
0b4bfc6
chore(ios): integrate crash fix snapshot
a7medev Dec 12, 2023
4698a3a
chore(ios): update podfile lock
a7medev Dec 12, 2023
44138e0
chore(android): integrate `reportCurrentViewChange` API snapshot
abdelhamid-f-nasser Dec 13, 2023
2c4eca6
refactor(ios): remove re-initialization guard
abdelhamid-f-nasser Dec 15, 2023
2a408ed
chore(ios): integrate code push fix
abdelhamid-f-nasser Dec 16, 2023
208e3e7
chore(ios): add logs for CodePush
abdelhamid-f-nasser Dec 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ workflows:
- e2e_android
- hold_generate_snapshot:
type: approval
requires: *release_dependencies
- generate_snapshot:
requires:
- hold_generate_snapshot
Expand Down
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Changelog

## [12.4.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.2.0...v12.4.0) (December 6, 2023)
## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v12.4.0...dev)

### Changed

- Bump Instabug iOS SDK to v12.5.0 ([#1085](https://github.com/Instabug/Instabug-React-Native/pull/1085)). [See release notes](https://github.com/instabug/instabug-ios/releases/tag/12.5.0).
- Bump Instabug Android SDK to v12.5.1 ([#1088](https://github.com/Instabug/Instabug-React-Native/pull/1085)). See release notes for [v12.5.0](https://github.com/Instabug/android/releases/tag/v12.5.0) and [v12.5.1](https://github.com/Instabug/android/releases/tag/v12.5.1).

### Fixed

- Fix a delay issue in reporting the 'Current View' that resulted in displaying outdated values ([#1080](https://github.com/Instabug/Instabug-React-Native/pull/1080)).

## [12.4.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.2.0...v12.4.0) (December 7, 2023)

### Changed

Expand All @@ -12,7 +23,7 @@
- Fix an issue with `Instabug.init` on Android causing the app to crash while trying to get the current `Application` instance through the current activity which can be `null` in some cases by utilizing the React context instead ([#1069](https://github.com/Instabug/Instabug-React-Native/pull/1069)).
- Fix an issue with unhandled JavaScript crashes not getting linked with the current session causing inaccurate session metrics ([#1071](https://github.com/Instabug/Instabug-React-Native/pull/1071)).

## [12.2.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.2.0...v12.1.0)
## [12.2.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.1.0...v12.2.0) (November 14, 2023)

### Added

Expand All @@ -29,7 +40,7 @@
- Fix an issue with unhandled JavaScript crashes being reported as native iOS crashes ([#1054](https://github.com/Instabug/Instabug-React-Native/pull/1054))
- Re-enable screenshot capturing for Crash Reporting and Session Replay by removing redundant mapping ([#1055](https://github.com/Instabug/Instabug-React-Native/pull/1055)).

## [12.1.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.1.0...v11.14.0)
## [12.1.0](https://github.com/Instabug/Instabug-React-Native/compare/v11.14.0...v12.1.0) (October 3, 2023)

### Added

Expand Down
2 changes: 1 addition & 1 deletion RNInstabug.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm}"

s.dependency 'React-Core'
use_instabug!(s)
s.dependency 'Instabug'
end
21 changes: 16 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ apply from: './jacoco.gradle'
apply from: './native.gradle'
apply from: './sourcemaps.gradle'


rootProject.allprojects {
repositories {
google()
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
}

String getExtOrDefault(String name) {
def defaultPropertyKey = 'InstabugReactNative_' + name
if (rootProject.ext.has(name)) {
Expand All @@ -13,12 +24,12 @@ String getExtOrDefault(String name) {
}

static boolean supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()
// def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
// def major = parsed[0].toInteger()
// def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
return (major == 7 && minor >= 3) || major >= 8
// Namespace support was added in 7.3.0 (disabled for now)
return false
}

void updateManifestPackage() {
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: '12.4.1'
version: '12.4.0.5503778-SNAPSHOT'
]

dependencies {
Expand Down
115 changes: 114 additions & 1 deletion android/src/main/java/com/instabug/reactlibrary/RNInstabug.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class RNInstabug {

private static RNInstabug instance;

private RNInstabug() {}


Expand Down Expand Up @@ -133,4 +133,117 @@ public void setBaseUrlForDeprecationLogs() {
e.printStackTrace();
}
}

public static class Builder {

/**
* Application instance to initialize Instabug.
*/
private Application application;

/**
* The application token obtained from the Instabug dashboard.
*/
private String applicationToken;

/**
* The level of detail in logs that you want to print.
*/
private int logLevel = LogLevel.ERROR;

/**
* The Code Push version to be used for all reports.
*/
private String codePushVersion;

/**
* The events that trigger the SDK's user interface.
*/
private InstabugInvocationEvent[] invocationEvents;


/**
* Initialize Instabug SDK with application token
*
* @param application Application object for initialization of library
* @param applicationToken The app's identifying token, available on your dashboard.
*/
public Builder(Application application, String applicationToken) {
this.application = application;
this.applicationToken = applicationToken;
}

/**
* Initialize Instabug SDK with application token and invocation trigger events
*
* @param application Application object for initialization of library
* @param applicationToken The app's identifying token, available on your dashboard.
* @param invocationEvents The events that trigger the SDK's user interface.
* <p>Choose from the available events listed in {@link InstabugInvocationEvent}.</p>
*/
public Builder(Application application, String applicationToken, InstabugInvocationEvent... invocationEvents) {
this.application = application;
this.applicationToken = applicationToken;
this.invocationEvents = invocationEvents;
}

/**
* Sets the filtering level for printed SDK logs.
*
* @param logLevel The log filtering level to be set.
* Choose from {@link LogLevel} constants:
* {@link LogLevel#NONE}, {@link LogLevel#ERROR}, {@link LogLevel#DEBUG}, or {@link LogLevel#VERBOSE}.
* <p>Default level is {@link LogLevel#ERROR}.</p>
*/
public Builder setLogLevel(int logLevel) {
this.logLevel = logLevel;
return this;
}

/**
* Sets Code Push version to be used for all reports.
*
* @param codePushVersion the Code Push version to work with.
*/
public Builder setCodePushVersion(String codePushVersion) {
this.codePushVersion = codePushVersion;
return this;
}

/**
* Sets the invocation triggering events for the SDK's user interface
*
* @param invocationEvents The events that trigger the SDK's user interface.
* Choose from the available events listed in {@link InstabugInvocationEvent}.
*/
public Builder setInvocationEvents(InstabugInvocationEvent... invocationEvents) {
this.invocationEvents = invocationEvents;
return this;
}

/**
* Builds the Instabug instance with the provided configurations.
*/
public void build() {
try {
RNInstabug.getInstance().setBaseUrlForDeprecationLogs();
RNInstabug.getInstance().setCurrentPlatform();

Instabug.Builder instabugBuilder = new Instabug.Builder(application, applicationToken)
.setInvocationEvents(invocationEvents)
.setSdkDebugLogsLevel(logLevel);

if (codePushVersion != null) {
instabugBuilder.setCodePushVersion(codePushVersion);
}

instabugBuilder.build();

// Temporarily disabling APM hot launches
APM.setHotAppLaunchEnabled(false);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
import java.util.Locale;
import java.util.Map;

import javax.annotation.Nullable;


/**
* The type Rn instabug reactnative module.
Expand Down Expand Up @@ -117,9 +119,16 @@ public void run() {
* Initializes the SDK.
* @param token The token that identifies the app. You can find it on your dashboard.
* @param invocationEventValues The events that invoke the SDK's UI.
* @param logLevel The level of detail in logs that you want to print.
* @param codePushVersion The Code Push version to be used for all reports.
*/
@ReactMethod
public void init(final String token, final ReadableArray invocationEventValues, final String logLevel) {
public void init(
final String token,
final ReadableArray invocationEventValues,
final String logLevel,
@Nullable final String codePushVersion
) {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
public void run() {
Expand All @@ -130,7 +139,14 @@ public void run() {

final Application application = (Application) reactContext.getApplicationContext();

RNInstabug.getInstance().init(application, token, parsedLogLevel, invocationEvents);
RNInstabug.Builder builder = new RNInstabug.Builder(application, token)
.setInvocationEvents(invocationEvents)
.setLogLevel(parsedLogLevel);

if(codePushVersion != null) {
builder.setCodePushVersion(codePushVersion);
}
builder.build();
}
});
}
Expand Down Expand Up @@ -916,6 +932,29 @@ public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
});
}

/**
* Reports that the screen name been changed (Current View).
*
* @param screenName string containing the screen name
*
*/
@ReactMethod
public void reportCurrentViewChange(final String screenName) {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
public void run() {
try {
Method method = getMethod(Class.forName("com.instabug.library.Instabug"), "reportCurrentViewChange", String.class);
if (method != null) {
method.invoke(null, screenName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Reports that the screen has been changed (Repro Steps) the screen sent to this method will be the 'current view' on the dashboard
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static WritableArray parseConsoleLogs(ArrayList<a> consoleLogs) {
for(int i = 0; i < consoleLogs.size(); i++) {
try {
writableArray.pushString(consoleLogs.get(i).toJson());
} catch (JSONException e) {
} catch (Exception e) {
e.printStackTrace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,18 @@ public void tearDown() {
}
}

@Test
public void givenString$reportCurrentViewChange_whenQuery_thenShouldCallNativeApiWithString() throws Exception {
// when
rnModule.reportCurrentViewChange("screen");
Method privateStringMethod = getMethod(Class.forName("com.instabug.library.Instabug"), "reportCurrentViewChange", String.class);
privateStringMethod.setAccessible(true);

// then
verify(Instabug.class, VerificationModeFactory.times(1));
privateStringMethod.invoke("reportCurrentViewChange","screen");
}

@Test
public void givenString$reportScreenChange_whenQuery_thenShouldCallNativeApiWithString() throws Exception {
// when
Expand Down
Loading