mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
V 1.27.3 Data cleanup so everything uses BLEManager, will implement core data soon
This commit is contained in:
parent
4b673beca4
commit
261af7de4b
8 changed files with 22 additions and 32 deletions
|
|
@ -672,7 +672,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.27.1;
|
||||
MARKETING_VERSION = 1.27.3;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
|
|
@ -699,7 +699,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.27.1;
|
||||
MARKETING_VERSION = 1.27.3;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
|
|
|
|||
|
|
@ -170,10 +170,11 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
peripheralName = name
|
||||
}
|
||||
|
||||
let newPeripheral = Peripheral(id: peripheral.identifier.uuidString, name: peripheralName, rssi: RSSI.intValue, peripheral: peripheral, myInfo: nil)
|
||||
var newPeripheral = Peripheral(id: peripheral.identifier.uuidString, name: peripheralName, rssi: RSSI.intValue, peripheral: peripheral, myInfo: nil)
|
||||
let peripheralIndex = peripherals.firstIndex(where: { $0.id == newPeripheral.id })
|
||||
|
||||
|
||||
if peripheralIndex != nil {
|
||||
newPeripheral.myInfo = self.meshData.nodes[peripheralIndex!].myInfo
|
||||
peripherals.remove(at: peripheralIndex!)
|
||||
peripherals.append(newPeripheral)
|
||||
print("Updating peripheral: \(peripheralName)");
|
||||
|
|
|
|||
|
|
@ -10,14 +10,12 @@ import SwiftUI
|
|||
@main
|
||||
struct MeshtasticClientApp: App {
|
||||
|
||||
@ObservedObject private var meshData: MeshData = MeshData()
|
||||
@ObservedObject private var bleManager: BLEManager = BLEManager()
|
||||
@ObservedObject private var userSettings: UserSettings = UserSettings()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.environmentObject(meshData)
|
||||
.environmentObject(bleManager)
|
||||
.environmentObject(userSettings)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import CoreBluetooth
|
|||
|
||||
struct Connect: View {
|
||||
|
||||
@EnvironmentObject var meshData: MeshData
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
@EnvironmentObject var userSettings: UserSettings
|
||||
|
||||
|
|
|
|||
|
|
@ -162,12 +162,12 @@ struct NodeDetail: View {
|
|||
|
||||
|
||||
struct NodeDetail_Previews: PreviewProvider {
|
||||
static let meshData = MeshData()
|
||||
static let bleManager = BLEManager()
|
||||
|
||||
static var previews: some View {
|
||||
Group {
|
||||
NodeDetail(node: meshData.nodes[0]).environmentObject(meshData)
|
||||
NodeDetail(node: meshData.nodes[1]).environmentObject(meshData)
|
||||
NodeDetail(node: bleManager.meshData.nodes[0])
|
||||
NodeDetail(node: bleManager.meshData.nodes[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@
|
|||
import SwiftUI
|
||||
|
||||
struct NodeList: View {
|
||||
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
@EnvironmentObject var meshData: MeshData
|
||||
|
||||
@State private var selection: String? = nil
|
||||
|
||||
@State private var showLocationOnly = false
|
||||
|
||||
var filteredDevices: [NodeInfoModel] {
|
||||
meshData.nodes.filter { node in
|
||||
bleManager.meshData.nodes.filter { node in
|
||||
(!showLocationOnly || node.position.coordinate != nil)
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ struct NodeList: View {
|
|||
|
||||
List {
|
||||
|
||||
if meshData.nodes.count == 0 {
|
||||
if bleManager.meshData.nodes.count == 0 {
|
||||
Text("Scan for Radios").font(.largeTitle)
|
||||
//.listRowSeparator(.hidden)
|
||||
Text("No LoRa Mesh Nodes Found").font(.title2)
|
||||
|
|
@ -68,9 +68,9 @@ struct NodeList: View {
|
|||
.swipeActions {
|
||||
Button {
|
||||
|
||||
let nodeIndex = meshData.nodes.firstIndex(where: { $0.id == node.id })
|
||||
meshData.nodes.remove(at: nodeIndex!)
|
||||
meshData.save()
|
||||
let nodeIndex = bleManager.meshData.nodes.firstIndex(where: { $0.id == node.id })
|
||||
bleManager.meshData.nodes.remove(at: nodeIndex!)
|
||||
bleManager.meshData.save()
|
||||
} label: {
|
||||
|
||||
Label("Delete from app", systemImage: "trash")
|
||||
|
|
@ -83,11 +83,11 @@ struct NodeList: View {
|
|||
.navigationTitle("All Nodes")
|
||||
.onAppear(
|
||||
perform: {
|
||||
if meshData.nodes.count == 0 {
|
||||
meshData.load()
|
||||
if bleManager.meshData.nodes.count == 0 {
|
||||
bleManager.meshData.load()
|
||||
}
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
if meshData.nodes.count > 0 {
|
||||
if bleManager.meshData.nodes.count > 0 {
|
||||
selection = "0"
|
||||
}
|
||||
}
|
||||
|
|
@ -102,6 +102,5 @@ struct NodeList: View {
|
|||
struct NodeList_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
NodeList()
|
||||
.environmentObject(MeshData())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,10 @@ import CoreLocation
|
|||
|
||||
struct NodeMap: View {
|
||||
|
||||
|
||||
|
||||
@ObservedObject var bleManager = BLEManager()
|
||||
@EnvironmentObject var meshData: MeshData
|
||||
@EnvironmentObject var bleManager :BLEManager
|
||||
|
||||
var locationNodes: [NodeInfoModel] {
|
||||
meshData.nodes.filter { node in
|
||||
bleManager.meshData.nodes.filter { node in
|
||||
(node.position.coordinate != nil)
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +24,6 @@ struct NodeMap: View {
|
|||
let name: String
|
||||
let coordinate: CLLocationCoordinate2D
|
||||
}
|
||||
|
||||
|
||||
|
||||
var body: some View {
|
||||
let location = LocationHelper.currentLocation
|
||||
|
|
@ -64,17 +59,15 @@ struct NodeMap: View {
|
|||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.onAppear{
|
||||
meshData.load()
|
||||
bleManager.meshData.load()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct NodeMap_Previews: PreviewProvider {
|
||||
static let meshData = MeshData()
|
||||
static let bleManager = BLEManager()
|
||||
|
||||
static var previews: some View {
|
||||
NodeMap(bleManager: bleManager)
|
||||
.environmentObject(MeshData())
|
||||
NodeMap()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class UserSettings: ObservableObject {
|
|||
struct AppSettings: View {
|
||||
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
@ObservedObject var userSettings: UserSettings = UserSettings()
|
||||
@EnvironmentObject var userSettings: UserSettings
|
||||
|
||||
@State private var preferredDeviceConnected = false
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue