Browse Source

Replace happy case toasts with shortToast

Neeraj Gupta 2 years ago
parent
commit
173a3bcd07

+ 3 - 3
lib/services/user_service.dart

@@ -341,7 +341,7 @@ class UserService {
       );
       await dialog.hide();
       if (response != null && response.statusCode == 200) {
-        showToast(context, "Email changed to " + email);
+        showShortToast(context, "Email changed to " + email);
         await setEmail(email);
         Navigator.of(context).popUntil((route) => route.isFirst);
         Bus.instance.fire(UserDetailsChangedEvent());
@@ -441,7 +441,7 @@ class UserService {
       );
       await dialog.hide();
       if (response != null && response.statusCode == 200) {
-        showToast(context, "Authentication successful!");
+        showShortToast(context, "Authentication successful!");
         await _saveConfiguration(response);
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
@@ -712,7 +712,7 @@ class UserService {
       await dialog.hide();
       Bus.instance.fire(TwoFactorStatusChangeEvent(false));
       unawaited(
-        showToast(
+        showShortToast(
           context,
           "Two-factor authentication has been disabled",
         ),

+ 1 - 1
lib/ui/account/recovery_key_page.dart

@@ -134,7 +134,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
                                   await Clipboard.setData(
                                     ClipboardData(text: recoveryKey),
                                   );
-                                  showToast(
+                                  showShortToast(
                                     context,
                                     "Recovery key copied to clipboard",
                                   );

+ 1 - 1
lib/ui/account/recovery_page.dart

@@ -53,7 +53,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
           try {
             await Configuration.instance.recover(_recoveryKey.text.trim());
             await dialog.hide();
-            showToast(context, "Recovery successful!");
+            showShortToast(context, "Recovery successful!");
             Navigator.of(context).pushReplacement(
               MaterialPageRoute(
                 builder: (BuildContext context) {

+ 1 - 1
lib/ui/account/two_factor_setup_page.dart

@@ -139,7 +139,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
     return GestureDetector(
       onTap: () async {
         await Clipboard.setData(ClipboardData(text: widget.secretCode));
-        showToast(context, "Code copied to clipboard");
+        showShortToast(context, "Code copied to clipboard");
       },
       child: Column(
         mainAxisAlignment: MainAxisAlignment.center,

+ 1 - 1
lib/ui/actions/collection/collection_sharing_actions.dart

@@ -137,7 +137,7 @@ class CollectionActions {
           await CollectionsService.instance.unshare(collection.id, user.email);
       collection.updateSharees(newSharees);
       await dialog.hide();
-      showToast(context, "Stopped sharing with " + user.email + ".");
+      showShortToast(context, "Stopped sharing with " + user.email + ".");
       return true;
     } catch (e, s) {
       Logger("EmailItemWidget").severe(e, s);

+ 1 - 1
lib/ui/payment/stripe_subscription_page.dart

@@ -380,7 +380,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
           : await _billingService.cancelStripeSubscription();
       await _fetchSub();
     } catch (e) {
-      showToast(
+      showShortToast(
         context,
         isRenewCancelled ? 'failed to renew' : 'failed to cancel',
       );

+ 1 - 1
lib/ui/payment/subscription_page.dart

@@ -85,7 +85,7 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
                 text = "Your plan was successfully downgraded";
               }
             }
-            showToast(context, text);
+            showShortToast(context, text);
             _currentSubscription = newSubscription;
             _hasActiveSubscription = _currentSubscription.isValid();
             setState(() {});

+ 2 - 1
lib/ui/settings/about_section_widget.dart

@@ -79,7 +79,8 @@ class AboutSectionWidget extends StatelessWidget {
                           barrierColor: Colors.black.withOpacity(0.85),
                         );
                       } else {
-                        showToast(context, "You are on the latest version");
+                        showShortToast(
+                            context, "You are on the latest version");
                       }
                     },
                   ),

+ 1 - 1
lib/ui/settings/backup_section_widget.dart

@@ -240,7 +240,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
             "Ok",
           ),
           onPressed: () {
-            showToast(
+            showShortToast(
               context,
               "Also empty your \"Trash\" to claim the freed up space",
             );

+ 2 - 2
lib/ui/settings/debug_section_widget.dart

@@ -52,7 +52,7 @@ class DebugSectionWidget extends StatelessWidget {
           trailingIconIsMuted: true,
           onTap: () async {
             await LocalSyncService.instance.resetLocalSync();
-            showToast(context, "Done");
+            showShortToast(context, "Done");
           },
         ),
         sectionOptionSpacing,
@@ -66,7 +66,7 @@ class DebugSectionWidget extends StatelessWidget {
           onTap: () async {
             await IgnoredFilesService.instance.reset();
             SyncService.instance.sync();
-            showToast(context, "Done");
+            showShortToast(context, "Done");
           },
         ),
         sectionOptionSpacing,

+ 1 - 1
lib/ui/sharing/manage_links_widget.dart

@@ -491,7 +491,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
     try {
       await CollectionsService.instance.updateShareUrl(widget.collection, prop);
       await dialog.hide();
-      showToast(context, "Album updated");
+      showShortToast(context, "Album updated");
     } catch (e) {
       await dialog.hide();
       await showGenericErrorDialog(context);

+ 1 - 1
lib/ui/sharing/share_collection_page.dart

@@ -145,7 +145,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
               pressedColor: getEnteColorScheme(context).fillFaint,
               onTap: () async {
                 await Clipboard.setData(ClipboardData(text: url));
-                showToast(context, "Link copied to clipboard");
+                showShortToast(context, "Link copied to clipboard");
               },
               isBottomBorderRadiusRemoved: true,
             ),

+ 1 - 1
lib/ui/tools/editor/image_editor_page.dart

@@ -362,7 +362,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
       await LocalSyncService.instance.trackEditedFile(newFile);
       Bus.instance.fire(LocalPhotosUpdatedEvent([newFile], source: "editSave"));
       SyncService.instance.sync();
-      showToast(context, "Edits saved");
+      showShortToast(context, "Edits saved");
       _logger.info("Original file " + widget.originalFile.toString());
       _logger.info("Saved edits to file " + newFile.toString());
       final existingFiles = widget.detailPageConfig.files;

+ 1 - 1
lib/ui/viewer/file/fading_app_bar.dart

@@ -364,7 +364,7 @@ class FadingAppBarState extends State<FadingAppBar> {
           isDestructiveAction: true,
           onPressed: () async {
             await deleteFilesOnDeviceOnly(context, [file]);
-            showToast(context, "File deleted from device");
+            showShortToast(context, "File deleted from device");
             Navigator.of(context, rootNavigator: true).pop();
             // TODO: Fix behavior when inside a device folder
           },

+ 1 - 2
lib/ui/viewer/file/zoomable_live_image.dart

@@ -4,7 +4,6 @@ import 'dart:io' as io;
 
 import 'package:chewie/chewie.dart';
 import 'package:flutter/material.dart';
-import 'package:fluttertoast/fluttertoast.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/constants.dart';
 import 'package:photos/models/file.dart';
@@ -122,7 +121,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
     }
     _isLoadingVideoPlayer = true;
     if (_file.isRemoteFile && !(await isFileCached(_file, liveVideo: true))) {
-      showToast(context, "Downloading...", toastLength: Toast.LENGTH_LONG);
+      showShortToast(context, "Downloading...");
     }
 
     var videoFile = await getFile(widget.file, liveVideo: true)

+ 3 - 3
lib/utils/magic_util.dart

@@ -91,7 +91,7 @@ Future<bool> editTime(
     );
     return true;
   } catch (e) {
-    showToast(context, 'something went wrong');
+    showShortToast(context, 'something went wrong');
     return false;
   }
 }
@@ -124,7 +124,7 @@ Future<bool> editFilename(
     );
     return true;
   } catch (e) {
-    showToast(context, 'Something went wrong');
+    showShortToast(context, 'Something went wrong');
     return false;
   }
 }
@@ -145,7 +145,7 @@ Future<bool> editFileCaption(
     return true;
   } catch (e) {
     if (context != null) {
-      showToast(context, "Something went wrong");
+      showShortToast(context, "Something went wrong");
     }
     return false;
   }