multiple_dialogs

This commit is contained in:
shevelev 2021-02-14 07:43:03 +03:00
parent 3480f19272
commit 2e8e1d8c40
2 changed files with 20 additions and 2 deletions

View file

@ -55,6 +55,7 @@ public class Browser {
private static CustomTabsServiceConnection customTabsServiceConnection;
private static String customTabsPackageToBind;
private static WeakReference<Activity> currentCustomTabsActivity;
private static Boolean isDisplayedProgressDialog = false;
private static CustomTabsSession getCurrentSession() {
return customTabsCurrentSession == null ? null : customTabsCurrentSession.get();
@ -194,6 +195,7 @@ public class Browser {
final int reqId = ConnectionsManager.getInstance(UserConfig.selectedAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
try {
progressDialog[0].dismiss();
isDisplayedProgressDialog = false;
} catch (Throwable ignore) {
}
@ -212,12 +214,16 @@ public class Browser {
}
}));
AndroidUtilities.runOnUIThread(() -> {
if (progressDialog[0] == null) {
if (progressDialog[0] == null || isDisplayedProgressDialog) {
return;
}
try {
progressDialog[0].setOnCancelListener(dialog -> ConnectionsManager.getInstance(UserConfig.selectedAccount).cancelRequest(reqId, true));
progressDialog[0].setOnCancelListener(dialog -> {
ConnectionsManager.getInstance(UserConfig.selectedAccount).cancelRequest(reqId, true);
isDisplayedProgressDialog = false;
});
progressDialog[0].show();
isDisplayedProgressDialog = true;
} catch (Exception ignore) {
}

12
readme bugs.txt Normal file
View file

@ -0,0 +1,12 @@
========== commit: multiple_dialogs ============
precondition
- The user has lost Internet access or is turned off
- The app is open
test case
- Open the "burger" menu
- Repeatedly click on the item Telegram FAQ
actual res.
- Opens multiple AlertDialog with type 3
- And each of the open dialogs needs to be removed in turn
expected res.
- When executing a request, a single ProgressDialog opens