fix: mobile unawaited_futures lint (#21661)

* chore: add unawaited_futures lint as warning

# Conflicts:
#	mobile/analysis_options.yaml

* remove unused dcm lints

They will be added back later on a case by case basis

* fix warning

# Conflicts:
#	mobile/lib/presentation/pages/drift_remote_album.page.dart

* auto gen file

* review changes

* conflict resolution

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-10-27 20:02:52 +05:30 committed by GitHub
parent 664a8fa499
commit ac0d646401
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 491 additions and 538 deletions

View file

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@ -12,7 +14,7 @@ class AppNavigationObserver extends AutoRouterObserver {
@override
Future<void> didChangeTabRoute(TabPageRoute route, TabPageRoute previousRoute) async {
Future(() => ref.read(inLockedViewProvider.notifier).state = false);
unawaited(Future(() => ref.read(inLockedViewProvider.notifier).state = false));
}
@override

View file

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:auto_route/auto_route.dart';
@ -26,18 +27,18 @@ class AuthGuard extends AutoRouteGuard {
if (res == null || res.authStatus != true) {
// If the access token is invalid, take user back to login
_log.fine('User token is invalid. Redirecting to login');
router.replaceAll([const LoginRoute()]);
unawaited(router.replaceAll([const LoginRoute()]));
}
} on StoreKeyNotFoundException catch (_) {
// If there is no access token, take us to the login page
_log.warning('No access token in the store.');
router.replaceAll([const LoginRoute()]);
unawaited(router.replaceAll([const LoginRoute()]));
return;
} on ApiException catch (e) {
// On an unauthorized request, take us to the login page
if (e.code == HttpStatus.unauthorized) {
_log.warning("Unauthorized access token.");
router.replaceAll([const LoginRoute()]);
unawaited(router.replaceAll([const LoginRoute()]));
return;
}
} catch (e) {

View file

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:auto_route/auto_route.dart';
import 'package:immich_mobile/providers/gallery_permission.provider.dart';
import 'package:immich_mobile/routing/router.dart';
@ -13,7 +15,7 @@ class BackupPermissionGuard extends AutoRouteGuard {
if (p) {
resolver.next(true);
} else {
router.push(const PermissionOnboardingRoute());
unawaited(router.push(const PermissionOnboardingRoute()));
}
}
}

View file

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:auto_route/auto_route.dart';
import 'package:immich_mobile/routing/router.dart';
@ -13,12 +15,14 @@ class GalleryGuard extends AutoRouteGuard {
// Replace instead of pushing duplicate
final args = resolver.route.args as GalleryViewerRouteArgs;
router.replace(
GalleryViewerRoute(
renderList: args.renderList,
initialIndex: args.initialIndex,
heroOffset: args.heroOffset,
showStack: args.showStack,
unawaited(
router.replace(
GalleryViewerRoute(
renderList: args.renderList,
initialIndex: args.initialIndex,
heroOffset: args.heroOffset,
showStack: args.showStack,
),
),
);
// Prevent further navigation since we replaced the route

View file

@ -1,8 +1,9 @@
import 'dart:async';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/services.dart';
import 'package:immich_mobile/constants/constants.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/services/api.service.dart';
import 'package:immich_mobile/services/local_auth.service.dart';
import 'package:immich_mobile/services/secure_storage.service.dart';
@ -30,7 +31,7 @@ class LockedGuard extends AutoRouteGuard {
/// Check if a pincode has been created but this user. Show the form to create if not exist
if (!authStatus.pinCode) {
router.push(PinAuthRoute(createPinCode: true));
unawaited(router.push(PinAuthRoute(createPinCode: true)));
}
if (authStatus.isElevated) {
@ -42,7 +43,7 @@ class LockedGuard extends AutoRouteGuard {
/// the user has enabled the biometric authentication
final securePinCode = await _secureStorageService.read(kSecuredPinCode);
if (securePinCode == null) {
router.push(PinAuthRoute());
unawaited(router.push(PinAuthRoute()));
return;
}
@ -74,7 +75,7 @@ class LockedGuard extends AutoRouteGuard {
} on ApiException {
// PIN code has changed, need to re-enter to access
await _secureStorageService.delete(kSecuredPinCode);
router.push(PinAuthRoute());
unawaited(router.push(PinAuthRoute()));
} catch (error) {
_log.severe("Failed to access locked page", error);
resolver.next(false);