diff --git a/lib/components/dialogs/simple_dialogs.dart b/lib/components/dialogs/simple_dialogs.dart index ffeca4f7..5948d877 100644 --- a/lib/components/dialogs/simple_dialogs.dart +++ b/lib/components/dialogs/simple_dialogs.dart @@ -1,4 +1,5 @@ -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -169,10 +170,10 @@ class SimpleDialogs { onAdditionalAuth != null) { return await tryRequestWithErrorToast(onAdditionalAuth(exception)); } else { - BotToast.showText(text: exception.errorMessage); + await Flushbar(message: exception.errorMessage).show(context); } } catch (exception) { - BotToast.showText(text: exception.toString()); + await Flushbar(message: exception.toString()).show(context); return false; } } diff --git a/lib/components/encryption_button.dart b/lib/components/encryption_button.dart index acd7cb9d..b88ab044 100644 --- a/lib/components/encryption_button.dart +++ b/lib/components/encryption_button.dart @@ -1,6 +1,7 @@ import 'dart:async'; -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/utils/app_route.dart'; import 'package:fluffychat/views/chat_encryption_settings.dart'; @@ -22,7 +23,8 @@ class _EncryptionButtonState extends State { void _enableEncryptionAction() async { if (widget.room.encrypted) { - BotToast.showText(text: L10n.of(context).warningEncryptionInBeta); + await Flushbar(message: L10n.of(context).warningEncryptionInBeta) + .show(context); await Navigator.of(context).push( AppRoute.defaultRoute( context, @@ -32,7 +34,8 @@ class _EncryptionButtonState extends State { return; } if (!widget.room.client.encryptionEnabled) { - BotToast.showText(text: L10n.of(context).needPantalaimonWarning); + await Flushbar(message: L10n.of(context).needPantalaimonWarning) + .show(context); return; } if (await SimpleDialogs(context).askConfirmation( diff --git a/lib/components/list_items/chat_list_item.dart b/lib/components/list_items/chat_list_item.dart index 1111fe5a..5b7fd3a7 100644 --- a/lib/components/list_items/chat_list_item.dart +++ b/lib/components/list_items/chat_list_item.dart @@ -1,4 +1,5 @@ -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/utils/matrix_locals.dart'; import 'package:fluffychat/views/chat.dart'; @@ -41,7 +42,8 @@ class ChatListItem extends StatelessWidget { } if (room.membership == Membership.ban) { - BotToast.showText(text: L10n.of(context).youHaveBeenBannedFromThisChat); + await Flushbar(message: L10n.of(context).youHaveBeenBannedFromThisChat) + .show(context); return; } diff --git a/lib/main.dart b/lib/main.dart index bdab3bb1..ad4524b4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:io'; -import 'package:bot_toast/bot_toast.dart'; import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/views/homeserver_picker.dart'; import 'package:flutter/foundation.dart'; @@ -51,8 +50,6 @@ class App extends StatelessWidget { child: Builder( builder: (BuildContext context) => MaterialApp( title: 'FluffyChat', - builder: BotToastInit(), - navigatorObservers: [BotToastNavigatorObserver()], theme: ThemeSwitcherWidget.of(context).themeData, localizationsDelegates: L10n.localizationsDelegates, supportedLocales: L10n.supportedLocales, diff --git a/lib/utils/firebase_controller.dart b/lib/utils/firebase_controller.dart index 9c20f03e..9835776e 100644 --- a/lib/utils/firebase_controller.dart +++ b/lib/utils/firebase_controller.dart @@ -1,7 +1,8 @@ import 'dart:convert'; import 'dart:io'; -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:fluffychat/components/matrix.dart'; @@ -46,10 +47,10 @@ abstract class FirebaseController { await matrix.store.getItem('chat.fluffy.show_no_google'); final configOptionMissing = storeItem == null || storeItem.isEmpty; if (configOptionMissing || (!configOptionMissing && storeItem == '1')) { - BotToast.showText( - text: L10n.of(context).noGoogleServicesWarning, + await Flushbar( + message: L10n.of(context).noGoogleServicesWarning, duration: Duration(seconds: 15), - ); + ).show(context); if (configOptionMissing) { await matrix.store.setItem('chat.fluffy.show_no_google', '0'); } @@ -120,7 +121,7 @@ abstract class FirebaseController { ), (r) => r.isFirst); } catch (_) { - BotToast.showText(text: 'Failed to open chat...'); + await Flushbar(message: 'Failed to open chat...').show(context); debugPrint(_); } }; diff --git a/lib/utils/sentry_controller.dart b/lib/utils/sentry_controller.dart index 1557262d..1fd7e876 100644 --- a/lib/utils/sentry_controller.dart +++ b/lib/utils/sentry_controller.dart @@ -1,4 +1,5 @@ -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:fluffychat/components/dialogs/simple_dialogs.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -15,7 +16,8 @@ abstract class SentryController { ); await storage.ready; await storage.setItem('sentry', enableSentry); - BotToast.showText(text: L10n.of(context).changesHaveBeenSaved); + await Flushbar(message: L10n.of(context).changesHaveBeenSaved) + .show(context); return; } diff --git a/lib/views/chat_details.dart b/lib/views/chat_details.dart index fd4e423d..21f8194f 100644 --- a/lib/views/chat_details.dart +++ b/lib/views/chat_details.dart @@ -1,4 +1,5 @@ -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/matrix_api.dart'; import 'package:fluffychat/components/adaptive_page_layout.dart'; @@ -46,7 +47,8 @@ class _ChatDetailsState extends State { widget.room.setName(displayname), ); if (success != false) { - BotToast.showText(text: L10n.of(context).displaynameHasBeenChanged); + await Flushbar(message: L10n.of(context).displaynameHasBeenChanged) + .show(context); } } @@ -99,7 +101,8 @@ class _ChatDetailsState extends State { widget.room.setDescription(displayname), ); if (success != false) { - BotToast.showText(text: L10n.of(context).groupDescriptionHasBeenChanged); + await Flushbar(message: L10n.of(context).groupDescriptionHasBeenChanged) + .show(context); } } @@ -119,7 +122,8 @@ class _ChatDetailsState extends State { ), ); if (success != false) { - BotToast.showText(text: L10n.of(context).avatarHasBeenChanged); + await Flushbar(message: L10n.of(context).avatarHasBeenChanged) + .show(context); } } @@ -170,8 +174,9 @@ class _ChatDetailsState extends State { Clipboard.setData( ClipboardData(text: widget.room.canonicalAlias), ); - BotToast.showText( - text: L10n.of(context).copiedToClipboard); + Flushbar( + message: L10n.of(context).copiedToClipboard) + .show(context); }, ), ChatSettingsPopupMenu(widget.room, false) diff --git a/lib/views/invitation_selection.dart b/lib/views/invitation_selection.dart index 69525207..24213df6 100644 --- a/lib/views/invitation_selection.dart +++ b/lib/views/invitation_selection.dart @@ -1,6 +1,7 @@ import 'dart:async'; -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/matrix_api.dart'; import 'package:fluffychat/components/adaptive_page_layout.dart'; @@ -60,7 +61,8 @@ class _InvitationSelectionState extends State { widget.room.invite(id), ); if (success != false) { - BotToast.showText(text: L10n.of(context).contactHasBeenInvitedToTheGroup); + await Flushbar(message: L10n.of(context).contactHasBeenInvitedToTheGroup) + .show(context); } } diff --git a/lib/views/settings.dart b/lib/views/settings.dart index 20bee602..d1906165 100644 --- a/lib/views/settings.dart +++ b/lib/views/settings.dart @@ -1,6 +1,7 @@ import 'dart:io'; -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/components/settings_themes.dart'; import 'package:fluffychat/config/app_config.dart'; @@ -72,7 +73,8 @@ class _SettingsState extends State { .client .changePassword(newPassword, oldPassword: oldPassword), ); - BotToast.showText(text: L10n.of(context).passwordHasBeenChanged); + await Flushbar(message: L10n.of(context).passwordHasBeenChanged) + .show(context); } void _deleteAccountAction(BuildContext context) async { diff --git a/lib/views/settings_emotes.dart b/lib/views/settings_emotes.dart index 1f088e1a..9c70823d 100644 --- a/lib/views/settings_emotes.dart +++ b/lib/views/settings_emotes.dart @@ -1,4 +1,5 @@ -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:cached_network_image/cached_network_image.dart'; import 'package:famedlysdk/famedlysdk.dart'; import 'package:flutter/foundation.dart'; @@ -447,7 +448,8 @@ class _EmoteImagePickerState extends State<_EmoteImagePicker> { ), onPressed: () async { if (kIsWeb) { - BotToast.showText(text: L10n.of(context).notSupportedInWeb); + await Flushbar(message: L10n.of(context).notSupportedInWeb) + .show(context); return; } var file = await MemoryFilePicker.getImage( diff --git a/lib/views/sign_up_password.dart b/lib/views/sign_up_password.dart index 31a3f788..3ec31fa0 100644 --- a/lib/views/sign_up_password.dart +++ b/lib/views/sign_up_password.dart @@ -1,6 +1,7 @@ import 'dart:math'; -import 'package:bot_toast/bot_toast.dart'; +import 'package:flushbar/flushbar.dart'; + import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/components/matrix.dart'; import 'package:fluffychat/utils/app_route.dart'; @@ -95,7 +96,8 @@ class _SignUpPasswordState extends State { await matrix.client .setDisplayname(matrix.client.userID, widget.displayname); } catch (exception) { - BotToast.showText(text: L10n.of(context).couldNotSetDisplayname); + await Flushbar(message: L10n.of(context).couldNotSetDisplayname) + .show(context); } if (widget.avatar != null) { try { @@ -106,7 +108,8 @@ class _SignUpPasswordState extends State { ), ); } catch (exception) { - BotToast.showText(text: L10n.of(context).couldNotSetAvatar); + await Flushbar(message: L10n.of(context).couldNotSetAvatar) + .show(context); } } await Navigator.of(context).pushAndRemoveUntil( diff --git a/pubspec.lock b/pubspec.lock index 2d4e5781..382614e4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -64,13 +64,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0-nullsafety.1" - bot_toast: - dependency: "direct main" - description: - name: bot_toast - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.4" cached_network_image: dependency: "direct main" description: @@ -248,6 +241,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.0.2" + flushbar: + dependency: "direct main" + description: + name: flushbar + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.4" flutter: dependency: "direct main" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 3ce587ec..d376082f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,7 +49,7 @@ dependencies: flutter_sound: ^2.1.1 open_file: ^3.0.1 mime_type: ^0.3.0 - bot_toast: ^3.0.0 + flushbar: ^1.10.4 flutter_matrix_html: ^0.1.5 moor: ^3.3.1 sqlite3_flutter_libs: ^0.2.0