diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 7c251d585..605059b55 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -4181,5 +4181,13 @@ "changeTheCanonicalRoomAlias": "Change the main public chat address", "sendRoomNotifications": "Send a @room notifications", "changeTheDescriptionOfTheGroup": "Change the description of the chat", - "chatPermissionsDescription": "Define which power level is necessary for certain actions in this chat. The power levels 0, 50 and 100 are usually representing users, moderators and admins, but any gradation is possible." + "chatPermissionsDescription": "Define which power level is necessary for certain actions in this chat. The power levels 0, 50 and 100 are usually representing users, moderators and admins, but any gradation is possible.", + "updateInstalled": "🎉 Update {version} installed!", + "@updateInstalled": { + "type": "text", + "placeholders": { + "version": {} + } + }, + "changelog": "Changelog" } \ No newline at end of file diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index d8125169f..321d3c6c0 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -56,6 +56,8 @@ abstract class AppConfig { static const String supportUrl = 'https://www.pangeachat.com/faqs'; static const String termsOfServiceUrl = 'https://www.pangeachat.com/terms-of-service'; + // static const String changelogUrl = + // 'https://github.com/krille-chan/fluffychat/blob/main/CHANGELOG.md'; //Pangea# static final Uri newIssueUrl = Uri( scheme: 'https', diff --git a/lib/config/themes.dart b/lib/config/themes.dart index 90dfefe68..681078b5a 100644 --- a/lib/config/themes.dart +++ b/lib/config/themes.dart @@ -78,9 +78,6 @@ abstract class FluffyThemes { ? Typography.material2018().black.merge(fallbackTextTheme) : Typography.material2018().white.merge(fallbackTextTheme) : null, - snackBarTheme: const SnackBarThemeData( - behavior: SnackBarBehavior.floating, - ), dividerColor: brightness == Brightness.light ? Colors.blueGrey.shade50 : Colors.blueGrey.shade900, diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index c972c0b14..06073f47f 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -15,6 +15,7 @@ import 'package:fluffychat/pangea/widgets/subscription/subscription_snackbar.dar import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/platform_infos.dart'; +import 'package:fluffychat/utils/show_update_snackbar.dart'; import 'package:fluffychat/utils/tor_stub.dart' if (dart.library.html) 'package:tor_detector_web/tor_detector_web.dart'; import 'package:fluffychat/widgets/avatar.dart'; @@ -541,6 +542,7 @@ class ChatListController extends State searchServer = Matrix.of(context).store.getString(_serverStoreNamespace); Matrix.of(context).backgroundPush?.setupPush(); + UpdateNotifier.showUpdateSnackBar(context); } // Workaround for system UI overlay style not applied on app start diff --git a/lib/pages/chat_list/client_chooser_button.dart b/lib/pages/chat_list/client_chooser_button.dart index 801259095..b4db7c1eb 100644 --- a/lib/pages/chat_list/client_chooser_button.dart +++ b/lib/pages/chat_list/client_chooser_button.dart @@ -32,16 +32,6 @@ class ClientChooserButton extends StatelessWidget { // Pangea# return >[ // #Pangea - // PopupMenuItem( - // value: SettingsAction.newGroup, - // child: Row( - // children: [ - // const Icon(Icons.group_add_outlined), - // const SizedBox(width: 18), - // Text(L10n.of(context)!.createGroup), - // ], - // ), - // ), PopupMenuItem( value: SettingsAction.joinWithClassCode, child: Row( @@ -52,21 +42,6 @@ class ClientChooserButton extends StatelessWidget { ], ), ), - // PopupMenuItem( - // enabled: matrix.client.rooms.any( - // (room) => - // room.isSpace && - // room.ownPowerLevel >= ClassDefaultValues.powerLevelOfAdmin, - // ), - // value: SettingsAction.spaceAnalytics, - // child: Row( - // children: [ - // const Icon(Icons.analytics_outlined), - // const SizedBox(width: 18), - // Expanded(child: Text(L10n.of(context)!.spaceAnalytics)), - // ], - // ), - // ), PopupMenuItem( enabled: matrix.client.rooms.any( (room) => !room.isSpace && !room.isArchived && !room.isAnalyticsRoom, @@ -80,37 +55,31 @@ class ClientChooserButton extends StatelessWidget { ], ), ), + // PopupMenuItem( + // value: SettingsAction.newGroup, + // child: Row( + // children: [ + // const Icon(Icons.group_add_outlined), + // const SizedBox(width: 18), + // Text(L10n.of(context)!.createGroup), + // ], + // ), + // ), + // Pangea# PopupMenuItem( - value: SettingsAction.newClass, + value: SettingsAction.newSpace, child: Row( children: [ - const Icon(Icons.school), + const Icon(Icons.workspaces_outlined), const SizedBox(width: 18), + // #Pangea Expanded(child: Text(L10n.of(context)!.createNewSpace)), + // Text(L10n.of(context)!.createNewSpace), + // Pangea# ], ), ), - // PopupMenuItem( - // value: SettingsAction.newSpace, - // child: Row( - // children: [ - // const Icon(Icons.workspaces_outlined), - // const SizedBox(width: 18), - // Text(L10n.of(context)!.createNewSpace), - // ], - // ), - // ), - // if (controller.pangeaController.permissionsController.isUser18()) - // PopupMenuItem( - // value: SettingsAction.findAConversationPartner, - // child: Row( - // children: [ - // const Icon(Icons.add_circle_outline), - // const SizedBox(width: 18), - // Expanded(child: Text(L10n.of(context)!.findALanguagePartner)), - // ], - // ), - // ), + // #Pangea // PopupMenuItem( // value: SettingsAction.setStatus, // child: Row( @@ -132,19 +101,18 @@ class ClientChooserButton extends StatelessWidget { // ), // ), // Pangea# - PopupMenuItem( + // Currently disabled because of: + // https://github.com/matrix-org/matrix-react-sdk/pull/12286 + /*PopupMenuItem( value: SettingsAction.archive, child: Row( children: [ const Icon(Icons.archive_outlined), const SizedBox(width: 18), - // #Pangea - // Text(L10n.of(context)!.archive), - Expanded(child: Text(L10n.of(context)!.viewArchive)), - // Pangea# + Text(L10n.of(context)!.archive), ], ), - ), + ),*/ // #Pangea PopupMenuItem( value: SettingsAction.learning, diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index 55b39fa3d..55ba7bf93 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -222,8 +222,6 @@ class SettingsController extends State { final client = Matrix.of(context).client; profileFuture ??= client.getProfileFromUserId( client.userID!, - cache: !profileUpdated, - getFromRooms: !profileUpdated, ); return SettingsView(this); } diff --git a/lib/utils/show_update_snackbar.dart b/lib/utils/show_update_snackbar.dart new file mode 100644 index 000000000..d9161dd01 --- /dev/null +++ b/lib/utils/show_update_snackbar.dart @@ -0,0 +1,49 @@ +import 'package:fluffychat/utils/platform_infos.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/l10n.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +abstract class UpdateNotifier { + static const String versionStoreKey = 'last_known_version'; + + static void showUpdateSnackBar(BuildContext context) async { + final scaffoldMessenger = ScaffoldMessenger.of(context); + final currentVersion = await PlatformInfos.getVersion(); + final store = await SharedPreferences.getInstance(); + // final storedVersion = store.getString(versionStoreKey); + const storedVersion = "0.0.0"; + + if (currentVersion != storedVersion) { + ScaffoldFeatureController? controller; + controller = scaffoldMessenger.showSnackBar( + SnackBar( + duration: const Duration(seconds: 30), + content: Row( + children: [ + IconButton( + icon: Icon( + Icons.close_outlined, + size: 20, + color: Theme.of(context).colorScheme.onPrimary, + ), + onPressed: () => controller?.close(), + ), + Expanded( + child: Text( + L10n.of(context)!.updateInstalled(currentVersion), + ), + ), + ], + ), + // #Pangea + // action: SnackBarAction( + // label: L10n.of(context)!.changelog, + // onPressed: () => launchUrlString(AppConfig.changelogUrl), + // ), + // Pangea# + ), + ); + await store.setString(versionStoreKey, currentVersion); + } + } +} diff --git a/pubspec.yaml b/pubspec.yaml index f8706bb85..ebdad03f3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -75,7 +75,7 @@ dependencies: git: url: https://github.com/pangeachat/matrix-dart-sdk.git # repo ref: main # branch - # matrix: ^0.30.0 + # matrix: ^0.31.0 # Pangea# native_imaging: ^0.1.1 package_info_plus: ^6.0.0 @@ -216,4 +216,4 @@ dependency_overrides: git: url: https://github.com/TheOneWithTheBraid/keyboard_shortcuts.git ref: null-safety - win32: 5.5.0 \ No newline at end of file + win32: 5.5.0