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;
|
if (consent != OkCancelResult.ok) return;
|
||||||
final req = await showFutureLoadingDialog(
|
final req = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
delay: false,
|
||||||
future: () async {
|
future: () async {
|
||||||
await widget.client.updateUserDeviceKeys();
|
await widget.client.updateUserDeviceKeys();
|
||||||
return widget.client
|
return widget.client
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
|
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
delay: false,
|
||||||
future: () => matrix.client.uiaRequestBackground(
|
future: () => matrix.client.uiaRequestBackground(
|
||||||
(auth) => matrix.client.deleteDevices(
|
(auth) => matrix.client.deleteDevices(
|
||||||
deviceIds,
|
deviceIds,
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ class Settings3PidController extends State<Settings3Pid> {
|
||||||
if (ok != OkCancelResult.ok) return;
|
if (ok != OkCancelResult.ok) return;
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
delay: false,
|
||||||
future: () => Matrix.of(context).client.uiaRequestBackground(
|
future: () => Matrix.of(context).client.uiaRequestBackground(
|
||||||
(auth) => Matrix.of(context).client.add3PID(
|
(auth) => Matrix.of(context).client.add3PID(
|
||||||
clientSecret,
|
clientSecret,
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,23 @@ Future<Result<T>> showFutureLoadingDialog<T>({
|
||||||
String? backLabel,
|
String? backLabel,
|
||||||
String Function(dynamic exception)? onError,
|
String Function(dynamic exception)? onError,
|
||||||
bool barrierDismissible = false,
|
bool barrierDismissible = false,
|
||||||
|
bool delay = true,
|
||||||
}) async {
|
}) async {
|
||||||
final futureExec = future();
|
final futureExec = future();
|
||||||
final resultFuture = ResultFuture(futureExec);
|
final resultFuture = ResultFuture(futureExec);
|
||||||
|
|
||||||
var i = 3;
|
if (delay) {
|
||||||
do {
|
var i = 3;
|
||||||
final result = resultFuture.result;
|
while (i > 0) {
|
||||||
if (result != null) {
|
final result = resultFuture.result;
|
||||||
if (result.isError) break;
|
if (result != null) {
|
||||||
return result;
|
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>>(
|
final result = await showAdaptiveDialog<Result<T>>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue