mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-16 17:09:31 +01:00
chore: Switch from bottoast to flushbar
This commit is contained in:
parent
e43e922557
commit
e2195935c0
@ -1,4 +1,4 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
@ -169,10 +169,12 @@ class SimpleDialogs {
|
||||
onAdditionalAuth != null) {
|
||||
return await tryRequestWithErrorToast(onAdditionalAuth(exception));
|
||||
} else {
|
||||
BotToast.showText(text: exception.errorMessage);
|
||||
await FlushbarHelper.createError(message: exception.errorMessage)
|
||||
.show(context);
|
||||
}
|
||||
} catch (exception) {
|
||||
BotToast.showText(text: exception.toString());
|
||||
await FlushbarHelper.createError(message: exception.toString())
|
||||
.show(context);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/views/chat_encryption_settings.dart';
|
||||
@ -22,7 +22,6 @@ class _EncryptionButtonState extends State<EncryptionButton> {
|
||||
|
||||
void _enableEncryptionAction() async {
|
||||
if (widget.room.encrypted) {
|
||||
BotToast.showText(text: L10n.of(context).warningEncryptionInBeta);
|
||||
await Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
context,
|
||||
@ -32,7 +31,9 @@ class _EncryptionButtonState extends State<EncryptionButton> {
|
||||
return;
|
||||
}
|
||||
if (!widget.room.client.encryptionEnabled) {
|
||||
BotToast.showText(text: L10n.of(context).needPantalaimonWarning);
|
||||
await FlushbarHelper.createInformation(
|
||||
message: L10n.of(context).needPantalaimonWarning)
|
||||
.show(context);
|
||||
return;
|
||||
}
|
||||
if (await SimpleDialogs(context).askConfirmation(
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:circular_check_box/circular_check_box.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/matrix_locals.dart';
|
||||
@ -43,7 +43,9 @@ class ChatListItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
if (room.membership == Membership.ban) {
|
||||
BotToast.showText(text: L10n.of(context).youHaveBeenBannedFromThisChat);
|
||||
await FlushbarHelper.createError(
|
||||
message: L10n.of(context).youHaveBeenBannedFromThisChat)
|
||||
.show(context);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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/utils/sentry_controller.dart';
|
||||
import 'package:fluffychat/views/homeserver_picker.dart';
|
||||
@ -37,8 +36,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,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
@ -46,10 +46,10 @@ abstract class FirebaseController {
|
||||
final storeItem = await matrix.store.getItem(SettingKeys.showNoGoogle);
|
||||
final configOptionMissing = storeItem == null || storeItem.isEmpty;
|
||||
if (configOptionMissing || (!configOptionMissing && storeItem == '1')) {
|
||||
BotToast.showText(
|
||||
text: L10n.of(context).noGoogleServicesWarning,
|
||||
await FlushbarHelper.createError(
|
||||
message: L10n.of(context).noGoogleServicesWarning,
|
||||
duration: Duration(seconds: 15),
|
||||
);
|
||||
).show(context);
|
||||
if (configOptionMissing) {
|
||||
await matrix.store.setItem(SettingKeys.showNoGoogle, '0');
|
||||
}
|
||||
@ -120,7 +120,8 @@ abstract class FirebaseController {
|
||||
),
|
||||
(r) => r.isFirst);
|
||||
} catch (_) {
|
||||
BotToast.showText(text: 'Failed to open chat...');
|
||||
await FlushbarHelper.createError(message: 'Failed to open chat...')
|
||||
.show(context);
|
||||
debugPrint(_);
|
||||
}
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -13,7 +13,9 @@ abstract class FluffyShare {
|
||||
await Clipboard.setData(
|
||||
ClipboardData(text: text),
|
||||
);
|
||||
BotToast.showText(text: L10n.of(context).copiedToClipboard);
|
||||
await FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).copiedToClipboard)
|
||||
.show(context);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -19,7 +19,9 @@ abstract class SentryController {
|
||||
);
|
||||
final storage = Store();
|
||||
await storage.setItem(SettingKeys.sentry, enableSentry.toString());
|
||||
BotToast.showText(text: L10n.of(context).changesHaveBeenSaved);
|
||||
await FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).changesHaveBeenSaved)
|
||||
.show(context);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:famedlysdk/matrix_api.dart';
|
||||
|
||||
@ -48,7 +48,9 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||
widget.room.setName(displayname),
|
||||
);
|
||||
if (success != false) {
|
||||
BotToast.showText(text: L10n.of(context).displaynameHasBeenChanged);
|
||||
await FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).displaynameHasBeenChanged)
|
||||
.show(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +103,9 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||
widget.room.setDescription(displayname),
|
||||
);
|
||||
if (success != false) {
|
||||
BotToast.showText(text: L10n.of(context).groupDescriptionHasBeenChanged);
|
||||
await FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).groupDescriptionHasBeenChanged)
|
||||
.show(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +137,9 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||
widget.room.setAvatar(file),
|
||||
);
|
||||
if (success != false) {
|
||||
BotToast.showText(text: L10n.of(context).avatarHasBeenChanged);
|
||||
await FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).avatarHasBeenChanged)
|
||||
.show(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,8 +190,9 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: widget.room.canonicalAlias),
|
||||
);
|
||||
BotToast.showText(
|
||||
text: L10n.of(context).copiedToClipboard);
|
||||
FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).copiedToClipboard)
|
||||
.show(context);
|
||||
},
|
||||
),
|
||||
ChatSettingsPopupMenu(widget.room, false)
|
||||
|
@ -5,6 +5,7 @@ import 'package:fluffychat/components/avatar.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
||||
import 'package:fluffychat/views/chat_list.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
@ -102,6 +103,16 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => FlushbarHelper.createInformation(
|
||||
message: L10n.of(context).warningEncryptionInBeta)
|
||||
.show(context),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final room = Matrix.of(context).client.getRoomById(widget.id);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:famedlysdk/matrix_api.dart';
|
||||
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
||||
@ -60,7 +60,9 @@ class _InvitationSelectionState extends State<InvitationSelection> {
|
||||
widget.room.invite(id),
|
||||
);
|
||||
if (success != false) {
|
||||
BotToast.showText(text: L10n.of(context).contactHasBeenInvitedToTheGroup);
|
||||
await FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).contactHasBeenInvitedToTheGroup)
|
||||
.show(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:file_picker_cross/file_picker_cross.dart';
|
||||
|
||||
@ -76,7 +76,9 @@ class _SettingsState extends State<Settings> {
|
||||
.client
|
||||
.changePassword(newPassword, oldPassword: oldPassword),
|
||||
);
|
||||
BotToast.showText(text: L10n.of(context).passwordHasBeenChanged);
|
||||
await FlushbarHelper.createSuccess(
|
||||
message: L10n.of(context).passwordHasBeenChanged)
|
||||
.show(context);
|
||||
}
|
||||
|
||||
void _deleteAccountAction(BuildContext context) async {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:file_picker_cross/file_picker_cross.dart';
|
||||
@ -449,7 +449,9 @@ class _EmoteImagePickerState extends State<_EmoteImagePicker> {
|
||||
),
|
||||
onPressed: () async {
|
||||
if (kIsWeb) {
|
||||
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||
await FlushbarHelper.createError(
|
||||
message: L10n.of(context).notSupportedInWeb)
|
||||
.show(context);
|
||||
return;
|
||||
}
|
||||
MatrixFile file;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
@ -95,13 +95,17 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
||||
await matrix.client
|
||||
.setDisplayname(matrix.client.userID, widget.displayname);
|
||||
} catch (exception) {
|
||||
BotToast.showText(text: L10n.of(context).couldNotSetDisplayname);
|
||||
await FlushbarHelper.createError(
|
||||
message: L10n.of(context).couldNotSetDisplayname)
|
||||
.show(context);
|
||||
}
|
||||
if (widget.avatar != null) {
|
||||
try {
|
||||
await matrix.client.setAvatar(widget.avatar);
|
||||
} catch (exception) {
|
||||
BotToast.showText(text: L10n.of(context).couldNotSetAvatar);
|
||||
await FlushbarHelper.createError(
|
||||
message: L10n.of(context).couldNotSetAvatar)
|
||||
.show(context);
|
||||
}
|
||||
}
|
||||
await Navigator.of(context).pushAndRemoveUntil(
|
||||
|
16
pubspec.lock
16
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:
|
||||
@ -290,6 +283,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "7.0.3"
|
||||
flushbar:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flushbar
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.4"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -1137,5 +1137,5 @@ packages:
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
sdks:
|
||||
dart: ">=2.10.2 <=2.11.0-161.0.dev"
|
||||
dart: ">=2.10.2 <2.11.0"
|
||||
flutter: ">=1.22.2 <2.0.0"
|
||||
|
@ -48,7 +48,7 @@ dependencies:
|
||||
flutter_sound: 2.1.1
|
||||
open_file: ^3.0.3
|
||||
mime_type: ^0.3.2
|
||||
bot_toast: ^3.0.4
|
||||
flushbar: ^1.10.4
|
||||
flutter_matrix_html: ^0.1.10
|
||||
moor: ^3.4.0
|
||||
sqlite3_flutter_libs: ^0.2.0
|
||||
|
Loading…
Reference in New Issue
Block a user