Fix all await warnings

This commit is contained in:
vishnukvmd 2023-12-21 13:04:06 +05:30
parent 84aa9b88d2
commit 68d504850e
56 changed files with 173 additions and 64 deletions

View file

@ -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,
);

View file

@ -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() {

View file

@ -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) {

View file

@ -97,6 +97,7 @@ class ArchivedCollectionsButton extends StatelessWidget {
),
),
onPressed: () async {
// ignore: unawaited_futures
routeToPage(
context,
ArchivePage(),

View file

@ -78,6 +78,7 @@ class HiddenCollectionsButtonWidget extends StatelessWidget {
S.of(context).authToViewYourHiddenFiles,
);
if (hasAuthenticated) {
// ignore: unawaited_futures
routeToPage(
context,
const HiddenPage(),

View file

@ -101,6 +101,7 @@ class UnCategorizedCollections extends StatelessWidget {
),
onPressed: () async {
if (collection != null) {
// ignore: unawaited_futures
routeToPage(
context,
UnCategorizedPage(collection),

View file

@ -45,7 +45,7 @@ class _CollectionListPageState extends State<CollectionListPage> {
collections = widget.collections;
_collectionUpdatesSubscription =
Bus.instance.on<CollectionUpdatedEvent>().listen((event) async {
refreshCollections();
unawaited(refreshCollections());
});
}

View file

@ -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)),

View file

@ -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]

View file

@ -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,

View file

@ -190,7 +190,7 @@ class ExtentsPageView extends StatefulWidget {
/// }
/// ```
/// {@end-tool}
ExtentsPageView.custom({
const ExtentsPageView.custom({
Key? key,
this.scrollDirection = Axis.horizontal,
this.reverse = false,

View file

@ -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,

View file

@ -92,6 +92,7 @@ class CodeSuccessScreen extends StatelessWidget {
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
onTap: () async {
// ignore: unawaited_futures
routeToPage(
context,
StorageDetailsScreen(referralView, userDetails),

View file

@ -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),

View file

@ -119,7 +119,7 @@ class GrantPermissionsWidget extends StatelessWidget {
),
],
);
// ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {

View file

@ -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) {

View file

@ -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(

View file

@ -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(

View file

@ -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();
}
});

View file

@ -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,
),
),
),

View file

@ -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),
),

View file

@ -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,

View file

@ -277,6 +277,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
singleBorderRadius: 4,
alignCaptionedTextToLeft: true,
onTap: () async {
// ignore: unawaited_futures
_billingService.launchFamilyPortal(context, _userDetails);
},
),

View file

@ -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,

View file

@ -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) {

View file

@ -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/");
},
),

View file

@ -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());
},
),

View file

@ -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) {

View file

@ -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);

View file

@ -100,6 +100,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
}
if (status.localIDs.isEmpty) {
// ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).allClear,

View file

@ -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);
}

View file

@ -99,6 +99,7 @@ class SocialsMenuItemWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
// ignore: unawaited_futures
launchUrlString(
url,
mode: launchInExternalApp

View file

@ -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) {

View file

@ -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,

View file

@ -100,6 +100,7 @@ class SettingsPage extends StatelessWidget {
type: NotificationType.goldenBanner,
onTap: () async {
StorageBonusService.instance.markStorageBonusAsDone();
// ignore: unawaited_futures
routeToPage(context, const ReferralScreen());
},
),

View file

@ -219,6 +219,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
}
final emailToAdd =
selectedEmail == '' ? _email : selectedEmail;
// ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {

View file

@ -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,

View file

@ -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,

View file

@ -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),

View file

@ -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)

View file

@ -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(

View file

@ -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);
},
),

View file

@ -122,6 +122,7 @@ class QuickLinkAlbumItem extends StatelessWidget {
),
tagPrefix: heroTagPrefix,
);
// ignore: unawaited_futures
routeToPage(context, page);
},
);

View file

@ -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,
);

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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,

View file

@ -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);
}

View file

@ -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],

View file

@ -68,6 +68,7 @@ class _VideoWidgetState extends State<VideoWidget> {
_loadNetworkVideo();
}
} else {
// ignore: unawaited_futures
asset.getMediaUrl().then((url) {
_setVideoPlayerController(url: url);
});

View file

@ -68,6 +68,7 @@ class _VideoWidgetNewState extends State<VideoWidgetNew>
_loadNetworkVideo();
}
} else {
// ignore: unawaited_futures
asset.getMediaUrl().then((url) {
_setVideoController(
url ??

View file

@ -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) {

View file

@ -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);
}

View file

@ -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();

View file

@ -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) {

View file

@ -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;