mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
CB-7261 Fix setNativeToJsBridgeMode sometimes crashing when switching to ONLINE_EVENT
This commit is contained in:
parent
73219bf2d2
commit
41125ea1e2
@ -321,11 +321,16 @@ public class NativeToJsMessageQueue {
|
||||
}
|
||||
}
|
||||
};
|
||||
final Runnable resetNetworkRunnable = new Runnable() {
|
||||
public void run() {
|
||||
online = false;
|
||||
// If the following call triggers a notifyOfFlush, then ignore it.
|
||||
ignoreNextFlush = true;
|
||||
webView.setNetworkAvailable(true);
|
||||
}
|
||||
};
|
||||
@Override void reset() {
|
||||
online = false;
|
||||
// If the following call triggers a notifyOfFlush, then ignore it.
|
||||
ignoreNextFlush = true;
|
||||
webView.setNetworkAvailable(true);
|
||||
cordova.getActivity().runOnUiThread(resetNetworkRunnable);
|
||||
}
|
||||
@Override void onNativeToJsMessageAvailable() {
|
||||
cordova.getActivity().runOnUiThread(toggleNetworkRunnable);
|
||||
|
Loading…
Reference in New Issue
Block a user