From 28976ecdefe83511ea50150eda0d36f6eb7d8eb2 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Tue, 6 Sep 2022 20:21:11 +0200 Subject: [PATCH] fix: Styling and notification settings --- lib/pages/add_story/add_story_view.dart | 4 ++++ lib/pages/connect/connect_page_view.dart | 2 ++ .../homeserver_picker_view.dart | 3 +++ lib/pages/login/login_view.dart | 2 ++ .../settings_notifications.dart | 19 +++++++++++++------ lib/pages/sign_up/signup_view.dart | 2 ++ lib/pages/story/story_view.dart | 3 +++ 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/lib/pages/add_story/add_story_view.dart b/lib/pages/add_story/add_story_view.dart index 8153c60d..12f7dad2 100644 --- a/lib/pages/add_story/add_story_view.dart +++ b/lib/pages/add_story/add_story_view.dart @@ -17,6 +17,7 @@ class AddStoryView extends StatelessWidget { return Scaffold( backgroundColor: Colors.blueGrey.shade900, appBar: AppBar( + leading: const BackButton(color: Colors.white), systemOverlayStyle: SystemUiOverlayStyle.light, backgroundColor: Colors.transparent, elevation: 0, @@ -38,15 +39,18 @@ class AddStoryView extends StatelessWidget { if (controller.hasMedia) IconButton( icon: const Icon(Icons.fullscreen_outlined), + color: Colors.white, onPressed: controller.toggleBoxFit, ), if (!controller.hasMedia) IconButton( icon: const Icon(Icons.color_lens_outlined), + color: Colors.white, onPressed: controller.updateColor, ), IconButton( icon: const Icon(Icons.delete_outlined), + color: Colors.white, onPressed: controller.reset, ), ], diff --git a/lib/pages/connect/connect_page_view.dart b/lib/pages/connect/connect_page_view.dart index 20fe4ad4..e6c6a8fa 100644 --- a/lib/pages/connect/connect_page_view.dart +++ b/lib/pages/connect/connect_page_view.dart @@ -19,6 +19,8 @@ class ConnectPageView extends StatelessWidget { final identityProviders = controller.identityProviders; return LoginScaffold( appBar: AppBar( + leading: + controller.loading ? null : const BackButton(color: Colors.white), automaticallyImplyLeading: !controller.loading, centerTitle: true, title: Text( diff --git a/lib/pages/homeserver_picker/homeserver_picker_view.dart b/lib/pages/homeserver_picker/homeserver_picker_view.dart index e692aaa0..a5cebfe3 100644 --- a/lib/pages/homeserver_picker/homeserver_picker_view.dart +++ b/lib/pages/homeserver_picker/homeserver_picker_view.dart @@ -22,16 +22,19 @@ class HomeserverPickerView extends StatelessWidget { IconButton( onPressed: controller.restoreBackup, tooltip: L10n.of(context)!.hydrate, + color: Colors.white, icon: const Icon(Icons.restore_outlined), ), IconButton( tooltip: L10n.of(context)!.privacy, onPressed: () => launch(AppConfig.privacyUrl), + color: Colors.white, icon: const Icon(Icons.shield_outlined), ), IconButton( tooltip: L10n.of(context)!.about, onPressed: () => PlatformInfos.showDialog(context), + color: Colors.white, icon: const Icon(Icons.info_outlined), ), ], diff --git a/lib/pages/login/login_view.dart b/lib/pages/login/login_view.dart index 40c80853..f78717a4 100644 --- a/lib/pages/login/login_view.dart +++ b/lib/pages/login/login_view.dart @@ -15,6 +15,8 @@ class LoginView extends StatelessWidget { Widget build(BuildContext context) { return LoginScaffold( appBar: AppBar( + leading: + controller.loading ? null : const BackButton(color: Colors.white), automaticallyImplyLeading: !controller.loading, centerTitle: true, title: Text( diff --git a/lib/pages/settings_notifications/settings_notifications.dart b/lib/pages/settings_notifications/settings_notifications.dart index d0058116..ff57f6ab 100644 --- a/lib/pages/settings_notifications/settings_notifications.dart +++ b/lib/pages/settings_notifications/settings_notifications.dart @@ -58,26 +58,33 @@ class SettingsNotifications extends StatefulWidget { class SettingsNotificationsController extends State { bool? getNotificationSetting(NotificationSettingsItem item) { - final pushRules = Matrix.of(context).client.globalPushRules; + // Until https://gitlab.com/famedly/company/frontend/famedlysdk/-/merge_requests/1124 is shipped + final pushRulesRaw = Matrix.of(context) + .client + .accountData['m.push_rules'] + ?.content + .tryGetMap('device'); + if (pushRulesRaw == null) return null; + final pushRules = PushRuleSet.fromJson(pushRulesRaw); switch (item.type) { case PushRuleKind.content: - return pushRules!.content + return pushRules.content ?.singleWhereOrNull((r) => r.ruleId == item.key) ?.enabled; case PushRuleKind.override: - return pushRules!.override + return pushRules.override ?.singleWhereOrNull((r) => r.ruleId == item.key) ?.enabled; case PushRuleKind.room: - return pushRules!.room + return pushRules.room ?.singleWhereOrNull((r) => r.ruleId == item.key) ?.enabled; case PushRuleKind.sender: - return pushRules!.sender + return pushRules.sender ?.singleWhereOrNull((r) => r.ruleId == item.key) ?.enabled; case PushRuleKind.underride: - return pushRules!.underride + return pushRules.underride ?.singleWhereOrNull((r) => r.ruleId == item.key) ?.enabled; } diff --git a/lib/pages/sign_up/signup_view.dart b/lib/pages/sign_up/signup_view.dart index a9224e3c..f106d280 100644 --- a/lib/pages/sign_up/signup_view.dart +++ b/lib/pages/sign_up/signup_view.dart @@ -13,6 +13,8 @@ class SignupPageView extends StatelessWidget { Widget build(BuildContext context) { return LoginScaffold( appBar: AppBar( + leading: + controller.loading ? null : const BackButton(color: Colors.white), automaticallyImplyLeading: !controller.loading, title: Text( L10n.of(context)!.signUp, diff --git a/lib/pages/story/story_view.dart b/lib/pages/story/story_view.dart index 38762a72..d6590bf5 100644 --- a/lib/pages/story/story_view.dart +++ b/lib/pages/story/story_view.dart @@ -50,6 +50,7 @@ class StoryView extends StatelessWidget { appBar: AppBar( titleSpacing: 0, leading: IconButton( + color: Colors.white, icon: const Icon(Icons.close), onPressed: Navigator.of(context).pop, ), @@ -96,10 +97,12 @@ class StoryView extends StatelessWidget { : [ if (!controller.isOwnStory) IconButton( + color: Colors.white, icon: Icon(Icons.adaptive.share_outlined), onPressed: controller.share, ), PopupMenuButton( + color: Colors.white, onSelected: controller.onPopupStoryAction, itemBuilder: (context) => [ if (controller.currentEvent?.canRedact ?? false)