mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
initial swift data conversion
This commit is contained in:
parent
183924d4dc
commit
b2c72ae166
130 changed files with 2939 additions and 2269 deletions
|
|
@ -10,7 +10,7 @@ import OSLog
|
|||
|
||||
struct AmbientLightingConfig: View {
|
||||
@Environment(\.self) var environment
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -136,8 +136,7 @@ struct AmbientLightingConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return AmbientLightingConfig(node: nil)
|
||||
AmbientLightingConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import OSLog
|
|||
import SwiftUI
|
||||
|
||||
struct CannedMessagesConfig: View {
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
var node: NodeInfoEntity?
|
||||
|
|
@ -357,8 +357,7 @@ struct CannedMessagesConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return CannedMessagesConfig(node: nil)
|
||||
CannedMessagesConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ enum DetectionSensorRole: String, CaseIterable, Equatable, Decodable {
|
|||
|
||||
struct DetectionSensorConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
var node: NodeInfoEntity?
|
||||
|
|
@ -263,8 +263,7 @@ struct DetectionSensorConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return DetectionSensorConfig(node: nil)
|
||||
DetectionSensorConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import SwiftUI
|
|||
|
||||
struct ExternalNotificationConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -284,8 +284,7 @@ struct ExternalNotificationConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return ExternalNotificationConfig(node: nil)
|
||||
ExternalNotificationConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import SwiftUI
|
|||
|
||||
struct MQTTConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
var node: NodeInfoEntity?
|
||||
|
|
@ -466,8 +466,7 @@ struct MQTTConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return MQTTConfig(node: nil)
|
||||
MQTTConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import SwiftUI
|
|||
import OSLog
|
||||
|
||||
struct PaxCounterConfig: View {
|
||||
@Environment(\.managedObjectContext) private var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject private var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -125,8 +125,7 @@ struct PaxCounterConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return PaxCounterConfig(node: nil)
|
||||
PaxCounterConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
// Copyright (c) Garth Vander Houwen 6/13/22.
|
||||
//
|
||||
import MeshtasticProtobufs
|
||||
import CoreData
|
||||
import SwiftData
|
||||
import OSLog
|
||||
import SwiftUI
|
||||
|
||||
struct RangeTestConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ struct RangeTestConfig: View {
|
|||
@State var save = false
|
||||
@State private var sender: UpdateInterval = UpdateInterval(from: 0)
|
||||
private var isPrimaryChannelPublic: Bool {
|
||||
guard let channels = node?.myInfo?.channels?.array as? [ChannelEntity] else {
|
||||
guard let channels = node?.myInfo?.channels else {
|
||||
return false
|
||||
}
|
||||
// Treat the primary channel on this node as "public" when it is effectively unencrypted
|
||||
|
|
@ -144,8 +144,7 @@ struct RangeTestConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return RangeTestConfig(node: nil)
|
||||
RangeTestConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import SwiftUI
|
|||
import OSLog
|
||||
|
||||
struct RtttlConfig: View {
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -116,8 +116,7 @@ struct RtttlConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return RtttlConfig(node: nil)
|
||||
RtttlConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import SwiftUI
|
|||
|
||||
struct SerialConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -207,8 +207,7 @@ struct SerialConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return SerialConfig(node: nil)
|
||||
SerialConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import SwiftUI
|
|||
|
||||
struct StoreForwardConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
var node: NodeInfoEntity?
|
||||
|
|
@ -199,8 +199,7 @@ struct StoreForwardConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return StoreForwardConfig(node: nil)
|
||||
StoreForwardConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
// TAKModuleConfig.swift
|
||||
// Meshtastic
|
||||
import SwiftUI
|
||||
import CoreData
|
||||
import SwiftData
|
||||
import OSLog
|
||||
import MeshtasticProtobufs
|
||||
|
||||
struct TAKModuleConfig: View {
|
||||
@Environment(\.managedObjectContext) private var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject private var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -262,8 +262,7 @@ struct TAKModuleConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return TAKModuleConfig(node: nil)
|
||||
TAKModuleConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import SwiftUI
|
|||
|
||||
struct TelemetryConfig: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@Environment(\.modelContext) private var context
|
||||
@EnvironmentObject var accessoryManager: AccessoryManager
|
||||
@Environment(\.dismiss) private var goBack
|
||||
|
||||
|
|
@ -243,8 +243,7 @@ struct TelemetryConfig: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
let context = PersistenceController.preview.container.viewContext
|
||||
return TelemetryConfig(node: nil)
|
||||
TelemetryConfig(node: nil)
|
||||
.environmentObject(AccessoryManager.shared)
|
||||
.environment(\.managedObjectContext, context)
|
||||
.modelContainer(PersistenceController.preview.container)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue