mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Can reconfigure push notifications
This commit is contained in:
@ -15,8 +15,8 @@ import 'package:flutter/material.dart';
|
||||
Future<void> showInitialPushNotificationsConfiguration(
|
||||
BuildContext context) async {
|
||||
// Check if no notifications service are available
|
||||
if (!srvConfig.notificationsPolicy.hasIndependent &&
|
||||
(!isAndroid || !srvConfig.notificationsPolicy.hasFirebase)) return;
|
||||
if (!PushNotificationsHelper.arePushNotificationsAvailable)
|
||||
return;
|
||||
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (c) => PushNotificationsConfigurationRoute()));
|
||||
|
@ -1,5 +1,7 @@
|
||||
import 'package:comunic/helpers/push_notifications_helper.dart';
|
||||
import 'package:comunic/helpers/settings_helper.dart';
|
||||
import 'package:comunic/models/notifications_settings.dart';
|
||||
import 'package:comunic/ui/routes/push_notifications_route.dart';
|
||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
@ -23,9 +25,11 @@ class _NotificationsSettingsScreenState
|
||||
final key = GlobalKey<AsyncScreenWidgetState>();
|
||||
|
||||
NotificationsSettings _settings;
|
||||
PushNotificationsStatus _pushNotificationsStatus;
|
||||
|
||||
Future<void> _loadSettings() async {
|
||||
_settings = await SettingsHelper.getNotificationsSettings();
|
||||
_pushNotificationsStatus = await PushNotificationsHelper.getLocalStatus();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -41,6 +45,20 @@ class _NotificationsSettingsScreenState
|
||||
SettingsSection(
|
||||
title: tr("Push notifications"),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: tr("Push notifications status"),
|
||||
subtitle: !PushNotificationsHelper.arePushNotificationsAvailable
|
||||
? tr("Unavailable")
|
||||
: (_pushNotificationsStatus ==
|
||||
PushNotificationsStatus.DISABLED
|
||||
? tr("Disabled")
|
||||
: (_pushNotificationsStatus ==
|
||||
PushNotificationsStatus.FIREBASE
|
||||
? tr("Use Google services")
|
||||
: tr("Use independent service"))),
|
||||
onPressed: (c) =>
|
||||
showInitialPushNotificationsConfiguration(context),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: tr("Allow conversations notification"),
|
||||
onToggle: (v) {
|
||||
|
Reference in New Issue
Block a user