diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index c4f6ff96..bf6abcf2 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ DD2E65262767A01F00E45FC5 /* NodeDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2E65252767A01F00E45FC5 /* NodeDetail.swift */; }; DD3501892852FC3B000FC853 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3501882852FC3B000FC853 /* Settings.swift */; }; DD35018B2852FC79000FC853 /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD35018A2852FC79000FC853 /* UserSettings.swift */; }; + DD4033C228B286B70096A444 /* Onboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4033C128B286B70096A444 /* Onboarding.swift */; }; DD41582628582E9B009B0E59 /* DeviceConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD41582528582E9B009B0E59 /* DeviceConfig.swift */; }; DD415828285859C4009B0E59 /* TelemetryConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD415827285859C4009B0E59 /* TelemetryConfig.swift */; }; DD41582A28585C32009B0E59 /* RangeTestConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD41582928585C32009B0E59 /* RangeTestConfig.swift */; }; @@ -126,6 +127,7 @@ DD2E65252767A01F00E45FC5 /* NodeDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeDetail.swift; sourceTree = ""; }; DD3501882852FC3B000FC853 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; DD35018A2852FC79000FC853 /* UserSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = ""; }; + DD4033C128B286B70096A444 /* Onboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Onboarding.swift; sourceTree = ""; }; DD41582528582E9B009B0E59 /* DeviceConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceConfig.swift; sourceTree = ""; }; DD415827285859C4009B0E59 /* TelemetryConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TelemetryConfig.swift; sourceTree = ""; }; DD41582928585C32009B0E59 /* RangeTestConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RangeTestConfig.swift; sourceTree = ""; }; @@ -447,8 +449,9 @@ DD47E3D726F2F21A00029299 /* Bluetooth */, DD47E3CA26F0E50300029299 /* Nodes */, DDC2E18B26CE25A70042C5E4 /* Messages */, - DDC2E18E26CE25FE0042C5E4 /* ContentView.swift */, DD4A911C2708C57100501B7E /* Settings */, + DDC2E18E26CE25FE0042C5E4 /* ContentView.swift */, + DD4033C128B286B70096A444 /* Onboarding.swift */, ); path = Views; sourceTree = ""; @@ -739,6 +742,7 @@ DDA6B2E928419CF2003E8C16 /* MeshPackets.swift in Sources */, DDCE4E2C2869F92900BE9F8F /* UserConfig.swift in Sources */, DD6193752862F6E600E59241 /* ExternalNotificationConfig.swift in Sources */, + DD4033C228B286B70096A444 /* Onboarding.swift in Sources */, DDB6ABE428B13FFF00384BA1 /* ScreenIntervals.swift in Sources */, DD86D40A287F04F100BAEB7A /* InvalidVersion.swift in Sources */, DDD94A502845C8F5004A87A0 /* DateTimeText.swift in Sources */, diff --git a/Meshtastic/Protobufs/mesh.pb.swift b/Meshtastic/Protobufs/mesh.pb.swift index 46dbf236..b5a68d2d 100644 --- a/Meshtastic/Protobufs/mesh.pb.swift +++ b/Meshtastic/Protobufs/mesh.pb.swift @@ -1065,33 +1065,20 @@ struct DataMessage { /// a message a heart or poop emoji. var emoji: UInt32 = 0 - /// - /// Location structure - var location: Location { - get {return _location ?? Location()} - set {_location = newValue} - } - /// Returns true if `location` has been explicitly set. - var hasLocation: Bool {return self._location != nil} - /// Clears the value of `location`. Subsequent reads from it will return its default value. - mutating func clearLocation() {self._location = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - fileprivate var _location: Location? = nil } /// -/// Location of a waypoint to associate with a message -struct Location { +/// Waypoint message, used to share arbitrary locations across the mesh +struct Waypoint { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// - /// Id of the location + /// Id of the waypoint var id: UInt32 = 0 /// @@ -1103,19 +1090,19 @@ struct Location { var longitudeI: Int32 = 0 /// - /// Time the location is to expire (epoch) + /// Time the waypoint is to expire (epoch) var expire: UInt32 = 0 /// - /// If true, only allow the original sender to update the location. + /// If true, only allow the original sender to update the waypoint. var locked: Bool = false /// - /// Name of the location - max 30 chars + /// Name of the waypoint - max 30 chars var name: String = String() ///* - /// Description of the location - max 100 chars + /// Description of the waypoint - max 100 chars var description_p: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() @@ -2121,7 +2108,7 @@ extension Routing: @unchecked Sendable {} extension Routing.OneOf_Variant: @unchecked Sendable {} extension Routing.Error: @unchecked Sendable {} extension DataMessage: @unchecked Sendable {} -extension Location: @unchecked Sendable {} +extension Waypoint: @unchecked Sendable {} extension MeshPacket: @unchecked Sendable {} extension MeshPacket.OneOf_PayloadVariant: @unchecked Sendable {} extension MeshPacket.Priority: @unchecked Sendable {} @@ -2651,7 +2638,6 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati 6: .standard(proto: "request_id"), 7: .standard(proto: "reply_id"), 8: .same(proto: "emoji"), - 9: .same(proto: "location"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -2668,17 +2654,12 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati case 6: try { try decoder.decodeSingularFixed32Field(value: &self.requestID) }() case 7: try { try decoder.decodeSingularFixed32Field(value: &self.replyID) }() case 8: try { try decoder.decodeSingularFixed32Field(value: &self.emoji) }() - case 9: try { try decoder.decodeSingularMessageField(value: &self._location) }() default: break } } } func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 if self.portnum != .unknownApp { try visitor.visitSingularEnumField(value: self.portnum, fieldNumber: 1) } @@ -2703,9 +2684,6 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati if self.emoji != 0 { try visitor.visitSingularFixed32Field(value: self.emoji, fieldNumber: 8) } - try { if let v = self._location { - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - } }() try unknownFields.traverse(visitor: &visitor) } @@ -2718,14 +2696,13 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati if lhs.requestID != rhs.requestID {return false} if lhs.replyID != rhs.replyID {return false} if lhs.emoji != rhs.emoji {return false} - if lhs._location != rhs._location {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Location: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Location" +extension Waypoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = "Waypoint" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .standard(proto: "latitude_i"), @@ -2779,7 +2756,7 @@ extension Location: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Location, rhs: Location) -> Bool { + static func ==(lhs: Waypoint, rhs: Waypoint) -> Bool { if lhs.id != rhs.id {return false} if lhs.latitudeI != rhs.latitudeI {return false} if lhs.longitudeI != rhs.longitudeI {return false} diff --git a/Meshtastic/Protobufs/module_config.pb.swift b/Meshtastic/Protobufs/module_config.pb.swift index 63b87be2..0d6337a8 100644 --- a/Meshtastic/Protobufs/module_config.pb.swift +++ b/Meshtastic/Protobufs/module_config.pb.swift @@ -179,7 +179,7 @@ struct ModuleConfig { /// If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as /// is_uplink_enabled or is_downlink_enabled. /// But if this flag is set, all MQTT features will be disabled and no servers will be contacted. - var disabled: Bool = false + var enabled: Bool = false /// /// The server to use for our MQTT global message gateway feature. @@ -845,7 +845,7 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = ModuleConfig.protoMessageName + ".MQTTConfig" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "disabled"), + 1: .same(proto: "enabled"), 2: .same(proto: "address"), 3: .same(proto: "username"), 4: .same(proto: "password"), @@ -858,7 +858,7 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularBoolField(value: &self.disabled) }() + case 1: try { try decoder.decodeSingularBoolField(value: &self.enabled) }() case 2: try { try decoder.decodeSingularStringField(value: &self.address) }() case 3: try { try decoder.decodeSingularStringField(value: &self.username) }() case 4: try { try decoder.decodeSingularStringField(value: &self.password) }() @@ -869,8 +869,8 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message } func traverse(visitor: inout V) throws { - if self.disabled != false { - try visitor.visitSingularBoolField(value: self.disabled, fieldNumber: 1) + if self.enabled != false { + try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } if !self.address.isEmpty { try visitor.visitSingularStringField(value: self.address, fieldNumber: 2) @@ -888,7 +888,7 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message } static func ==(lhs: ModuleConfig.MQTTConfig, rhs: ModuleConfig.MQTTConfig) -> Bool { - if lhs.disabled != rhs.disabled {return false} + if lhs.enabled != rhs.enabled {return false} if lhs.address != rhs.address {return false} if lhs.username != rhs.username {return false} if lhs.password != rhs.password {return false} diff --git a/Meshtastic/Protobufs/portnums.pb.swift b/Meshtastic/Protobufs/portnums.pb.swift index 10cef65e..1f0ae3a2 100644 --- a/Meshtastic/Protobufs/portnums.pb.swift +++ b/Meshtastic/Protobufs/portnums.pb.swift @@ -79,6 +79,7 @@ enum PortNum: SwiftProtobuf.Enum { /// /// Waypoint payloads. + /// Payload is a [Waypoint](/docs/developers/protobufs/api#waypoint) message case waypointApp // = 8 /// diff --git a/Meshtastic/Views/Messages/Contacts.swift b/Meshtastic/Views/Messages/Contacts.swift index 2b724f14..c27485a3 100644 --- a/Meshtastic/Views/Messages/Contacts.swift +++ b/Meshtastic/Views/Messages/Contacts.swift @@ -11,6 +11,8 @@ struct Contacts: View { @Environment(\.managedObjectContext) var context @EnvironmentObject var bleManager: BLEManager + + @State var onboarding = true @FetchRequest( sortDescriptors: [NSSortDescriptor(key: "longName", ascending: true)], diff --git a/Meshtastic/Views/Nodes/LocationHistory.swift b/Meshtastic/Views/Nodes/LocationHistory.swift index 0d132998..52165e2d 100644 --- a/Meshtastic/Views/Nodes/LocationHistory.swift +++ b/Meshtastic/Views/Nodes/LocationHistory.swift @@ -88,12 +88,9 @@ struct LocationHistory: View { .font(.subheadline) .foregroundColor(.accentColor) .symbolRenderingMode(.hierarchical) - Text("Time:") - .font(.caption) DateTimeText(dateTime: mappin.time) .foregroundColor(.gray) .font(.caption) - } } } diff --git a/Meshtastic/Views/Onboarding.swift b/Meshtastic/Views/Onboarding.swift new file mode 100644 index 00000000..89769c08 --- /dev/null +++ b/Meshtastic/Views/Onboarding.swift @@ -0,0 +1,26 @@ +// +// Onboarding.swift +// Meshtastic +// +// Copyright(c) Garth Vander Houwen 8/21/22. +// + +import SwiftUI + +struct Onboarding: View { + + var body: some View { + + VStack { + + Text("🗺️ Set Your Region to Mesh and Message") + .font(.largeTitle) + .foregroundColor(.red) + + Text("Your region is currently set to UNSET, please set your device to the appropriate region under Settings > LoRa, after you set your region your Meshtastic device will reboot.") + .font(.callout) + .padding() + + } + } +}