mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-08 21:58:24 +02:00
feat(extensions): manual verification help when browser launch fails
Expose a root navigator for global dialogs, show a fallback help sheet with copy and reopen actions when verification URLs cannot launch, and schedule the same prompt after a timeout during pending grants.
This commit is contained in:
@@ -2096,14 +2096,31 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
),
|
||||
);
|
||||
|
||||
final opened = await openPendingExtensionVerification(
|
||||
normalizedExtensionId,
|
||||
browserMode: ref.read(settingsProvider).extensionVerificationBrowserMode,
|
||||
);
|
||||
if (!opened) return false;
|
||||
final browserMode = ref
|
||||
.read(settingsProvider)
|
||||
.extensionVerificationBrowserMode;
|
||||
Uri? authUri;
|
||||
Timer? helpDialogTimer;
|
||||
|
||||
final event = await grantEventFuture;
|
||||
return event.success;
|
||||
try {
|
||||
final opened = await openPendingExtensionVerification(
|
||||
normalizedExtensionId,
|
||||
browserMode: browserMode,
|
||||
onAuthUri: (uri) => authUri = uri,
|
||||
);
|
||||
if (!opened) return false;
|
||||
|
||||
helpDialogTimer = scheduleExtensionVerificationHelpDialog(
|
||||
normalizedExtensionId,
|
||||
authUri,
|
||||
browserMode: browserMode,
|
||||
);
|
||||
|
||||
final event = await grantEventFuture;
|
||||
return event.success;
|
||||
} finally {
|
||||
helpDialogTimer?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _handleVerificationRequiredDownload(
|
||||
|
||||
@@ -683,15 +683,26 @@ class TrackNotifier extends Notifier<TrackState> {
|
||||
}
|
||||
});
|
||||
|
||||
final browserMode = ref
|
||||
.read(settingsProvider)
|
||||
.extensionVerificationBrowserMode;
|
||||
Uri? authUri;
|
||||
Timer? helpDialogTimer;
|
||||
|
||||
try {
|
||||
final opened = await openPendingExtensionVerification(
|
||||
normalizedExtensionId,
|
||||
browserMode: ref
|
||||
.read(settingsProvider)
|
||||
.extensionVerificationBrowserMode,
|
||||
browserMode: browserMode,
|
||||
onAuthUri: (uri) => authUri = uri,
|
||||
);
|
||||
if (!opened) return false;
|
||||
|
||||
helpDialogTimer = scheduleExtensionVerificationHelpDialog(
|
||||
normalizedExtensionId,
|
||||
authUri,
|
||||
browserMode: browserMode,
|
||||
);
|
||||
|
||||
final event = await grantCompleter.future.timeout(
|
||||
const Duration(minutes: 5),
|
||||
);
|
||||
@@ -702,6 +713,7 @@ class TrackNotifier extends Notifier<TrackState> {
|
||||
);
|
||||
return false;
|
||||
} finally {
|
||||
helpDialogTimer?.cancel();
|
||||
await grantSub.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user