fix: retry verification browser launch and failed searches

This commit is contained in:
zarzet committed 2026-09-23 17:26:40 +07:00
1 parent ba44bafa92
commit 39273edd85
4 files changed
+204 -4

No files matched your search

+4
View File
@@ -372,6 +372,10 @@ class _HomeTabState extends ConsumerState<HomeTab>
}
void _onTrackStateChanged(TrackState? previous, TrackState next) {
if (next.error != null) {
// Failed requests must remain retryable without changing the search text.
_lastSearchQuery = null;
}
if (!identical(previous?.tracks, next.tracks)) {
// Home stays alive across tabs. Empty/loading/error branches can skip
// result building, so release the previous search's derived lists here.
+11 -4
View File
@@ -480,9 +480,16 @@ Future<bool> _launchVerificationUrl(Uri uri, String browserMode) async {
? LaunchMode.externalApplication
: LaunchMode.inAppBrowserView;
var launched = await launchUrl(uri, mode: firstMode);
if (!launched) {
launched = await launchUrl(uri, mode: fallbackMode);
for (final mode in [firstMode, fallbackMode]) {
try {
if (await launchUrl(uri, mode: mode)) return true;
} on PlatformException catch (error) {
// Android reports some launch failures as exceptions rather than false.
// Keep the other mode and manual verification help available in both cases.
_log.w(
'Verification browser launch failed (${mode.name}): ${error.code}',
);
}
}
return launched;
return false;
}