Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix warnings around missing awaits

vishnukvmd3b498f1be65d
diff --git a/auth/lib/core/logging/super_logging.dart b/auth/lib/core/logging/super_logging.dart
index 7b62d0a705..2d2972d64e 100644
--- a/auth/lib/core/logging/super_logging.dart
+++ b/auth/lib/core/logging/super_logging.dart
@@ -167,7 +167,7 @@ class SuperLogging {
await setupLogDir();
}
if (sentryIsEnabled) {
- setupSentry();
+ await setupSentry();
}
Logger.root.level = Level.ALL;
@@ -250,7 +250,7 @@ class SuperLogging {
// add error to sentry queue
if (sentryIsEnabled && rec.error != null) {
- _sendErrorToSentry(rec.error!, null);
+ await _sendErrorToSentry(rec.error!, null);
}
}
@@ -289,7 +289,7 @@ class SuperLogging {
SuperLogging.setUserID(await _getOrCreateAnonymousUserID());
await for (final error in sentryQueueControl.stream.asBroadcastStream()) {
try {
- Sentry.captureException(
+ await Sentry.captureException(
error,
);
} catch (e) {
diff --git a/auth/lib/main.dart b/auth/lib/main.dart
index d459dfa133..02d3e0c126 100644
--- a/auth/lib/main.dart
+++ b/auth/lib/main.dart
@@ -1,3 +1,4 @@
+import 'dart:async';
import 'dart:io';
import 'package:adaptive_theme/adaptive_theme.dart';
@@ -46,7 +47,7 @@ Future<void> _runInForeground() async {
_logger.info("Starting app in foreground");
await _init(false, via: 'mainMethod');
final Locale locale = await getLocale();
- UpdateService.instance.showUpdateNotification();
+ unawaited(UpdateService.instance.showUpdateNotification());
runApp(
AppLock(
builder: (args) => App(locale: locale),
@@ -83,7 +84,7 @@ Future _runWithLogs(Function() function, {String prefix = ""}) async {
Future<void> _init(bool bool, {String? via}) async {
// Start workers asynchronously. No need to wait for them to start
- Computer.shared().turnOn(workersCount: 4, verbose: kDebugMode);
+ Computer.shared().turnOn(workersCount: 4, verbose: kDebugMode).ignore();
CryptoUtil.init();
await PreferenceService.instance.init();
await CodeStore.instance.init();
diff --git a/auth/lib/onboarding/view/onboarding_page.dart b/auth/lib/onboarding/view/onboarding_page.dart
index 7ae5ede1c1..b97c3436a0 100644
--- a/auth/lib/onboarding/view/onboarding_page.dart
+++ b/auth/lib/onboarding/view/onboarding_page.dart
@@ -103,6 +103,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
),
onTap: () async {
final locale = await getLocale();
+ // ignore: unawaited_futures
routeToPage(
context,
LanguageSelectorPage(
@@ -228,6 +229,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
}
if (hasOptedBefore || result?.action == ButtonAction.first) {
await Configuration.instance.optForOfflineMode();
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/auth/lib/services/authenticator_service.dart b/auth/lib/services/authenticator_service.dart
index 12e8b52e0b..77d9b0437e 100644
--- a/auth/lib/services/authenticator_service.dart
+++ b/auth/lib/services/authenticator_service.dart
@@ -208,7 +208,7 @@ class AuthenticatorService {
if (deletedIDs.isNotEmpty) {
await _db.deleteByIDs(ids: deletedIDs);
}
- _prefs.setInt(_lastEntitySyncTime, maxSyncTime);
+ await _prefs.setInt(_lastEntitySyncTime, maxSyncTime);
_logger.info("Setting synctime to " + maxSyncTime.toString());
if (result.length == fetchLimit) {
_logger.info("Diff limit reached, pulling again");
diff --git a/auth/lib/services/local_authentication_service.dart b/auth/lib/services/local_authentication_service.dart
index d21d1bcb26..b7b000dd9f 100644
--- a/auth/lib/services/local_authentication_service.dart
+++ b/auth/lib/services/local_authentication_service.dart
@@ -54,6 +54,7 @@ class LocalAuthenticationService {
.setEnabled(Configuration.instance.shouldShowLockScreen());
}
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
errorDialogTitle,
diff --git a/auth/lib/services/notification_service.dart b/auth/lib/services/notification_service.dart
index 009cce846c..60d12811bd 100644
--- a/auth/lib/services/notification_service.dart
+++ b/auth/lib/services/notification_service.dart
@@ -27,6 +27,7 @@ class NotificationService {
_flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>();
if (implementation != null) {
+ // ignore: unawaited_futures
implementation.requestPermission();
}
}
diff --git a/auth/lib/services/update_service.dart b/auth/lib/services/update_service.dart
index 6e1c12bea5..09f36df834 100644
--- a/auth/lib/services/update_service.dart
+++ b/auth/lib/services/update_service.dart
@@ -1,3 +1,4 @@
+import 'dart:async';
import 'dart:io';
import 'package:ente_auth/core/constants.dart';
@@ -70,9 +71,11 @@ class UpdateService {
if (shouldUpdate &&
hasBeen3DaysSinceLastNotification &&
_latestVersion!.shouldNotify!) {
- NotificationService.instance.showNotification(
- "Update available",
- "Click to install our best version yet",
+ unawaited(
+ NotificationService.instance.showNotification(
+ "Update available",
+ "Click to install our best version yet",
+ ),
);
await _prefs.setInt(kUpdateAvailableShownTimeKey, now);
} else {
diff --git a/auth/lib/services/user_service.dart b/auth/lib/services/user_service.dart
index e4a1bae7a4..c5436b3610 100644
--- a/auth/lib/services/user_service.dart
+++ b/auth/lib/services/user_service.dart
@@ -147,18 +147,18 @@ class UserService {
final userDetails = UserDetails.fromMap(response.data);
if (shouldCache) {
if (userDetails.profileData != null) {
- _preferences.setBool(
+ await _preferences.setBool(
kIsEmailMFAEnabled,
userDetails.profileData!.isEmailMFAEnabled,
);
- _preferences.setBool(
+ await _preferences.setBool(
kCanDisableEmailMFA,
userDetails.profileData!.canDisableEmailMFA,
);
}
// handle email change from different client
if (userDetails.email != _config.getEmail()) {
- setEmail(userDetails.email);
+ await setEmail(userDetails.email);
}
}
return userDetails;
@@ -282,6 +282,7 @@ class UserService {
throw Exception("unexpected response during passkey verification");
}
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -331,6 +332,7 @@ class UserService {
);
}
}
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -354,6 +356,7 @@ class UserService {
);
Navigator.of(context).pop();
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.incorrectCode,
@@ -363,6 +366,7 @@ class UserService {
} catch (e) {
await dialog.hide();
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -399,6 +403,7 @@ class UserService {
Bus.instance.fire(UserDetailsChangedEvent());
return;
}
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -407,12 +412,14 @@ class UserService {
} on DioError catch (e) {
await dialog.hide();
if (e.response != null && e.response!.statusCode == 403) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
context.l10n.thisEmailIsAlreadyInUse,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.incorrectCode,
@@ -422,6 +429,7 @@ class UserService {
} catch (e) {
await dialog.hide();
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -632,6 +640,7 @@ class UserService {
}
}
await dialog.hide();
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -709,6 +718,7 @@ class UserService {
if (response.statusCode == 200) {
showShortToast(context, context.l10n.authenticationSuccessful);
await _saveConfiguration(response);
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -723,6 +733,7 @@ class UserService {
_logger.severe(e);
if (e.response != null && e.response!.statusCode == 404) {
showToast(context, "Session expired");
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -732,6 +743,7 @@ class UserService {
(route) => route.isFirst,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.incorrectCode,
@@ -741,6 +753,7 @@ class UserService {
} catch (e) {
await dialog.hide();
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -760,6 +773,7 @@ class UserService {
},
);
if (response.statusCode == 200) {
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -777,6 +791,7 @@ class UserService {
_logger.severe(e);
if (e.response != null && e.response!.statusCode == 404) {
showToast(context, context.l10n.sessionExpired);
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -786,6 +801,7 @@ class UserService {
(route) => route.isFirst,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -794,6 +810,7 @@ class UserService {
}
} catch (e) {
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -853,6 +870,7 @@ class UserService {
context.l10n.twofactorAuthenticationSuccessfullyReset,
);
await _saveConfiguration(response);
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -866,6 +884,7 @@ class UserService {
_logger.severe(e);
if (e.response != null && e.response!.statusCode == 404) {
showToast(context, "Session expired");
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -875,6 +894,7 @@ class UserService {
(route) => route.isFirst,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -883,6 +903,7 @@ class UserService {
}
} catch (e) {
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -925,7 +946,7 @@ class UserService {
"isEnabled": isEnabled,
},
);
- _preferences.setBool(kIsEmailMFAEnabled, isEnabled);
+ await _preferences.setBool(kIsEmailMFAEnabled, isEnabled);
} catch (e) {
_logger.severe("Failed to update email mfa", e);
rethrow;
diff --git a/auth/lib/ui/account/delete_account_page.dart b/auth/lib/ui/account/delete_account_page.dart
index e4376c982d..0567449749 100644
--- a/auth/lib/ui/account/delete_account_page.dart
+++ b/auth/lib/ui/account/delete_account_page.dart
@@ -236,7 +236,7 @@ class DeleteAccountPage extends StatelessWidget {
),
],
);
-
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
diff --git a/auth/lib/ui/account/login_page.dart b/auth/lib/ui/account/login_page.dart
index bfa50b8c2a..df28f98a1d 100644
--- a/auth/lib/ui/account/login_page.dart
+++ b/auth/lib/ui/account/login_page.dart
@@ -61,7 +61,7 @@ class _LoginPageState extends State<LoginPage> {
isFormValid: _emailIsValid,
buttonText: context.l10n.logInLabel,
onPressedFunction: () async {
- UserService.instance.setEmail(_email!);
+ await UserService.instance.setEmail(_email!);
Configuration.instance.resetVolatilePassword();
SrpAttributes? attr;
bool isEmailVerificationEnabled = true;
@@ -74,6 +74,7 @@ class _LoginPageState extends State<LoginPage> {
}
}
if (attr != null && !isEmailVerificationEnabled) {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/auth/lib/ui/account/logout_dialog.dart b/auth/lib/ui/account/logout_dialog.dart
index 43eed0fd21..5604f0ae38 100644
--- a/auth/lib/ui/account/logout_dialog.dart
+++ b/auth/lib/ui/account/logout_dialog.dart
@@ -23,6 +23,7 @@ Future<void> autoLogoutAlert(BuildContext context) async {
int pendingSyncCount =
await AuthenticatorDB.instance.getNeedSyncCount();
if (pendingSyncCount > 0) {
+ // ignore: unawaited_futures
showChoiceActionSheet(
context,
title: l10n.pendingSyncs,
diff --git a/auth/lib/ui/account/password_entry_page.dart b/auth/lib/ui/account/password_entry_page.dart
index db86b1186d..7411d34a8e 100644
--- a/auth/lib/ui/account/password_entry_page.dart
+++ b/auth/lib/ui/account/password_entry_page.dart
@@ -399,6 +399,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
} catch (e, s) {
_logger.severe(e, s);
await dialog.hide();
+ // ignore: unawaited_futures
showGenericErrorDialog(context: context);
}
}
@@ -446,6 +447,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
await UserService.instance.setAttributes(result);
await dialog.hide();
Configuration.instance.resetVolatilePassword();
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -457,10 +459,11 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
} catch (e, s) {
_logger.severe(e, s);
await dialog.hide();
+ // ignore: unawaited_futures
showGenericErrorDialog(context: context);
}
}
-
+ // ignore: unawaited_futures
routeToPage(
context,
RecoveryKeyPage(
@@ -476,12 +479,14 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
_logger.severe(e);
await dialog.hide();
if (e is UnsupportedError) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.insecureDevice,
context.l10n.sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease,
);
} else {
+ // ignore: unawaited_futures
showGenericErrorDialog(context: context);
}
}
diff --git a/auth/lib/ui/account/password_reentry_page.dart b/auth/lib/ui/account/password_reentry_page.dart
index a4570c5dbc..f729f935ed 100644
--- a/auth/lib/ui/account/password_reentry_page.dart
+++ b/auth/lib/ui/account/password_reentry_page.dart
@@ -116,6 +116,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
firstButtonLabel: context.l10n.useRecoveryKey,
);
if (dialogChoice!.action == ButtonAction.first) {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/auth/lib/ui/account/recovery_page.dart b/auth/lib/ui/account/recovery_page.dart
index acfd019042..f0d5199d1a 100644
--- a/auth/lib/ui/account/recovery_page.dart
+++ b/auth/lib/ui/account/recovery_page.dart
@@ -54,6 +54,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
await Configuration.instance.recover(_recoveryKey.text.trim());
await dialog.hide();
showToast(context, "Recovery successful!");
+ // ignore: unawaited_futures
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -72,6 +73,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
if (e is AssertionError) {
errMessage = '$errMessage : ${e.message}';
}
+ // ignore: unawaited_futures
showErrorDialog(context, "Incorrect recovery key", errMessage);
}
},
diff --git a/auth/lib/ui/account/request_pwd_verification_page.dart b/auth/lib/ui/account/request_pwd_verification_page.dart
index 02be123479..d852859fa7 100644
--- a/auth/lib/ui/account/request_pwd_verification_page.dart
+++ b/auth/lib/ui/account/request_pwd_verification_page.dart
@@ -78,7 +78,7 @@ class _RequestPasswordVerificationPageState
onPressedFunction: () async {
FocusScope.of(context).unfocus();
final dialog = createProgressDialog(context, context.l10n.pleaseWait);
- dialog.show();
+ await dialog.show();
try {
final attributes = Configuration.instance.getKeyAttributes()!;
final Uint8List keyEncryptionKey = await CryptoUtil.deriveKey(
@@ -92,17 +92,18 @@ class _RequestPasswordVerificationPageState
keyEncryptionKey,
Sodium.base642bin(attributes.keyDecryptionNonce),
);
- dialog.show();
+ await dialog.show();
// pop
await widget.onPasswordVerified(keyEncryptionKey);
- dialog.hide();
+ await dialog.hide();
Navigator.of(context).pop(true);
} catch (e, s) {
_logger.severe("Error while verifying password", e, s);
- dialog.hide();
+ await dialog.hide();
if (widget.onPasswordError != null) {
widget.onPasswordError!();
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.incorrectPasswordTitle,
diff --git a/auth/lib/ui/account/sessions_page.dart b/auth/lib/ui/account/sessions_page.dart
index 30fdc1ed0b..31b7e7a415 100644
--- a/auth/lib/ui/account/sessions_page.dart
+++ b/auth/lib/ui/account/sessions_page.dart
@@ -121,6 +121,7 @@ class _SessionsPageState extends State<SessionsPage> {
} catch (e) {
await dialog.hide();
_logger.severe('failed to terminate');
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@ -184,7 +185,7 @@ class _SessionsPageState extends State<SessionsPage> {
if (isLoggingOutFromThisDevice) {
await UserService.instance.logout(context);
} else {
- _terminateSession(session);
+ await _terminateSession(session);
}
},
),
diff --git a/auth/lib/ui/account/verify_recovery_page.dart b/auth/lib/ui/account/verify_recovery_page.dart
index dad67590b4..2633afe331 100644
--- a/auth/lib/ui/account/verify_recovery_page.dart
+++ b/auth/lib/ui/account/verify_recovery_page.dart
@@ -92,6 +92,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
String recoveryKey;
try {
recoveryKey = Sodium.bin2hex(Configuration.instance.getRecoveryKey());
+ // ignore: unawaited_futures
routeToPage(
context,
RecoveryKeyPage(
@@ -104,6 +105,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
),
);
} catch (e) {
+ // ignore: unawaited_futures
showGenericErrorDialog(context: context);
return;
}
diff --git a/auth/lib/ui/code_widget.dart b/auth/lib/ui/code_widget.dart
index 6494df5cf7..7e0f78be35 100644
--- a/auth/lib/ui/code_widget.dart
+++ b/auth/lib/ui/code_widget.dart
@@ -356,6 +356,7 @@ class _CodeWidgetState extends State<CodeWidget> {
await FlutterClipboard.copy(content);
showToast(context, confirmationMessage);
if (Platform.isAndroid && shouldMinimizeOnCopy) {
+ // ignore: unawaited_futures
MoveToBackground.moveTaskToBack();
}
}
@@ -385,7 +386,7 @@ class _CodeWidgetState extends State<CodeWidget> {
),
);
if (code != null) {
- CodeStore.instance.addCode(code);
+ await CodeStore.instance.addCode(code);
}
}
diff --git a/auth/lib/ui/common/progress_dialog.dart b/auth/lib/ui/common/progress_dialog.dart
index 8c9a4e1f16..269a2b9b3e 100644
--- a/auth/lib/ui/common/progress_dialog.dart
+++ b/auth/lib/ui/common/progress_dialog.dart
@@ -146,6 +146,7 @@ class ProgressDialog {
try {
if (!_isShowing) {
_dialog = _Body();
+ // ignore: unawaited_futures
showDialog<dynamic>(
context: _context!,
barrierDismissible: _barrierDismissible,
diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dart
index b8908650f1..792a4c917c 100644
--- a/auth/lib/ui/home_page.dart
+++ b/auth/lib/ui/home_page.dart
@@ -120,7 +120,7 @@ class _HomePageState extends State<HomePage> {
),
);
if (code != null) {
- CodeStore.instance.addCode(code);
+ await CodeStore.instance.addCode(code);
// Focus the new code by searching
if (_codes.length > 2) {
_focusNewCode(code);
@@ -137,7 +137,7 @@ class _HomePageState extends State<HomePage> {
),
);
if (code != null) {
- CodeStore.instance.addCode(code);
+ await CodeStore.instance.addCode(code);
}
}
@@ -151,6 +151,7 @@ class _HomePageState extends State<HomePage> {
return false;
}
if (Platform.isAndroid) {
+ // ignore: unawaited_futures
MoveToBackground.moveTaskToBack();
return false;
} else {
diff --git a/auth/lib/ui/settings/about_section_widget.dart b/auth/lib/ui/settings/about_section_widget.dart
index 7c7b463778..4fcd2c27cd 100644
--- a/auth/lib/ui/settings/about_section_widget.dart
+++ b/auth/lib/ui/settings/about_section_widget.dart
@@ -36,6 +36,7 @@ class AboutSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
launchUrl(Uri.parse("https://github.com/ente-io/ente"));
},
),
@@ -68,6 +69,7 @@ class AboutSectionWidget extends StatelessWidget {
await UpdateService.instance.shouldUpdate();
await dialog.hide();
if (shouldUpdate) {
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
@@ -115,6 +117,7 @@ class AboutMenuItemWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/auth/lib/ui/settings/account_section_widget.dart b/auth/lib/ui/settings/account_section_widget.dart
index eceac521f3..60e426b090 100644
--- a/auth/lib/ui/settings/account_section_widget.dart
+++ b/auth/lib/ui/settings/account_section_widget.dart
@@ -48,6 +48,7 @@ class AccountSectionWidget extends StatelessWidget {
l10n.authToChangeYourEmail,
);
if (hasAuthenticated) {
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
@@ -74,6 +75,7 @@ class AccountSectionWidget extends StatelessWidget {
l10n.authToChangeYourPassword,
);
if (hasAuthenticated) {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -106,9 +108,11 @@ class AccountSectionWidget extends StatelessWidget {
recoveryKey =
Sodium.bin2hex(Configuration.instance.getRecoveryKey());
} catch (e) {
+ // ignore: unawaited_futures
showGenericErrorDialog(context: context);
return;
}
+ // ignore: unawaited_futures
routeToPage(
context,
RecoveryKeyPage(
@@ -142,6 +146,7 @@ class AccountSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(context, const DeleteAccountPage());
},
),
diff --git a/auth/lib/ui/settings/app_update_dialog.dart b/auth/lib/ui/settings/app_update_dialog.dart
index eba357285b..5d05dddc5c 100644
--- a/auth/lib/ui/settings/app_update_dialog.dart
+++ b/auth/lib/ui/settings/app_update_dialog.dart
@@ -174,6 +174,7 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
);
}
Navigator.of(context, rootNavigator: true).pop('dialog');
+ // ignore: unawaited_futures
OpenFilex.open(_saveUrl);
} catch (e) {
Logger("ApkDownloader").severe(e);
@@ -214,7 +215,7 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
),
],
);
-
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
diff --git a/auth/lib/ui/settings/danger_section_widget.dart b/auth/lib/ui/settings/danger_section_widget.dart
index bdf16a167c..2e7eccc16c 100644
--- a/auth/lib/ui/settings/danger_section_widget.dart
+++ b/auth/lib/ui/settings/danger_section_widget.dart
@@ -46,6 +46,7 @@ class DangerSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(context, const DeleteAccountPage());
},
),
diff --git a/auth/lib/ui/settings/data/data_section_widget.dart b/auth/lib/ui/settings/data/data_section_widget.dart
index 63c16ae9c5..f9c3ed1171 100644
--- a/auth/lib/ui/settings/data/data_section_widget.dart
+++ b/auth/lib/ui/settings/data/data_section_widget.dart
@@ -35,6 +35,7 @@ class DataSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(context, ImportCodePage());
},
),
diff --git a/auth/lib/ui/settings/data/export_widget.dart b/auth/lib/ui/settings/data/export_widget.dart
index cc9a1638b2..c9066ccce1 100644
--- a/auth/lib/ui/settings/data/export_widget.dart
+++ b/auth/lib/ui/settings/data/export_widget.dart
@@ -98,7 +98,7 @@ Future<void> _requestForEncryptionPassword(
),
);
// get json value of data
- _exportCodes(context, jsonEncode(data.toJson()));
+ await _exportCodes(context, jsonEncode(data.toJson()));
} catch (e, s) {
Logger("ExportWidget").severe(e, s);
showToast(context, "Error while exporting codes.");
diff --git a/auth/lib/ui/settings/data/import/google_auth_import.dart b/auth/lib/ui/settings/data/import/google_auth_import.dart
index d883f365c5..2c83bc206c 100644
--- a/auth/lib/ui/settings/data/import/google_auth_import.dart
+++ b/auth/lib/ui/settings/data/import/google_auth_import.dart
@@ -56,6 +56,7 @@ Future<void> showGoogleAuthInstruction(BuildContext context) async {
await CodeStore.instance.addCode(code, shouldSync: false);
}
unawaited(AuthenticatorService.instance.onlineSync());
+ // ignore: unawaited_futures
importSuccessDialog(context, codes.length);
}
}
diff --git a/auth/lib/ui/settings/data/import/import_service.dart b/auth/lib/ui/settings/data/import/import_service.dart
index ab48924be2..0e42197baa 100644
--- a/auth/lib/ui/settings/data/import/import_service.dart
+++ b/auth/lib/ui/settings/data/import/import_service.dart
@@ -19,29 +19,29 @@ class ImportService {
Future<void> initiateImport(BuildContext context, ImportType type) async {
switch (type) {
case ImportType.plainText:
- showImportInstructionDialog(context);
+ await showImportInstructionDialog(context);
break;
case ImportType.encrypted:
- showEncryptedImportInstruction(context);
+ await showEncryptedImportInstruction(context);
break;
case ImportType.ravio:
- showRaivoImportInstruction(context);
+ await showRaivoImportInstruction(context);
break;
case ImportType.googleAuthenticator:
- showGoogleAuthInstruction(context);
+ await showGoogleAuthInstruction(context);
// showToast(context, 'coming soon');
break;
case ImportType.aegis:
- showAegisImportInstruction(context);
+ await showAegisImportInstruction(context);
break;
case ImportType.twoFas:
- show2FasImportInstruction(context);
+ await show2FasImportInstruction(context);
break;
case ImportType.bitwarden:
- showBitwardenImportInstruction(context);
+ await showBitwardenImportInstruction(context);
break;
case ImportType.lastpass:
- showLastpassImportInstruction(context);
+ await showLastpassImportInstruction(context);
break;
}
}
diff --git a/auth/lib/ui/settings/data/import_page.dart b/auth/lib/ui/settings/data/import_page.dart
index 08a4d40d88..cd0f2114ac 100644
--- a/auth/lib/ui/settings/data/import_page.dart
+++ b/auth/lib/ui/settings/data/import_page.dart
@@ -105,7 +105,7 @@ class ImportCodePage extends StatelessWidget {
index != importOptions.length - 1,
isTopBorderRadiusRemoved: index != 0,
onTap: () async {
- ImportService().initiateImport(context, type);
+ await ImportService().initiateImport(context, type);
// routeToPage(context, ImportCodePage());
// _showImportInstructionDialog(context);
},
diff --git a/auth/lib/ui/settings/developer_settings_page.dart b/auth/lib/ui/settings/developer_settings_page.dart
index 1f263e5e9d..96139e9827 100644
--- a/auth/lib/ui/settings/developer_settings_page.dart
+++ b/auth/lib/ui/settings/developer_settings_page.dart
@@ -61,6 +61,7 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
throw const FormatException();
}
} catch (e) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.invalidEndpoint,
diff --git a/auth/lib/ui/settings/general_section_widget.dart b/auth/lib/ui/settings/general_section_widget.dart
index 5026166f6d..4518be8de3 100644
--- a/auth/lib/ui/settings/general_section_widget.dart
+++ b/auth/lib/ui/settings/general_section_widget.dart
@@ -48,6 +48,7 @@ class _AdvancedSectionWidgetState extends State<AdvancedSectionWidget> {
trailingIconIsMuted: true,
onTap: () async {
final locale = await getLocale();
+ // ignore: unawaited_futures
routeToPage(
context,
LanguageSelectorPage(
diff --git a/auth/lib/ui/settings/security_section_widget.dart b/auth/lib/ui/settings/security_section_widget.dart
index 2bc380b965..636692dcf2 100644
--- a/auth/lib/ui/settings/security_section_widget.dart
+++ b/auth/lib/ui/settings/security_section_widget.dart
@@ -116,6 +116,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
context.l10n.authToViewYourActiveSessions,
);
if (hasAuthenticated) {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/auth/lib/ui/settings/social_section_widget.dart b/auth/lib/ui/settings/social_section_widget.dart
index 71016bf320..62b200453b 100644
--- a/auth/lib/ui/settings/social_section_widget.dart
+++ b/auth/lib/ui/settings/social_section_widget.dart
@@ -81,6 +81,7 @@ class SocialsMenuItemWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
launchUrlString(
url,
mode: launchInExternalApp
diff --git a/auth/lib/ui/settings/support_section_widget.dart b/auth/lib/ui/settings/support_section_widget.dart
index 8c3d1e8fed..418c1d4302 100644
--- a/auth/lib/ui/settings/support_section_widget.dart
+++ b/auth/lib/ui/settings/support_section_widget.dart
@@ -42,6 +42,7 @@ class _SupportSectionWidgetState extends State<SupportSectionWidget> {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
showModalBottomSheet<void>(
backgroundColor: Theme.of(context).colorScheme.background,
barrierColor: Colors.black87,
@@ -61,6 +62,7 @@ class _SupportSectionWidgetState extends State<SupportSectionWidget> {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
launchUrlString(
githubDiscussionsUrl,
mode: LaunchMode.externalApplication,
diff --git a/auth/lib/ui/tools/lock_screen.dart b/auth/lib/ui/tools/lock_screen.dart
index 213e7a99a4..ca8ae1e9b6 100644
--- a/auth/lib/ui/tools/lock_screen.dart
+++ b/auth/lib/ui/tools/lock_screen.dart
@@ -56,7 +56,7 @@ class _LockScreenState extends State<LockScreen> with WidgetsBindingObserver {
text: context.l10n.unlock,
iconData: Icons.lock_open_outlined,
onTap: () async {
- _showLockScreen(source: "tapUnlock");
+ await _showLockScreen(source: "tapUnlock");
},
),
),
diff --git a/auth/lib/ui/two_factor_authentication_page.dart b/auth/lib/ui/two_factor_authentication_page.dart
index 6287abdf8b..3abd01cde0 100644
--- a/auth/lib/ui/two_factor_authentication_page.dart
+++ b/auth/lib/ui/two_factor_authentication_page.dart
@@ -119,7 +119,7 @@ class _TwoFactorAuthenticationPageState
child: OutlinedButton(
onPressed: _code.length == 6
? () async {
- _verifyTwoFactorCode(_code);
+ await _verifyTwoFactorCode(_code);
}
: null,
child: Text(l10n.verify),
diff --git a/auth/lib/utils/email_util.dart b/auth/lib/utils/email_util.dart
index 0da675f21d..d276962b1e 100644
--- a/auth/lib/utils/email_util.dart
+++ b/auth/lib/utils/email_util.dart
@@ -62,6 +62,7 @@ Future<void> sendLogs(
],
),
onPressed: () async {
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
@@ -118,6 +119,7 @@ Future<void> sendLogs(
),
),
);
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (_) {
@@ -159,7 +161,7 @@ Future<String> getZippedLogsFile(BuildContext context) async {
tempPath + "/logs-${Configuration.instance.getUserID() ?? 0}.zip";
final encoder = ZipFileEncoder();
encoder.create(zipFilePath);
- encoder.addDirectory(logsDirectory);
+ await encoder.addDirectory(logsDirectory);
encoder.close();
await dialog.hide();
return zipFilePath;
diff --git a/auth/lib/utils/toast_util.dart b/auth/lib/utils/toast_util.dart
index a9f0392c24..c275160ebd 100644
--- a/auth/lib/utils/toast_util.dart
+++ b/auth/lib/utils/toast_util.dart
@@ -2,14 +2,14 @@ import 'package:ente_auth/ente_theme_data.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
-Future showToast(
+void showToast(
BuildContext context,
String message, {
toastLength = Toast.LENGTH_LONG,
iOSDismissOnTap = true,
}) async {
await Fluttertoast.cancel();
- return Fluttertoast.showToast(
+ await Fluttertoast.showToast(
msg: message,
toastLength: toastLength,
gravity: ToastGravity.BOTTOM,
@@ -20,6 +20,6 @@ Future showToast(
);
}
-Future<void> showShortToast(context, String message) {
- return showToast(context, message, toastLength: Toast.LENGTH_SHORT);
+void showShortToast(context, String message) {
+ showToast(context, message, toastLength: Toast.LENGTH_SHORT);
}