chore: Follow up loading dialog
This commit is contained in:
parent
3faf6df558
commit
31907f74de
4 changed files with 15 additions and 9 deletions
|
|
@ -371,6 +371,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||
if (consent != OkCancelResult.ok) return;
|
||||
final req = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
delay: false,
|
||||
future: () async {
|
||||
await widget.client.updateUserDeviceKeys();
|
||||
return widget.client
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
delay: false,
|
||||
future: () => matrix.client.uiaRequestBackground(
|
||||
(auth) => matrix.client.deleteDevices(
|
||||
deviceIds,
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class Settings3PidController extends State<Settings3Pid> {
|
|||
if (ok != OkCancelResult.ok) return;
|
||||
final success = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
delay: false,
|
||||
future: () => Matrix.of(context).client.uiaRequestBackground(
|
||||
(auth) => Matrix.of(context).client.add3PID(
|
||||
clientSecret,
|
||||
|
|
|
|||
|
|
@ -19,20 +19,23 @@ Future<Result<T>> showFutureLoadingDialog<T>({
|
|||
String? backLabel,
|
||||
String Function(dynamic exception)? onError,
|
||||
bool barrierDismissible = false,
|
||||
bool delay = true,
|
||||
}) async {
|
||||
final futureExec = future();
|
||||
final resultFuture = ResultFuture(futureExec);
|
||||
|
||||
var i = 3;
|
||||
do {
|
||||
final result = resultFuture.result;
|
||||
if (result != null) {
|
||||
if (result.isError) break;
|
||||
return result;
|
||||
if (delay) {
|
||||
var i = 3;
|
||||
while (i > 0) {
|
||||
final result = resultFuture.result;
|
||||
if (result != null) {
|
||||
if (result.isError) break;
|
||||
return result;
|
||||
}
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
i--;
|
||||
}
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
i--;
|
||||
} while (i > 0);
|
||||
}
|
||||
|
||||
final result = await showAdaptiveDialog<Result<T>>(
|
||||
context: context,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue