Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix all await warnings

vishnukvmd68d504850ef6
diff --git a/lib/services/local_file_update_service.dart b/lib/services/local_file_update_service.dart
index 5219376b75..591cade675 100644
--- a/lib/services/local_file_update_service.dart
+++ b/lib/services/local_file_update_service.dart
@@ -221,7 +221,7 @@ class LocalFileUpdateService {
if (_prefs.containsKey(_iosLivePhotoSizeMigrationDone)) {
return;
}
- bool hasEntry = await _fileUpdationDB.isExisting(
+ final hasEntry = await _fileUpdationDB.isExisting(
file.localID!,
FileUpdationDB.livePhotoCheck,
);
diff --git a/lib/services/user_service.dart b/lib/services/user_service.dart
index 020047384e..2ae0795543 100644
--- a/lib/services/user_service.dart
+++ b/lib/services/user_service.dart
@@ -21,7 +21,7 @@ import "package:photos/models/api/user/srp.dart";
import 'package:photos/models/delete_account.dart';
import 'package:photos/models/key_attributes.dart';
import 'package:photos/models/key_gen_result.dart';
-import 'package:photos/models/public_key.dart' as ePublicKey;
+import 'package:photos/models/public_key.dart' as public_key;
import 'package:photos/models/sessions.dart';
import 'package:photos/models/set_keys_request.dart';
import 'package:photos/models/set_recovery_key_request.dart';
@@ -160,7 +160,7 @@ class UserService {
);
final publicKey = response.data["publicKey"];
await PublicKeysDB.instance.setKey(
- ePublicKey.PublicKey(
+ public_key.PublicKey(
email,
publicKey,
),
@@ -198,7 +198,7 @@ class UserService {
await _preferences.setString(keyUserDetails, userDetails.toJson());
// handle email change from different client
if (userDetails.email != _config.getEmail()) {
- setEmail(userDetails.email);
+ await setEmail(userDetails.email);
}
}
return userDetails;
@@ -377,6 +377,7 @@ class UserService {
);
Navigator.of(context).pop();
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).incorrectCode,
@@ -386,6 +387,7 @@ class UserService {
} catch (e) {
await dialog.hide();
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -430,6 +432,7 @@ class UserService {
Bus.instance.fire(UserDetailsChangedEvent());
return;
}
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -438,12 +441,14 @@ class UserService {
} on DioError catch (e) {
await dialog.hide();
if (e.response != null && e.response!.statusCode == 403) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
S.of(context).thisEmailIsAlreadyInUse,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).incorrectCode,
@@ -453,6 +458,7 @@ class UserService {
} catch (e) {
await dialog.hide();
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -605,7 +611,7 @@ class UserService {
final Uint8List identity = Uint8List.fromList(
utf8.encode(srpAttributes.srpUserID),
);
- _logger.finest('longinKey derivation done');
+ _logger.finest('loginKey derivation done');
final Uint8List salt = base64Decode(srpAttributes.srpSalt);
final Uint8List password = loginKey;
final SecureRandom random = _getSecureRandom();
@@ -644,7 +650,7 @@ class UserService {
final String twoFASessionID = response.data["twoFactorSessionID"];
Configuration.instance.setVolatilePassword(userPassword);
if (twoFASessionID.isNotEmpty) {
- setTwoFactor(value: true);
+ await setTwoFactor(value: true);
page = TwoFactorAuthenticationPage(twoFASessionID);
} else {
await _saveConfiguration(response);
@@ -664,6 +670,7 @@ class UserService {
Navigator.of(context).popUntil((route) => route.isFirst);
Bus.instance.fire(AccountConfiguredEvent());
} else {
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -765,6 +772,7 @@ class UserService {
(route) => route.isFirst,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).incorrectCode,
@@ -774,6 +782,7 @@ class UserService {
} catch (e) {
await dialog.hide();
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -793,6 +802,7 @@ class UserService {
},
);
if (response.statusCode == 200) {
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -810,6 +820,7 @@ class UserService {
_logger.severe(e);
if (e.response != null && e.response!.statusCode == 404) {
showToast(context, S.of(context).sessionExpired);
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -819,6 +830,7 @@ class UserService {
(route) => route.isFirst,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -827,6 +839,7 @@ class UserService {
}
} catch (e) {
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -886,6 +899,7 @@ class UserService {
S.of(context).twofactorAuthenticationSuccessfullyReset,
);
await _saveConfiguration(response);
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -899,6 +913,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) {
@@ -908,6 +923,7 @@ class UserService {
(route) => route.isFirst,
);
} else {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -916,6 +932,7 @@ class UserService {
}
} catch (e) {
_logger.severe(e);
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).oops,
@@ -986,6 +1003,7 @@ class UserService {
_logger.severe(e, s);
if (e is DioError) {
if (e.response != null && e.response!.statusCode == 401) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).incorrectCode,
@@ -994,6 +1012,7 @@ class UserService {
return false;
}
}
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).somethingWentWrong,
@@ -1033,7 +1052,7 @@ class UserService {
Future<bool> fetchTwoFactorStatus() async {
try {
final response = await _enteDio.get("/users/two-factor/status");
- setTwoFactor(value: response.data["status"]);
+ await setTwoFactor(value: response.data["status"]);
return response.data["status"];
} catch (e) {
_logger.severe("Failed to fetch 2FA status", e);
@@ -1109,7 +1128,7 @@ class UserService {
if (fetchTwoFactorStatus) {
value = await UserService.instance.fetchTwoFactorStatus();
}
- _preferences.setBool(keyHasEnabledTwoFactor, value);
+ await _preferences.setBool(keyHasEnabledTwoFactor, value);
}
bool hasEnabledTwoFactor() {
diff --git a/lib/ui/collections/album/vertical_list.dart b/lib/ui/collections/album/vertical_list.dart
index c3634995ca..4c65d44f26 100644
--- a/lib/ui/collections/album/vertical_list.dart
+++ b/lib/ui/collections/album/vertical_list.dart
@@ -302,6 +302,7 @@ class AlbumVerticalListWidget extends StatelessWidget {
ShareCollectionPage(collection),
),
);
+ // ignore: unawaited_futures
CollectionsService.instance
.updateShareUrl(collection, {'enableCollect': true}).then(
(value) => showShortToast(
@@ -402,12 +403,13 @@ class AlbumVerticalListWidget extends StatelessWidget {
selectedFiles!.files.toList(),
);
await dialog.hide();
- RemoteSyncService.instance.sync(silently: true);
+ unawaited(RemoteSyncService.instance.sync(silently: true));
selectedFiles?.clearAll();
return true;
} on AssertionError catch (e) {
await dialog.hide();
+ // ignore: unawaited_futures
showErrorDialog(context, S.of(context).oops, e.message as String?);
return false;
} catch (e, s) {
@@ -431,12 +433,13 @@ class AlbumVerticalListWidget extends StatelessWidget {
try {
await CollectionsService.instance
.restore(toCollectionID, selectedFiles!.files.toList());
- RemoteSyncService.instance.sync(silently: true);
+ unawaited(RemoteSyncService.instance.sync(silently: true));
selectedFiles?.clearAll();
await dialog.hide();
return true;
} on AssertionError catch (e) {
await dialog.hide();
+ // ignore: unawaited_futures
showErrorDialog(context, S.of(context).oops, e.message as String?);
return false;
} catch (e, s) {
diff --git a/lib/ui/collections/button/archived_button.dart b/lib/ui/collections/button/archived_button.dart
index 7c705d99a5..16957dfe09 100644
--- a/lib/ui/collections/button/archived_button.dart
+++ b/lib/ui/collections/button/archived_button.dart
@@ -97,6 +97,7 @@ class ArchivedCollectionsButton extends StatelessWidget {
),
),
onPressed: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
ArchivePage(),
diff --git a/lib/ui/collections/button/hidden_button.dart b/lib/ui/collections/button/hidden_button.dart
index cb1ea8ca1e..9de883c515 100644
--- a/lib/ui/collections/button/hidden_button.dart
+++ b/lib/ui/collections/button/hidden_button.dart
@@ -78,6 +78,7 @@ class HiddenCollectionsButtonWidget extends StatelessWidget {
S.of(context).authToViewYourHiddenFiles,
);
if (hasAuthenticated) {
+ // ignore: unawaited_futures
routeToPage(
context,
const HiddenPage(),
diff --git a/lib/ui/collections/button/uncategorized_button.dart b/lib/ui/collections/button/uncategorized_button.dart
index 0773eb761f..f474bc6a1d 100644
--- a/lib/ui/collections/button/uncategorized_button.dart
+++ b/lib/ui/collections/button/uncategorized_button.dart
@@ -101,6 +101,7 @@ class UnCategorizedCollections extends StatelessWidget {
),
onPressed: () async {
if (collection != null) {
+ // ignore: unawaited_futures
routeToPage(
context,
UnCategorizedPage(collection),
diff --git a/lib/ui/collections/collection_list_page.dart b/lib/ui/collections/collection_list_page.dart
index 589b6d77be..f7308e331b 100644
--- a/lib/ui/collections/collection_list_page.dart
+++ b/lib/ui/collections/collection_list_page.dart
@@ -45,7 +45,7 @@ class _CollectionListPageState extends State<CollectionListPage> {
collections = widget.collections;
_collectionUpdatesSubscription =
Bus.instance.on<CollectionUpdatedEvent>().listen((event) async {
- refreshCollections();
+ unawaited(refreshCollections());
});
}
diff --git a/lib/ui/collections/new_album_icon.dart b/lib/ui/collections/new_album_icon.dart
index 9ec8181432..01d871210f 100644
--- a/lib/ui/collections/new_album_icon.dart
+++ b/lib/ui/collections/new_album_icon.dart
@@ -43,6 +43,7 @@ class NewAlbumIcon extends StatelessWidget {
try {
final Collection c =
await CollectionsService.instance.createAlbum(text);
+ // ignore: unawaited_futures
routeToPage(
context,
CollectionPage(CollectionWithThumbnail(c, null)),
diff --git a/lib/ui/common/progress_dialog.dart b/lib/ui/common/progress_dialog.dart
index 8c9a4e1f16..61f8d4ca17 100644
--- a/lib/ui/common/progress_dialog.dart
+++ b/lib/ui/common/progress_dialog.dart
@@ -1,3 +1,5 @@
+import "dart:async";
+
import 'package:flutter/material.dart';
enum ProgressDialogType { normal, download }
@@ -146,27 +148,29 @@ class ProgressDialog {
try {
if (!_isShowing) {
_dialog = _Body();
- showDialog<dynamic>(
- context: _context!,
- barrierDismissible: _barrierDismissible,
- barrierColor: _barrierColor,
- builder: (BuildContext context) {
- _dismissingContext = context;
- return WillPopScope(
- onWillPop: () async => _barrierDismissible,
- child: Dialog(
- backgroundColor: _backgroundColor,
- insetAnimationCurve: _insetAnimCurve,
- insetAnimationDuration: const Duration(milliseconds: 100),
- elevation: _dialogElevation,
- shape: RoundedRectangleBorder(
- borderRadius:
- BorderRadius.all(Radius.circular(_borderRadius)),
+ unawaited(
+ showDialog<dynamic>(
+ context: _context!,
+ barrierDismissible: _barrierDismissible,
+ barrierColor: _barrierColor,
+ builder: (BuildContext context) {
+ _dismissingContext = context;
+ return WillPopScope(
+ onWillPop: () async => _barrierDismissible,
+ child: Dialog(
+ backgroundColor: _backgroundColor,
+ insetAnimationCurve: _insetAnimCurve,
+ insetAnimationDuration: const Duration(milliseconds: 100),
+ elevation: _dialogElevation,
+ shape: RoundedRectangleBorder(
+ borderRadius:
+ BorderRadius.all(Radius.circular(_borderRadius)),
+ ),
+ child: _dialog,
),
- child: _dialog,
- ),
- );
- },
+ );
+ },
+ ),
);
// Delaying the function for 200 milliseconds
// [Default transitionDuration of DialogRoute]
diff --git a/lib/ui/components/home_header_widget.dart b/lib/ui/components/home_header_widget.dart
index aea0aca525..6fb8f0f6d3 100644
--- a/lib/ui/components/home_header_widget.dart
+++ b/lib/ui/components/home_header_widget.dart
@@ -62,6 +62,7 @@ class _HomeHeaderWidgetState extends State<HomeHeaderWidget> {
} else {
final bool hasGrantedLimit =
LocalSyncService.instance.hasGrantedLimitedPermissions();
+ // ignore: unawaited_futures
showChoiceActionSheet(
context,
title: S.of(context).preserveMore,
diff --git a/lib/ui/extents_page_view.dart b/lib/ui/extents_page_view.dart
index 4225efa63c..65c711f5d0 100644
--- a/lib/ui/extents_page_view.dart
+++ b/lib/ui/extents_page_view.dart
@@ -190,7 +190,7 @@ class ExtentsPageView extends StatefulWidget {
/// }
/// ```
/// {@end-tool}
- ExtentsPageView.custom({
+ const ExtentsPageView.custom({
Key? key,
this.scrollDirection = Axis.horizontal,
this.reverse = false,
diff --git a/lib/ui/growth/apply_code_screen.dart b/lib/ui/growth/apply_code_screen.dart
index c0c4128eab..2473479dd0 100644
--- a/lib/ui/growth/apply_code_screen.dart
+++ b/lib/ui/growth/apply_code_screen.dart
@@ -122,7 +122,7 @@ class _ApplyCodeScreenState extends State<ApplyCodeScreen> {
await StorageBonusService.instance
.getGateway()
.claimReferralCode(code.trim().toUpperCase());
-
+ // ignore: unawaited_futures
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => CodeSuccessScreen(
@@ -134,6 +134,7 @@ class _ApplyCodeScreenState extends State<ApplyCodeScreen> {
} catch (e) {
Logger('$runtimeType')
.severe("failed to apply referral", e);
+ // ignore: unawaited_futures
showErrorDialogForException(
context: context,
exception: e as Exception,
diff --git a/lib/ui/growth/code_success_screen.dart b/lib/ui/growth/code_success_screen.dart
index d30f05db2d..116b0b8d64 100644
--- a/lib/ui/growth/code_success_screen.dart
+++ b/lib/ui/growth/code_success_screen.dart
@@ -92,6 +92,7 @@ class CodeSuccessScreen extends StatelessWidget {
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
StorageDetailsScreen(referralView, userDetails),
diff --git a/lib/ui/growth/referral_screen.dart b/lib/ui/growth/referral_screen.dart
index 5e403b5ddb..32843c192f 100644
--- a/lib/ui/growth/referral_screen.dart
+++ b/lib/ui/growth/referral_screen.dart
@@ -250,6 +250,7 @@ class ReferralWidget extends StatelessWidget {
isTopBorderRadiusRemoved: referralView.enableApplyCode,
alignCaptionedTextToLeft: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
WebPage(
@@ -287,6 +288,7 @@ class ReferralWidget extends StatelessWidget {
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
StorageDetailsScreen(referralView, userDetails),
diff --git a/lib/ui/home/grant_permissions_widget.dart b/lib/ui/home/grant_permissions_widget.dart
index 7fbeec1d8b..29c8e5e1b3 100644
--- a/lib/ui/home/grant_permissions_widget.dart
+++ b/lib/ui/home/grant_permissions_widget.dart
@@ -119,7 +119,7 @@ class GrantPermissionsWidget extends StatelessWidget {
),
],
);
-
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
diff --git a/lib/ui/home/landing_page_widget.dart b/lib/ui/home/landing_page_widget.dart
index 1e8d98e417..119610ffaa 100644
--- a/lib/ui/home/landing_page_widget.dart
+++ b/lib/ui/home/landing_page_widget.dart
@@ -1,3 +1,4 @@
+import "dart:async";
import 'dart:io';
import 'package:dots_indicator/dots_indicator.dart';
@@ -55,6 +56,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
),
onTap: () async {
final locale = await getLocale();
+ // ignore: unawaited_futures
routeToPage(
context,
LanguageSelectorPage(
@@ -62,7 +64,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
(locale) async {
await setLocale(locale);
EnteApp.setLocale(context, locale);
- S.delegate.load(locale);
+ unawaited(S.delegate.load(locale));
},
locale,
),
@@ -202,6 +204,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
page = getSubscriptionPage(isOnBoarding: true);
}
}
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/lib/ui/home/loading_photos_widget.dart b/lib/ui/home/loading_photos_widget.dart
index fb74ce4df1..1eeddc4b8a 100644
--- a/lib/ui/home/loading_photos_widget.dart
+++ b/lib/ui/home/loading_photos_widget.dart
@@ -39,6 +39,7 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
if (LocalSyncService.instance.hasGrantedLimitedPermissions()) {
// Do nothing, let HomeWidget refresh
} else {
+ // ignore: unawaited_futures
routeToPage(
context,
BackupFolderSelectionPage(
diff --git a/lib/ui/home/start_backup_hook_widget.dart b/lib/ui/home/start_backup_hook_widget.dart
index 1db8913715..f331cd586b 100644
--- a/lib/ui/home/start_backup_hook_widget.dart
+++ b/lib/ui/home/start_backup_hook_widget.dart
@@ -1,3 +1,5 @@
+import "dart:async";
+
import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/generated/l10n.dart';
@@ -42,8 +44,9 @@ class StartBackupHookWidget extends StatelessWidget {
onTap: () async {
if (LocalSyncService.instance
.hasGrantedLimitedPermissions()) {
- PhotoManager.presentLimited();
+ unawaited(PhotoManager.presentLimited());
} else {
+ // ignore: unawaited_futures
routeToPage(
context,
BackupFolderSelectionPage(
diff --git a/lib/ui/map/map_screen.dart b/lib/ui/map/map_screen.dart
index df692a2fea..0a021c045c 100644
--- a/lib/ui/map/map_screen.dart
+++ b/lib/ui/map/map_screen.dart
@@ -68,7 +68,7 @@ class _MapScreenState extends State<MapScreen> {
Future<void> initialize() async {
try {
allImages = await widget.filesFutureFn();
- processFiles(allImages);
+ unawaited(processFiles(allImages));
} catch (e, s) {
_logger.severe("Error initializing map screen", e, s);
}
@@ -157,7 +157,7 @@ class _MapScreenState extends State<MapScreen> {
prevMessage = message;
} else {
- _mapMoveSubscription?.cancel();
+ await _mapMoveSubscription?.cancel();
isolate?.kill();
}
});
diff --git a/lib/ui/payment/add_on_page.dart b/lib/ui/payment/add_on_page.dart
index 6272bc75c2..fa7b3aba76 100644
--- a/lib/ui/payment/add_on_page.dart
+++ b/lib/ui/payment/add_on_page.dart
@@ -39,7 +39,7 @@ class AddOnPage extends StatelessWidget {
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
(delegateBuildContext, index) {
- Bonus bonus = bonusData.getAddOnBonuses()[index];
+ final bonus = bonusData.getAddOnBonuses()[index];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: AddOnViewSection(
@@ -50,7 +50,7 @@ class AddOnPage extends StatelessWidget {
),
);
},
- childCount: bonusData?.getAddOnBonuses().length ?? 0,
+ childCount: bonusData.getAddOnBonuses().length,
),
),
),
diff --git a/lib/ui/payment/skip_subscription_widget.dart b/lib/ui/payment/skip_subscription_widget.dart
index 2add30f7a8..c2949a238a 100644
--- a/lib/ui/payment/skip_subscription_widget.dart
+++ b/lib/ui/payment/skip_subscription_widget.dart
@@ -1,3 +1,5 @@
+import "dart:async";
+
import 'package:flutter/material.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/subscription_purchased_event.dart';
@@ -32,6 +34,7 @@ class SkipSubscriptionWidget extends StatelessWidget {
),
onPressed: () async {
Bus.instance.fire(SubscriptionPurchasedEvent());
+ // ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -40,8 +43,10 @@ class SkipSubscriptionWidget extends StatelessWidget {
),
(route) => false,
);
- BillingService.instance
- .verifySubscription(freeProductID, "", paymentProvider: "ente");
+ unawaited(
+ BillingService.instance
+ .verifySubscription(freeProductID, "", paymentProvider: "ente"),
+ );
},
child: Text(S.of(context).continueOnFreeTrial),
),
diff --git a/lib/ui/payment/store_subscription_page.dart b/lib/ui/payment/store_subscription_page.dart
index d0eca6c935..4bcdd4d5b6 100644
--- a/lib/ui/payment/store_subscription_page.dart
+++ b/lib/ui/payment/store_subscription_page.dart
@@ -119,11 +119,13 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
? S.of(context).googlePlayId
: S.of(context).appleId;
final String message = S.of(context).subAlreadyLinkedErrMessage(id);
+ // ignore: unawaited_futures
showErrorDialog(context, title, message);
return;
} catch (e) {
_logger.warning("Could not complete payment ", e);
await _dialog.hide();
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).paymentFailed,
@@ -175,6 +177,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
}
Future<void> _fetchSubData() async {
+ // ignore: unawaited_futures
_userService.getUserDetailsV2(memoryCount: false).then((userDetails) async {
_userDetails = userDetails;
_currentSubscription = userDetails.subscription;
@@ -316,7 +319,9 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
singleBorderRadius: 4,
alignCaptionedTextToLeft: true,
onTap: () async {
- _billingService.launchFamilyPortal(context, _userDetails);
+ unawaited(
+ _billingService.launchFamilyPortal(context, _userDetails),
+ );
},
),
),
@@ -452,6 +457,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
if (isActive) {
return;
}
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).sorry,
@@ -513,6 +519,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
"addOnBonus ${convertBytesToReadableFormat(addOnBonus)},"
"overshooting by ${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage() - (plan.storage + addOnBonus))}",
);
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).sorry,
@@ -540,6 +547,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
_currentSubscription!.productID != plan.androidID;
if (isCrossGradingOnAndroid) {
await _dialog.hide();
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).couldNotUpdateSubscription,
diff --git a/lib/ui/payment/stripe_subscription_page.dart b/lib/ui/payment/stripe_subscription_page.dart
index 9772f4ed43..51a80a67eb 100644
--- a/lib/ui/payment/stripe_subscription_page.dart
+++ b/lib/ui/payment/stripe_subscription_page.dart
@@ -277,6 +277,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
singleBorderRadius: 4,
alignCaptionedTextToLeft: true,
onTap: () async {
+ // ignore: unawaited_futures
_billingService.launchFamilyPortal(context, _userDetails);
},
),
diff --git a/lib/ui/payment/subscription_common_widgets.dart b/lib/ui/payment/subscription_common_widgets.dart
index c33f26d793..8c743e2f61 100644
--- a/lib/ui/payment/subscription_common_widgets.dart
+++ b/lib/ui/payment/subscription_common_widgets.dart
@@ -187,6 +187,7 @@ class SubFaqWidget extends StatelessWidget {
singleBorderRadius: 4,
alignCaptionedTextToLeft: true,
onTap: () async {
+ // ignore: unawaited_futures
showModalBottomSheet<void>(
backgroundColor: Theme.of(context).colorScheme.bgColorForQuestions,
barrierColor: Colors.black87,
diff --git a/lib/ui/settings/about_section_widget.dart b/lib/ui/settings/about_section_widget.dart
index e5de7a663b..8102b5d528 100644
--- a/lib/ui/settings/about_section_widget.dart
+++ b/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/photos-app"));
},
),
@@ -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/lib/ui/settings/account_section_widget.dart b/lib/ui/settings/account_section_widget.dart
index 3f5615e699..c184d4b894 100644
--- a/lib/ui/settings/account_section_widget.dart
+++ b/lib/ui/settings/account_section_widget.dart
@@ -59,6 +59,7 @@ class AccountSectionWidget extends StatelessWidget {
S.of(context).authToChangeYourEmail,
);
if (hasAuthenticated) {
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
@@ -86,6 +87,7 @@ class AccountSectionWidget extends StatelessWidget {
S.of(context).authToChangeYourPassword,
);
if (hasAuthenticated) {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -107,6 +109,7 @@ class AccountSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
launchUrlString("https://ente.io/faq/migration/out-of-ente/");
},
),
diff --git a/lib/ui/settings/advanced_settings_screen.dart b/lib/ui/settings/advanced_settings_screen.dart
index 3804e61053..2a8733bc00 100644
--- a/lib/ui/settings/advanced_settings_screen.dart
+++ b/lib/ui/settings/advanced_settings_screen.dart
@@ -82,6 +82,7 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
const MachineLearningSettingsPage(),
@@ -135,6 +136,7 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(context, const AppStorageViewer());
},
),
diff --git a/lib/ui/settings/app_update_dialog.dart b/lib/ui/settings/app_update_dialog.dart
index 2b087772fb..00bf1c9480 100644
--- a/lib/ui/settings/app_update_dialog.dart
+++ b/lib/ui/settings/app_update_dialog.dart
@@ -76,6 +76,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
),
onPressed: () async {
Navigator.pop(context);
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
@@ -236,6 +237,7 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
],
);
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
diff --git a/lib/ui/settings/backup/backup_folder_selection_page.dart b/lib/ui/settings/backup/backup_folder_selection_page.dart
index e55ab9a5bd..fda3f93431 100644
--- a/lib/ui/settings/backup/backup_folder_selection_page.dart
+++ b/lib/ui/settings/backup/backup_folder_selection_page.dart
@@ -227,7 +227,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
_allDevicePathIDs.length == _selectedDevicePathIDs.length,
);
await RemoteSyncService.instance.updateDeviceFolderSyncStatus(syncStatus);
- dialog.hide();
+ await dialog.hide();
Navigator.of(context).pop();
} catch (e, s) {
_logger.severe("Failed to updated backup folder", e, s);
diff --git a/lib/ui/settings/backup/backup_section_widget.dart b/lib/ui/settings/backup/backup_section_widget.dart
index 56c9f176e9..81013f653e 100644
--- a/lib/ui/settings/backup/backup_section_widget.dart
+++ b/lib/ui/settings/backup/backup_section_widget.dart
@@ -100,6 +100,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
}
if (status.localIDs.isEmpty) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).allClear,
diff --git a/lib/ui/settings/general_section_widget.dart b/lib/ui/settings/general_section_widget.dart
index 5094d26289..c01db225d3 100644
--- a/lib/ui/settings/general_section_widget.dart
+++ b/lib/ui/settings/general_section_widget.dart
@@ -1,3 +1,5 @@
+import "dart:async";
+
import 'package:flutter/material.dart';
import "package:photos/app.dart";
import "package:photos/generated/l10n.dart";
@@ -39,6 +41,7 @@ class GeneralSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
const ReferralScreen(),
@@ -75,7 +78,7 @@ class GeneralSectionWidget extends StatelessWidget {
(locale) async {
await setLocale(locale);
EnteApp.setLocale(context, locale);
- S.load(locale);
+ unawaited(S.load(locale));
},
locale,
),
@@ -114,6 +117,7 @@ class GeneralSectionWidget extends StatelessWidget {
Future<void> _onFamilyPlansTapped(BuildContext context) async {
final userDetails =
await UserService.instance.getUserDetailsV2(memoryCount: false);
+ // ignore: unawaited_futures
BillingService.instance.launchFamilyPortal(context, userDetails);
}
diff --git a/lib/ui/settings/social_section_widget.dart b/lib/ui/settings/social_section_widget.dart
index 95ea433fae..2e04aa723b 100644
--- a/lib/ui/settings/social_section_widget.dart
+++ b/lib/ui/settings/social_section_widget.dart
@@ -99,6 +99,7 @@ class SocialsMenuItemWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
launchUrlString(
url,
mode: launchInExternalApp
diff --git a/lib/ui/settings/storage_card_widget.dart b/lib/ui/settings/storage_card_widget.dart
index 543505bd4a..0d8924c836 100644
--- a/lib/ui/settings/storage_card_widget.dart
+++ b/lib/ui/settings/storage_card_widget.dart
@@ -62,6 +62,7 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () async {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/lib/ui/settings/support_section_widget.dart b/lib/ui/settings/support_section_widget.dart
index ef7690be59..580d3fd5ee 100644
--- a/lib/ui/settings/support_section_widget.dart
+++ b/lib/ui/settings/support_section_widget.dart
@@ -55,6 +55,7 @@ class SupportSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
launchUrlString(
githubIssuesUrl,
mode: LaunchMode.externalApplication,
diff --git a/lib/ui/settings_page.dart b/lib/ui/settings_page.dart
index ecbb9b08a7..85ce16afb2 100644
--- a/lib/ui/settings_page.dart
+++ b/lib/ui/settings_page.dart
@@ -100,6 +100,7 @@ class SettingsPage extends StatelessWidget {
type: NotificationType.goldenBanner,
onTap: () async {
StorageBonusService.instance.markStorageBonusAsDone();
+ // ignore: unawaited_futures
routeToPage(context, const ReferralScreen());
},
),
diff --git a/lib/ui/sharing/add_partipant_page.dart b/lib/ui/sharing/add_partipant_page.dart
index a7e11c356c..cf828e1feb 100644
--- a/lib/ui/sharing/add_partipant_page.dart
+++ b/lib/ui/sharing/add_partipant_page.dart
@@ -219,6 +219,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
}
final emailToAdd =
selectedEmail == '' ? _email : selectedEmail;
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
diff --git a/lib/ui/sharing/album_participants_page.dart b/lib/ui/sharing/album_participants_page.dart
index 893586b895..494df319f1 100644
--- a/lib/ui/sharing/album_participants_page.dart
+++ b/lib/ui/sharing/album_participants_page.dart
@@ -165,6 +165,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
onTap: isOwner
? () async {
if (isOwner) {
+ // ignore: unawaited_futures
_navigateToManageUser(currentUser);
}
}
@@ -192,6 +193,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
leadingIcon: Icons.add_outlined,
menuItemColor: getEnteColorScheme(context).fillFaint,
onTap: () async {
+ // ignore: unawaited_futures
_navigateToAddUser(false);
},
isTopBorderRadiusRemoved: collaborators.isNotEmpty,
@@ -241,6 +243,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
onTap: isOwner
? () async {
if (isOwner) {
+ // ignore: unawaited_futures
_navigateToManageUser(currentUser);
}
}
@@ -268,6 +271,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
leadingIcon: Icons.add_outlined,
menuItemColor: getEnteColorScheme(context).fillFaint,
onTap: () async {
+ // ignore: unawaited_futures
_navigateToAddUser(true);
},
isTopBorderRadiusRemoved: viewers.isNotEmpty,
diff --git a/lib/ui/sharing/manage_links_widget.dart b/lib/ui/sharing/manage_links_widget.dart
index 8468670290..02878735e2 100644
--- a/lib/ui/sharing/manage_links_widget.dart
+++ b/lib/ui/sharing/manage_links_widget.dart
@@ -109,6 +109,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
menuItemColor: enteColorScheme.fillFaint,
surfaceExecutionStates: false,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
LinkExpiryPickerPage(widget.collection!),
@@ -144,6 +145,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
alignCaptionedTextToLeft: true,
isBottomBorderRadiusRemoved: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
DeviceLimitPickerPage(widget.collection!),
@@ -174,6 +176,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
{'enableDownload': value},
);
if (!value) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).disableDownloadWarningTitle,
@@ -199,6 +202,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
value: isPasswordEnabled,
onChanged: (enablePassword) async {
if (enablePassword) {
+ // ignore: unawaited_futures
showTextInputDialog(
context,
title: S.of(context).setAPassword,
@@ -275,6 +279,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
leadingIcon: Icons.adaptive.share,
menuItemColor: getEnteColorScheme(context).fillFaint,
onTap: () async {
+ // ignore: unawaited_futures
shareText(urlValue);
},
isTopBorderRadiusRemoved: true,
diff --git a/lib/ui/sharing/share_collection_page.dart b/lib/ui/sharing/share_collection_page.dart
index ff3c8aeb6a..e63a39f3e6 100644
--- a/lib/ui/sharing/share_collection_page.dart
+++ b/lib/ui/sharing/share_collection_page.dart
@@ -87,6 +87,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
isTopBorderRadiusRemoved: _sharees.isNotEmpty,
isBottomBorderRadiusRemoved: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
AddParticipantPage(widget.collection, true),
@@ -114,6 +115,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
menuItemColor: getEnteColorScheme(context).fillFaint,
isTopBorderRadiusRemoved: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(context, AddParticipantPage(widget.collection, false))
.then(
(value) => {
@@ -191,6 +193,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
leadingIcon: Icons.adaptive.share,
menuItemColor: getEnteColorScheme(context).fillFaint,
onTap: () async {
+ // ignore: unawaited_futures
shareText(url);
},
isTopBorderRadiusRemoved: true,
@@ -216,6 +219,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
menuItemColor: getEnteColorScheme(context).fillFaint,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
routeToPage(
context,
ManageSharedLinkWidget(collection: widget.collection),
diff --git a/lib/ui/sharing/verify_identity_dialog.dart b/lib/ui/sharing/verify_identity_dialog.dart
index 3e50b3e0e3..eaa725635e 100644
--- a/lib/ui/sharing/verify_identity_dialog.dart
+++ b/lib/ui/sharing/verify_identity_dialog.dart
@@ -79,6 +79,7 @@ class _VerifyIdentifyDialogState extends State<VerifyIdentifyDialog> {
labelText: S.of(context).sendInvite,
isInAlert: true,
onTap: () async {
+ // ignore: unawaited_futures
shareText(
S.of(context).shareTextRecommendUsingEnte,
);
@@ -167,6 +168,7 @@ class _VerifyIdentifyDialogState extends State<VerifyIdentifyDialog> {
await Clipboard.setData(
ClipboardData(text: verificationID),
);
+ // ignore: unawaited_futures
shareText(
widget.self
? S.of(context).shareMyVerificationID(verificationID)
diff --git a/lib/ui/tabs/home_widget.dart b/lib/ui/tabs/home_widget.dart
index e2ccdee873..1096821a86 100644
--- a/lib/ui/tabs/home_widget.dart
+++ b/lib/ui/tabs/home_widget.dart
@@ -343,7 +343,7 @@ class _HomeWidgetState extends State<HomeWidget> {
return false;
}
if (Platform.isAndroid && action == IntentAction.main) {
- MoveToBackground.moveTaskToBack();
+ unawaited(MoveToBackground.moveTaskToBack());
return false;
} else {
return true;
@@ -570,6 +570,7 @@ class _HomeWidgetState extends State<HomeWidget> {
.getCollectionByID(int.parse(collectionID))!;
final thumbnail =
await CollectionsService.instance.getCover(collection);
+ // ignore: unawaited_futures
routeToPage(
context,
CollectionPage(
diff --git a/lib/ui/tabs/shared/empty_state.dart b/lib/ui/tabs/shared/empty_state.dart
index 9196a52c9a..d466e0aa07 100644
--- a/lib/ui/tabs/shared/empty_state.dart
+++ b/lib/ui/tabs/shared/empty_state.dart
@@ -92,6 +92,7 @@ class SharedEmptyStateWidget extends StatelessWidget {
labelText: S.of(context).inviteYourFriends,
icon: Icons.ios_share_outlined,
onTap: () async {
+ // ignore: unawaited_futures
shareText(S.of(context).shareTextRecommendUsingEnte);
},
),
@@ -188,6 +189,7 @@ class IncomingAlbumEmptyState extends StatelessWidget {
labelText: S.of(context).inviteYourFriends,
icon: Icons.ios_share_outlined,
onTap: () async {
+ // ignore: unawaited_futures
shareText(S.of(context).shareTextRecommendUsingEnte);
},
),
diff --git a/lib/ui/tabs/shared/quick_link_album_item.dart b/lib/ui/tabs/shared/quick_link_album_item.dart
index 0e7e233bec..70ed4d3dc7 100644
--- a/lib/ui/tabs/shared/quick_link_album_item.dart
+++ b/lib/ui/tabs/shared/quick_link_album_item.dart
@@ -122,6 +122,7 @@ class QuickLinkAlbumItem extends StatelessWidget {
),
tagPrefix: heroTagPrefix,
);
+ // ignore: unawaited_futures
routeToPage(context, page);
},
);
diff --git a/lib/ui/tabs/shared_collections_tab.dart b/lib/ui/tabs/shared_collections_tab.dart
index d937fa7161..450d3062ca 100644
--- a/lib/ui/tabs/shared_collections_tab.dart
+++ b/lib/ui/tabs/shared_collections_tab.dart
@@ -255,6 +255,7 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
labelText: S.of(context).inviteYourFriendsToEnte,
icon: Icons.ios_share_outlined,
onTap: () async {
+ // ignore: unawaited_futures
shareText(
S.of(context).shareTextRecommendUsingEnte,
);
diff --git a/lib/ui/tools/editor/image_editor_page.dart b/lib/ui/tools/editor/image_editor_page.dart
index fee597b2f5..ca36db002a 100644
--- a/lib/ui/tools/editor/image_editor_page.dart
+++ b/lib/ui/tools/editor/image_editor_page.dart
@@ -1,3 +1,4 @@
+import "dart:async";
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
@@ -349,7 +350,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
".JPEG";
//Disabling notifications for assets changing to insert the file into
//files db before triggering a sync.
- PhotoManager.stopChangeNotify();
+ await PhotoManager.stopChangeNotify();
final AssetEntity? newAsset =
await (PhotoManager.editor.saveImage(result, title: fileName));
final newFile = await ente.EnteFile.fromAsset(
@@ -372,7 +373,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
}
newFile.generatedID = await FilesDB.instance.insert(newFile);
Bus.instance.fire(LocalPhotosUpdatedEvent([newFile], source: "editSave"));
- SyncService.instance.sync();
+ unawaited(SyncService.instance.sync());
showShortToast(context, S.of(context).editsSaved);
_logger.info("Original file " + widget.originalFile.toString());
_logger.info("Saved edits to file " + newFile.toString());
@@ -403,7 +404,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
showToast(context, S.of(context).oopsCouldNotSaveEdits);
_logger.severe(e, s);
} finally {
- PhotoManager.startChangeNotify();
+ await PhotoManager.startChangeNotify();
}
await dialog.hide();
}
diff --git a/lib/ui/tools/lock_screen.dart b/lib/ui/tools/lock_screen.dart
index 6b34fda4f5..f5f0696a3c 100644
--- a/lib/ui/tools/lock_screen.dart
+++ b/lib/ui/tools/lock_screen.dart
@@ -56,6 +56,7 @@ class _LockScreenState extends State<LockScreen> with WidgetsBindingObserver {
text: context.l10n.unlock,
iconData: Icons.lock_open_outlined,
onTap: () async {
+ // ignore: unawaited_futures
_showLockScreen(source: "tapUnlock");
},
),
@@ -72,7 +73,7 @@ class _LockScreenState extends State<LockScreen> with WidgetsBindingObserver {
if (Platform.isAndroid) {
return false;
}
- var shortestSide = MediaQuery.of(context).size.shortestSide;
+ final shortestSide = MediaQuery.of(context).size.shortestSide;
return shortestSide > 600 ? true : false;
}
diff --git a/lib/ui/viewer/file/detail_page.dart b/lib/ui/viewer/file/detail_page.dart
index 19e16f9ca9..46db449c58 100644
--- a/lib/ui/viewer/file/detail_page.dart
+++ b/lib/ui/viewer/file/detail_page.dart
@@ -324,7 +324,7 @@ class _DetailPageState extends State<DetailPage> {
? currentPageIndex
: currentPageIndex - 1;
if (_files!.isNotEmpty) {
- _pageController.animateToPage(
+ await _pageController.animateToPage(
targetPageIndex,
duration: const Duration(milliseconds: 200),
curve: Curves.easeInOut,
@@ -340,6 +340,7 @@ class _DetailPageState extends State<DetailPage> {
UnauthorizedEditError(),
StackTrace.current,
);
+ // ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).sorry,
diff --git a/lib/ui/viewer/file/file_app_bar.dart b/lib/ui/viewer/file/file_app_bar.dart
index 28a83ca663..0921c88e47 100644
--- a/lib/ui/viewer/file/file_app_bar.dart
+++ b/lib/ui/viewer/file/file_app_bar.dart
@@ -321,7 +321,7 @@ class FileAppBarState extends State<FileAppBar> {
final File? fileToSave = await getFile(file);
//Disabling notifications for assets changing to insert the file into
//files db before triggering a sync.
- PhotoManager.stopChangeNotify();
+ await PhotoManager.stopChangeNotify();
if (type == FileType.image) {
savedAsset = await PhotoManager.editor
.saveImageWithPath(fileToSave!.path, title: file.title!);
@@ -364,7 +364,7 @@ class FileAppBarState extends State<FileAppBar> {
await dialog.hide();
await showGenericErrorDialog(context: context, error: e);
} finally {
- PhotoManager.startChangeNotify();
+ await PhotoManager.startChangeNotify();
LocalSyncService.instance.checkAndSync().ignore();
}
}
@@ -419,9 +419,9 @@ class FileAppBarState extends State<FileAppBar> {
if (result == false) {
showShortToast(context, S.of(context).somethingWentWrong);
}
- dialog.hide();
+ await dialog.hide();
} catch (e) {
- dialog.hide();
+ await dialog.hide();
_logger.severe("Failed to use as", e);
await showGenericErrorDialog(context: context, error: e);
}
diff --git a/lib/ui/viewer/file/thumbnail_widget.dart b/lib/ui/viewer/file/thumbnail_widget.dart
index 93820d4ae8..272dc73d3e 100644
--- a/lib/ui/viewer/file/thumbnail_widget.dart
+++ b/lib/ui/viewer/file/thumbnail_widget.dart
@@ -211,7 +211,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
}
Future _getThumbnailFromDisk() async {
- getThumbnailFromLocal(
+ return getThumbnailFromLocal(
widget.file,
size: widget.thumbnailSize,
).then((thumbData) async {
@@ -220,15 +220,15 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
_logger.fine("Removing localID reference for " + widget.file.tag);
widget.file.localID = null;
if (widget.file.isTrash) {
- TrashDB.instance.update(widget.file as TrashFile);
+ await TrashDB.instance.update(widget.file as TrashFile);
} else {
- FilesDB.instance.update(widget.file);
+ await FilesDB.instance.update(widget.file);
}
_loadNetworkImage();
} else {
if (await doesLocalFileExist(widget.file) == false) {
_logger.info("Deleting file " + widget.file.tag);
- FilesDB.instance.deleteLocalFile(widget.file);
+ await FilesDB.instance.deleteLocalFile(widget.file);
Bus.instance.fire(
LocalPhotosUpdatedEvent(
[widget.file],
diff --git a/lib/ui/viewer/file/video_widget.dart b/lib/ui/viewer/file/video_widget.dart
index 590f0dcb5d..c9c07df5ce 100644
--- a/lib/ui/viewer/file/video_widget.dart
+++ b/lib/ui/viewer/file/video_widget.dart
@@ -68,6 +68,7 @@ class _VideoWidgetState extends State<VideoWidget> {
_loadNetworkVideo();
}
} else {
+ // ignore: unawaited_futures
asset.getMediaUrl().then((url) {
_setVideoPlayerController(url: url);
});
diff --git a/lib/ui/viewer/file/video_widget_new.dart b/lib/ui/viewer/file/video_widget_new.dart
index 97659d7dfd..0968f9577d 100644
--- a/lib/ui/viewer/file/video_widget_new.dart
+++ b/lib/ui/viewer/file/video_widget_new.dart
@@ -68,6 +68,7 @@ class _VideoWidgetNewState extends State<VideoWidgetNew>
_loadNetworkVideo();
}
} else {
+ // ignore: unawaited_futures
asset.getMediaUrl().then((url) {
_setVideoController(
url ??
diff --git a/lib/ui/viewer/file_details/upload_icon_widget.dart b/lib/ui/viewer/file_details/upload_icon_widget.dart
index de8fffd20f..1d724d4b75 100644
--- a/lib/ui/viewer/file_details/upload_icon_widget.dart
+++ b/lib/ui/viewer/file_details/upload_icon_widget.dart
@@ -123,7 +123,7 @@ class _UpdateIconWidgetState extends State<UploadIconWidget> {
widget.file.collectionID = (await CollectionsService.instance
.getUncategorizedCollection())
.id;
- FilesDB.instance.insert(widget.file);
+ await FilesDB.instance.insert(widget.file);
}
RemoteSyncService.instance.sync().ignore();
if (mounted) {
diff --git a/lib/ui/viewer/gallery/component/gallery_file_widget.dart b/lib/ui/viewer/gallery/component/gallery_file_widget.dart
index 425fe0ab34..142f4427c4 100644
--- a/lib/ui/viewer/gallery/component/gallery_file_widget.dart
+++ b/lib/ui/viewer/gallery/component/gallery_file_widget.dart
@@ -124,7 +124,7 @@ class GalleryFileWidget extends StatelessWidget {
if (AppLifecycleService.instance.mediaExtensionAction.action ==
IntentAction.pick) {
final ioFile = await getFile(file);
- MediaExtension().setResult("file://${ioFile!.path}");
+ await MediaExtension().setResult("file://${ioFile!.path}");
} else {
_routeToDetailPage(file, context);
}
@@ -148,7 +148,7 @@ class GalleryFileWidget extends StatelessWidget {
if (AppLifecycleService.instance.mediaExtensionAction.action ==
IntentAction.pick) {
final ioFile = await getFile(file);
- MediaExtension().setResult("file://${ioFile!.path}");
+ await MediaExtension().setResult("file://${ioFile!.path}");
} else {
_routeToDetailPage(file, context);
}
diff --git a/lib/ui/viewer/gallery/device_folder_page.dart b/lib/ui/viewer/gallery/device_folder_page.dart
index 0604050f41..42d7b80a61 100644
--- a/lib/ui/viewer/gallery/device_folder_page.dart
+++ b/lib/ui/viewer/gallery/device_folder_page.dart
@@ -253,6 +253,7 @@ class _ResetIgnoredFilesWidgetState extends State<ResetIgnoredFilesWidget> {
await _removeFilesFromIgnoredFiles(
widget.filesInDeviceCollection,
);
+ // ignore: unawaited_futures
RemoteSyncService.instance.sync(silently: true).then((value) {
if (mounted) {
widget.parentSetState.call();
diff --git a/lib/utils/delete_file_util.dart b/lib/utils/delete_file_util.dart
index bd5f76308a..545ea9c27a 100644
--- a/lib/utils/delete_file_util.dart
+++ b/lib/utils/delete_file_util.dart
@@ -133,6 +133,7 @@ Future<void> deleteFilesFromEverywhere(
}
}
if (uploadedFilesToBeTrashed.isNotEmpty) {
+ // ignore: unawaited_futures
RemoteSyncService.instance.sync(silently: true);
}
}
@@ -183,7 +184,9 @@ Future<void> deleteFilesFromRemoteOnly(
source: "deleteFromRemoteOnly",
),
);
+ // ignore: unawaited_futures
SyncService.instance.sync();
+ // ignore: unawaited_futures
RemoteSyncService.instance.sync(silently: true);
}
@@ -232,7 +235,7 @@ Future<void> deleteFilesOnDeviceOnly(
alreadyDeletedIDs.contains(file.localID)) {
deletedFiles.add(file);
file.localID = null;
- FilesDB.instance.update(file);
+ await FilesDB.instance.update(file);
}
}
if (deletedFiles.isNotEmpty || alreadyDeletedIDs.isNotEmpty) {
@@ -411,6 +414,7 @@ Future<List<String>> deleteLocalFilesInBatches(
"Deleting " + localIDs.length.toString() + " backed up files...",
key: dialogKey,
);
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (context) {
diff --git a/lib/utils/email_util.dart b/lib/utils/email_util.dart
index 6aca4aea0b..f07d37b1c7 100644
--- a/lib/utils/email_util.dart
+++ b/lib/utils/email_util.dart
@@ -42,6 +42,7 @@ Future<void> sendLogs(
String? subject,
String? body,
}) async {
+ // ignore: unawaited_futures
showDialogWidget(
context: context,
title: S.of(context).reportABug,
@@ -68,6 +69,7 @@ Future<void> sendLogs(
labelText: S.of(context).viewLogs,
buttonAction: ButtonAction.second,
onTap: () async {
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
@@ -130,7 +132,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;