mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-13 01:18:56 +08:00
Prevent dialog from invoking callback twice
This commit is contained in:
@@ -26,8 +26,15 @@ public class CodePushDialog extends ReactContextBaseJavaModule{
|
||||
builder.setCancelable(false);
|
||||
|
||||
DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
|
||||
private boolean callbackConsumed = false;
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
public synchronized void onClick(DialogInterface dialog, int which) {
|
||||
if (callbackConsumed) {
|
||||
return;
|
||||
}
|
||||
|
||||
callbackConsumed = true;
|
||||
dialog.cancel();
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
|
||||
Reference in New Issue
Block a user