mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Fix assorted paper cuts
This commit is contained in:
parent
ebf243f203
commit
93cfda20ed
8 changed files with 27 additions and 113 deletions
|
|
@ -20,7 +20,6 @@
|
|||
DD836AE726F6B38600ABCC23 /* Connect.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD836AE626F6B38600ABCC23 /* Connect.swift */; };
|
||||
DD836AED26F858F900ABCC23 /* MeshData.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD836AEC26F858F900ABCC23 /* MeshData.swift */; };
|
||||
DD836AEF26F85D8D00ABCC23 /* NodeInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD836AEE26F85D8D00ABCC23 /* NodeInfoModel.swift */; };
|
||||
DD836AF126F8613500ABCC23 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD836AF026F8613500ABCC23 /* Color.swift */; };
|
||||
DD8EDE9426F97A2B00A5A10B /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = DD8EDE9326F97A2B00A5A10B /* SwiftProtobuf */; };
|
||||
DD90860C26F684AF00DC5189 /* BatteryIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD90860B26F684AF00DC5189 /* BatteryIcon.swift */; };
|
||||
DD90860E26F69BAE00DC5189 /* NodeMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD90860D26F69BAE00DC5189 /* NodeMap.swift */; };
|
||||
|
|
@ -79,7 +78,6 @@
|
|||
DD836AE626F6B38600ABCC23 /* Connect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Connect.swift; sourceTree = "<group>"; };
|
||||
DD836AEC26F858F900ABCC23 /* MeshData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshData.swift; sourceTree = "<group>"; };
|
||||
DD836AEE26F85D8D00ABCC23 /* NodeInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeInfoModel.swift; sourceTree = "<group>"; };
|
||||
DD836AF026F8613500ABCC23 /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
|
||||
DD90860A26F645B700DC5189 /* MeshtasticClient.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeshtasticClient.entitlements; sourceTree = "<group>"; };
|
||||
DD90860B26F684AF00DC5189 /* BatteryIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryIcon.swift; sourceTree = "<group>"; };
|
||||
DD90860D26F69BAE00DC5189 /* NodeMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeMap.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -265,7 +263,6 @@
|
|||
DDF924C526FA2375009FE055 /* MessageModel.swift */,
|
||||
DD836AEC26F858F900ABCC23 /* MeshData.swift */,
|
||||
DD836AEE26F85D8D00ABCC23 /* NodeInfoModel.swift */,
|
||||
DD836AF026F8613500ABCC23 /* Color.swift */,
|
||||
DDF924CC26FCC97E009FE055 /* PacketModel.swift */,
|
||||
DD23A50E26FD1B4400D9B90C /* PeripheralModel.swift */,
|
||||
);
|
||||
|
|
@ -452,7 +449,6 @@
|
|||
DD47E3CC26F0E51D00029299 /* NodeDetail.swift in Sources */,
|
||||
DD836AEF26F85D8D00ABCC23 /* NodeInfoModel.swift in Sources */,
|
||||
DDC2E1A726CEB3400042C5E4 /* LocationHelper.swift in Sources */,
|
||||
DD836AF126F8613500ABCC23 /* Color.swift in Sources */,
|
||||
DD47E3D226F1210600029299 /* HelperFunctions.swift in Sources */,
|
||||
DDAF8C5F26ED09B50058C060 /* radioconfig.pb.swift in Sources */,
|
||||
DDAF8C5326EB1DF10058C060 /* BLEManager.swift in Sources */,
|
||||
|
|
@ -649,7 +645,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.11;
|
||||
MARKETING_VERSION = 1.12;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
|
|
@ -675,7 +671,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.11;
|
||||
MARKETING_VERSION = 1.12;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
{
|
||||
var toRadio: ToRadio!
|
||||
toRadio = ToRadio()
|
||||
//toRadio.setOwner = myUser
|
||||
//toRadio.setOwner = myUser
|
||||
|
||||
let binaryData: Data = try! toRadio.serializedData()
|
||||
if (self.connectedPeripheral.state == CBPeripheralState.connected)
|
||||
|
|
@ -156,7 +156,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
//---------------------------------------------------------------------------------------
|
||||
func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?)
|
||||
{
|
||||
meshData.load()
|
||||
if(peripheral.identifier == connectedPeripheral.identifier){
|
||||
connectedPeripheral = nil
|
||||
}
|
||||
|
|
@ -268,9 +267,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
connectedNode = meshData.nodes.first(where: {$0.id == decodedInfo.myInfo.myNodeNum})
|
||||
if connectedNode != nil {
|
||||
connectedNode.myInfo = myInfoModel
|
||||
let nodeIndex = meshData.nodes.firstIndex(where: { $0.id == decodedInfo.myInfo.myNodeNum })
|
||||
meshData.nodes.remove(at: nodeIndex!)
|
||||
meshData.nodes.append(connectedNode)
|
||||
}
|
||||
meshData.save()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
See LICENSE folder for this sample’s licensing information.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
|
||||
extension Color: Codable {
|
||||
private struct Components {
|
||||
let red: Double
|
||||
let green: Double
|
||||
let blue: Double
|
||||
let alpha: Double
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case red
|
||||
case green
|
||||
case blue
|
||||
case alpha
|
||||
}
|
||||
|
||||
/// A new random color.
|
||||
static var random: Color {
|
||||
let red = Double.random(in: 0...1)
|
||||
let green = Double.random(in: 0...1)
|
||||
let blue = Double.random(in: 0...1)
|
||||
return Color(.sRGB, red: red, green: green, blue: blue, opacity: 1)
|
||||
}
|
||||
|
||||
private var components: Components {
|
||||
var red: CGFloat = 0
|
||||
var green: CGFloat = 0
|
||||
var blue: CGFloat = 0
|
||||
var alpha: CGFloat = 0
|
||||
UIColor(self).getRed(&red, green: &green, blue: &blue, alpha: &alpha)
|
||||
return Components(red: Double(red),
|
||||
green: Double(green),
|
||||
blue: Double(blue),
|
||||
alpha: Double(alpha))
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
let red = try container.decode(Double.self, forKey: .red)
|
||||
let green = try container.decode(Double.self, forKey: .green)
|
||||
let blue = try container.decode(Double.self, forKey: .blue)
|
||||
let alpha = try container.decode(Double.self, forKey: .alpha)
|
||||
self.init(Components(red: red, green: green, blue: blue, alpha: alpha))
|
||||
}
|
||||
|
||||
private init(_ components: Components) {
|
||||
self.init(.sRGB, red: components.red, green: components.green, blue: components.blue, opacity: components.alpha)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
let components = self.components
|
||||
try container.encode(components.red, forKey: .red)
|
||||
try container.encode(components.green, forKey: .green)
|
||||
try container.encode(components.blue, forKey: .blue)
|
||||
try container.encode(components.alpha, forKey: .alpha)
|
||||
}
|
||||
|
||||
// MARK: - font colors
|
||||
/// This color is either black or white, whichever is more accessible when viewed against the scrum color.
|
||||
var accessibleFontColor: Color {
|
||||
var red: CGFloat = 0
|
||||
var green: CGFloat = 0
|
||||
var blue: CGFloat = 0
|
||||
UIColor(self).getRed(&red, green: &green, blue: &blue, alpha: nil)
|
||||
return isLightColor(red: red, green: green, blue: blue) ? .black : .white
|
||||
}
|
||||
|
||||
private func isLightColor(red: CGFloat, green: CGFloat, blue: CGFloat) -> Bool {
|
||||
let lightRed = red > 0.65
|
||||
let lightGreen = green > 0.65
|
||||
let lightBlue = blue > 0.65
|
||||
|
||||
let lightness = [lightRed, lightGreen, lightBlue].reduce(0) { $1 ? $0 + 1 : $0 }
|
||||
return lightness >= 2
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,5 @@ struct MyInfoModel: Identifiable, Codable {
|
|||
self.rebootCount = rebootCount
|
||||
self.messageTimeoutMsec = messageTimeoutMsec
|
||||
self.minAppVersion = minAppVersion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,22 @@
|
|||
//
|
||||
// PacketModel.swift
|
||||
// MeshtasticClient
|
||||
//
|
||||
// Created by Garth Vander Houwen on 9/23/21.
|
||||
//
|
||||
struct PacketModel: Identifiable {
|
||||
|
||||
var id: UInt32
|
||||
var from: UInt32
|
||||
var to: UInt32
|
||||
var channel: UInt32
|
||||
var rxTime: UInt32
|
||||
var hopLimit: UInt32
|
||||
var wantAck: Bool
|
||||
|
||||
import Foundation
|
||||
|
||||
init(id: UInt32, from: UInt32, to: UInt32, channel: UInt32, rxTime: UInt32, hopLimit: UInt32, wantAck: Bool) {
|
||||
|
||||
self.id = id
|
||||
self.from = from
|
||||
self.to = to
|
||||
self.channel = channel
|
||||
self.rxTime = rxTime
|
||||
self.hopLimit = hopLimit
|
||||
self.wantAck = wantAck
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ struct Connect: View {
|
|||
|
||||
ZStack {
|
||||
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.name : "Unknown")
|
||||
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedNode != nil) ? bleManager.connectedNode.user.longName : ((bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.name : "Unknown") ?? "Unknown")
|
||||
|
||||
}
|
||||
)
|
||||
}.navigationViewStyle(StackNavigationViewStyle())
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ struct MessageList: View {
|
|||
|
||||
ZStack {
|
||||
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.name : "Unknown")
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedNode != nil) ? bleManager.connectedNode.user.longName : ((bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.name : "Unknown") ?? "Unknown")
|
||||
}
|
||||
)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
|
|
|||
|
|
@ -38,14 +38,6 @@ struct NodeList: View {
|
|||
Text("Views with bluetooth functionality will show an indicator in the upper right hand corner show if bluetooth is on, and if a device is connected.")
|
||||
.listRowSeparator(.hidden)
|
||||
Spacer().listRowSeparator(.hidden)
|
||||
//Button(action: {}) {
|
||||
// Text("Get Started")
|
||||
// .font(.title)
|
||||
// .frame(maxWidth: 300)
|
||||
//}
|
||||
//.buttonStyle(.borderedProminent)
|
||||
//.buttonBorderShape(.automatic)
|
||||
//.controlSize(.large)
|
||||
}
|
||||
else {
|
||||
Toggle(isOn: $showLocationOnly) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue