This repository was archived by the owner on Apr 3, 2025. It is now read-only.
File tree 5 files changed +22
-0
lines changed
modules/settings/routes/notifications
5 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 387
387
"settings.EmailSentSuccessMessage" : " An email to reset your password has been sent!" ,
388
388
"settings.EmailUpdated" : " Email Updated" ,
389
389
"settings.EmailValidation" : " Invalid Email Address" ,
390
+ "settings.EnableInAppNotifications" : " Enable In-App Notifications" ,
390
391
"settings.EnableModule" : " Enable {}" ,
391
392
"settings.EnabledProfile" : " Enabled Profile" ,
392
393
"settings.EncryptionKey" : " Encryption Key" ,
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ enum LunaDatabaseValue {
20
20
QUICK_ACTIONS_SEARCH ,
21
21
USE_24_HOUR_TIME ,
22
22
DEFAULT_LAUNCH_MODULE ,
23
+ ENABLE_IN_APP_NOTIFICATIONS ,
23
24
}
24
25
25
26
class LunaDatabase extends LunaModuleDatabase {
@@ -167,6 +168,8 @@ extension LunaDatabaseValueExtension on LunaDatabaseValue {
167
168
return value is LunaModule ;
168
169
case LunaDatabaseValue .NETWORKING_TLS_VALIDATION :
169
170
return value is bool ;
171
+ case LunaDatabaseValue .ENABLE_IN_APP_NOTIFICATIONS :
172
+ return value is bool ;
170
173
}
171
174
}
172
175
@@ -208,6 +211,8 @@ extension LunaDatabaseValueExtension on LunaDatabaseValue {
208
211
return LunaModule .DASHBOARD ;
209
212
case LunaDatabaseValue .NETWORKING_TLS_VALIDATION :
210
213
return false ;
214
+ case LunaDatabaseValue .ENABLE_IN_APP_NOTIFICATIONS :
215
+ return true ;
211
216
}
212
217
}
213
218
}
Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ class LunaFirebaseMessaging {
79
79
/// This listens on [FirebaseMessaging.onMessage] , where the application must be open and in the foreground.
80
80
StreamSubscription <RemoteMessage > registerOnMessageListener () {
81
81
return onMessage.listen ((message) {
82
+ if (LunaDatabaseValue .ENABLE_IN_APP_NOTIFICATIONS .data) return ;
83
+
82
84
LunaModule ? module = LunaModule .DASHBOARD .fromKey (message.data['module' ]);
83
85
showLunaSnackBar (
84
86
title: message.notification? .title ?? 'Unknown Content' ,
Original file line number Diff line number Diff line change @@ -63,12 +63,25 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
63
63
trailing: const LunaIconButton .arrow (),
64
64
onTap: LunaLinks .NOTIFICATIONS_GETTING_STARTED .launch,
65
65
),
66
+ _enableInAppNotifications (),
66
67
LunaDivider (),
67
68
..._modules (),
68
69
],
69
70
);
70
71
}
71
72
73
+ Widget _enableInAppNotifications () {
74
+ return LunaBlock (
75
+ title: 'settings.EnableInAppNotifications' .tr (),
76
+ trailing: LunaDatabaseValue .ENABLE_IN_APP_NOTIFICATIONS .listen (
77
+ builder: (context, box, _) => LunaSwitch (
78
+ value: LunaDatabaseValue .ENABLE_IN_APP_NOTIFICATIONS .data,
79
+ onChanged: LunaDatabaseValue .ENABLE_IN_APP_NOTIFICATIONS .put,
80
+ ),
81
+ ),
82
+ );
83
+ }
84
+
72
85
List <Widget > _modules () {
73
86
List <SettingsNotificationsModuleTile > modules = [];
74
87
for (LunaModule module in LunaModule .values) {
Original file line number Diff line number Diff line change 121
121
"settings.EmailSentSuccessMessage" : " An email to reset your password has been sent!" ,
122
122
"settings.EmailUpdated" : " Email Updated" ,
123
123
"settings.EmailValidation" : " Invalid Email Address" ,
124
+ "settings.EnableInAppNotifications" : " Enable In-App Notifications" ,
124
125
"settings.EnableModule" : " Enable {}" ,
125
126
"settings.EnabledProfile" : " Enabled Profile" ,
126
127
"settings.EncryptionKey" : " Encryption Key" ,
You can’t perform that action at this time.
0 commit comments