Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v12.2.0...dev)

### Fixed

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

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

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.instabug.reactlibrary.utils.InstabugUtil.getMethod;

import android.app.Application;
import android.graphics.Bitmap;
import android.net.Uri;
import android.view.View;
Expand Down Expand Up @@ -59,6 +60,7 @@ public class RNInstabugReactnativeModule extends EventEmitterModule {

private InstabugCustomTextPlaceHolder placeHolders;
private static Report currentReport;
private final ReactApplicationContext reactContext;

/**
* Instantiates a new Rn Instabug ReactNative module.
Expand All @@ -67,6 +69,9 @@ public class RNInstabugReactnativeModule extends EventEmitterModule {
*/
public RNInstabugReactnativeModule(ReactApplicationContext reactContext) {
super(reactContext);

this.reactContext = reactContext;

//init placeHolders
placeHolders = new InstabugCustomTextPlaceHolder();
}
Expand Down Expand Up @@ -122,7 +127,10 @@ public void run() {
final ArrayList<InstabugInvocationEvent> parsedInvocationEvents = ArgsRegistry.invocationEvents.getAll(keys);
final InstabugInvocationEvent[] invocationEvents = parsedInvocationEvents.toArray(new InstabugInvocationEvent[0]);
final int parsedLogLevel = ArgsRegistry.sdkLogLevels.getOrDefault(logLevel, LogLevel.ERROR);
RNInstabug.getInstance().init(getCurrentActivity().getApplication(), token, parsedLogLevel, invocationEvents);

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

RNInstabug.getInstance().init(application, token, parsedLogLevel, invocationEvents);
}
});
}
Expand Down