mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
add toggle
This commit is contained in:
parent
74d2e562f0
commit
8499a102d0
3 changed files with 16 additions and 2 deletions
|
|
@ -67,6 +67,7 @@ extension UserDefaults {
|
|||
case enableDetectionNotifications
|
||||
case detectionSensorRole
|
||||
case enableSmartPosition
|
||||
case positionShareNotifications
|
||||
case newNodeNotifications
|
||||
case lowBatteryNotifications
|
||||
case channelMessageNotifications
|
||||
|
|
@ -139,6 +140,9 @@ extension UserDefaults {
|
|||
@UserDefault(.enableSmartPosition, defaultValue: false)
|
||||
static var enableSmartPosition: Bool
|
||||
|
||||
@UserDefault(.positionShareNotifications, defaultValue: true)
|
||||
static var positionShareNotifications: Bool
|
||||
|
||||
@UserDefault(.channelMessageNotifications, defaultValue: true)
|
||||
static var channelMessageNotifications: Bool
|
||||
|
||||
|
|
|
|||
|
|
@ -666,7 +666,7 @@ private func createPositionMessageEntity(
|
|||
}
|
||||
}
|
||||
|
||||
if !(newMessage.fromUser?.mute ?? false) {
|
||||
if !(newMessage.fromUser?.mute ?? false) && UserDefaults.positionShareNotifications {
|
||||
// Create an iOS Notification for the received DM position
|
||||
let manager = LocalNotificationManager()
|
||||
let notificationContent = "📍 Shared their location"
|
||||
|
|
@ -699,7 +699,7 @@ private func createPositionMessageEntity(
|
|||
if channel.index == newMessage.channel {
|
||||
context.refresh(channel, mergeChanges: true)
|
||||
}
|
||||
if channel.index == newMessage.channel && !channel.mute && UserDefaults.channelMessageNotifications {
|
||||
if channel.index == newMessage.channel && !channel.mute && UserDefaults.channelMessageNotifications && UserDefaults.positionShareNotifications {
|
||||
// Create an iOS Notification for the received channel position
|
||||
let manager = LocalNotificationManager()
|
||||
let notificationContent = "📍 Shared their location"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ struct AppSettings: View {
|
|||
@AppStorage("environmentEnableWeatherKit") private var environmentEnableWeatherKit: Bool = true
|
||||
@AppStorage("enableAdministration") private var enableAdministration: Bool = false
|
||||
@AppStorage("usageDataAndCrashReporting") private var usageDataAndCrashReporting: Bool = true
|
||||
@AppStorage("positionShareNotifications") private var positionShareNotifications: Bool = true
|
||||
|
||||
let autoconnectBinding = Binding<Bool>(get: {
|
||||
return UserDefaults.autoconnectOnDiscovery
|
||||
|
|
@ -78,6 +79,15 @@ struct AppSettings: View {
|
|||
.tint(.accentColor)
|
||||
}
|
||||
}
|
||||
Section(header: Text("Notifications")) {
|
||||
Toggle(isOn: $positionShareNotifications) {
|
||||
Label("Shared Locations", systemImage: "location.fill")
|
||||
}
|
||||
.tint(.accentColor)
|
||||
Text("Notifications for shared location messages from other users.")
|
||||
.foregroundStyle(.secondary)
|
||||
.font(.caption)
|
||||
}
|
||||
Section(header: Text("App Data")) {
|
||||
Toggle(isOn: $purgeStaleNodes ) {
|
||||
Label {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue