Implement settings
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:simplecloudnotifier/settings/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/globals.dart';
|
||||
|
||||
class Notifier {
|
||||
static void showLocalNotification(String messageID, String channelID, String channelName, String channelDescr, String title, String body, DateTime? timestamp) async {
|
||||
static void showLocalNotification(String messageID, String channelID, String channelName, String channelDescr, String title, String body, DateTime? timestamp, int? prio) async {
|
||||
final nid = Globals().sharedPrefs.getInt('notifier.nextid') ?? 1000;
|
||||
Globals().sharedPrefs.setInt('notifier.nextid', nid + 7);
|
||||
|
||||
@@ -60,6 +60,8 @@ class Notifier {
|
||||
payload = ['@SCN_MESSAGE', messageID, channelID, newMessageNID].join("\n");
|
||||
}
|
||||
|
||||
final cfg = AppSettings().getNotificationSettings(prio);
|
||||
|
||||
// ======== SHOW NOTIFICATION ========
|
||||
await flutterLocalNotificationsPlugin.show(
|
||||
newMessageNID,
|
||||
@@ -75,6 +77,12 @@ class Notifier {
|
||||
when: timestamp?.millisecondsSinceEpoch,
|
||||
groupKey: channelID,
|
||||
subText: (channelName == 'main') ? null : channelName,
|
||||
enableLights: cfg.enableLights,
|
||||
enableVibration: cfg.enableVibration,
|
||||
playSound: cfg.playSound,
|
||||
sound: cfg.soundURI(),
|
||||
silent: cfg.silent,
|
||||
timeoutAfter: cfg.timeoutAfter,
|
||||
),
|
||||
),
|
||||
payload: payload,
|
||||
|
Reference in New Issue
Block a user