mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 08:04:23 +08:00
Fixed app crash caused by multiple callback invocation from java code. (#1289)
Added CodePushUtils.log method for logging exceptions.
This commit is contained in:
committed by
Alexander Goncharov
parent
21f8388f6a
commit
e0bc8b00d2
@@ -57,16 +57,20 @@ public class CodePushDialog extends ReactContextBaseJavaModule{
|
||||
DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
successCallback.invoke(0);
|
||||
break;
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
successCallback.invoke(1);
|
||||
break;
|
||||
default:
|
||||
throw new CodePushUnknownException("Unknown button ID pressed.");
|
||||
try {
|
||||
dialog.cancel();
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
successCallback.invoke(0);
|
||||
break;
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
successCallback.invoke(1);
|
||||
break;
|
||||
default:
|
||||
throw new CodePushUnknownException("Unknown button ID pressed.");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
CodePushUtils.log(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -203,6 +203,10 @@ public class CodePushUtils {
|
||||
Log.d(CodePushConstants.REACT_NATIVE_LOG_TAG, "[CodePush] " + message);
|
||||
}
|
||||
|
||||
public static void log(Throwable tr) {
|
||||
Log.e(CodePushConstants.REACT_NATIVE_LOG_TAG, "[CodePush] Exception", tr);
|
||||
}
|
||||
|
||||
public static void logBundleUrl(String path) {
|
||||
log("Loading JS bundle from \"" + path + "\"");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user