Update protobufs, clean up qr sharing view

This commit is contained in:
Garth Vander Houwen 2022-04-23 12:57:47 -07:00
parent be8577a610
commit 48de377922
6 changed files with 180 additions and 6 deletions

View file

@ -735,7 +735,7 @@
CODE_SIGN_ENTITLEMENTS = MeshtasticClient/MeshtasticClient.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"MeshtasticClient/Preview Content\"";
DEVELOPMENT_TEAM = GCH7VS5Y9R;
ENABLE_PREVIEWS = YES;
@ -767,7 +767,7 @@
CODE_SIGN_ENTITLEMENTS = MeshtasticClient/MeshtasticClient.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"MeshtasticClient/Preview Content\"";
DEVELOPMENT_TEAM = GCH7VS5Y9R;
ENABLE_PREVIEWS = YES;

View file

@ -1148,7 +1148,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
context!.rollback()
let nsError = error as NSError
print("💥 Unresolved Core Data error in Send Message Function \(nsError)")
print("💥 Unresolved Core Data error in Send Message Function it is likely that your database is corrupted deleting and re-installing the app should clear the corrupted data. Error: \(nsError)")
if meshLoggingEnabled { MeshLogger.log("💥 Unresolved Core Data error \(nsError)") }
}
}

View file

@ -20,6 +20,61 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
typealias Version = _2
}
///
/// TODO: REPLACE
enum ScreenFonts: SwiftProtobuf.Enum {
typealias RawValue = Int
///
/// TODO: REPLACE
case fontSmall // = 0
///
/// TODO: REPLACE
case fontMedium // = 1
///
/// TODO: REPLACE
case fontLarge // = 2
case UNRECOGNIZED(Int)
init() {
self = .fontSmall
}
init?(rawValue: Int) {
switch rawValue {
case 0: self = .fontSmall
case 1: self = .fontMedium
case 2: self = .fontLarge
default: self = .UNRECOGNIZED(rawValue)
}
}
var rawValue: Int {
switch self {
case .fontSmall: return 0
case .fontMedium: return 1
case .fontLarge: return 2
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension ScreenFonts: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
static var allCases: [ScreenFonts] = [
.fontSmall,
.fontMedium,
.fontLarge,
]
}
#endif // swift(>=4.2)
///
/// This message is never sent over the wire, but it is used for serializing DB
/// state to flash in the device code
@ -127,13 +182,56 @@ struct ChannelFile {
init() {}
}
///
/// This can be used for customizing the firmware distribution. If populated,
/// show a secondary bootup screen with cuatom logo and text for 2.5 seconds.
struct OEMStore {
// 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.
///
/// The Logo width in Px
var oemIconWidth: UInt32 = 0
///
/// The Logo height in Px
var oemIconHeight: UInt32 = 0
///
/// The Logo in xbm bytechar format
var oemIconBits: Data = Data()
///
/// Use this font for the OEM text.
var oemFont: ScreenFonts = .fontSmall
///
/// Use this font for the OEM text.
var oemText: String = String()
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
}
#if swift(>=5.5) && canImport(_Concurrency)
extension ScreenFonts: @unchecked Sendable {}
extension DeviceState: @unchecked Sendable {}
extension ChannelFile: @unchecked Sendable {}
extension OEMStore: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime.
extension ScreenFonts: SwiftProtobuf._ProtoNameProviding {
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "FONT_SMALL"),
1: .same(proto: "FONT_MEDIUM"),
2: .same(proto: "FONT_LARGE"),
]
}
extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = "DeviceState"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
@ -289,3 +387,59 @@ extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
return true
}
}
extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = "OEMStore"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "oem_icon_width"),
2: .standard(proto: "oem_icon_height"),
3: .standard(proto: "oem_icon_bits"),
4: .standard(proto: "oem_font"),
5: .standard(proto: "oem_text"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// 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.decodeSingularUInt32Field(value: &self.oemIconWidth) }()
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.oemIconHeight) }()
case 3: try { try decoder.decodeSingularBytesField(value: &self.oemIconBits) }()
case 4: try { try decoder.decodeSingularEnumField(value: &self.oemFont) }()
case 5: try { try decoder.decodeSingularStringField(value: &self.oemText) }()
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.oemIconWidth != 0 {
try visitor.visitSingularUInt32Field(value: self.oemIconWidth, fieldNumber: 1)
}
if self.oemIconHeight != 0 {
try visitor.visitSingularUInt32Field(value: self.oemIconHeight, fieldNumber: 2)
}
if !self.oemIconBits.isEmpty {
try visitor.visitSingularBytesField(value: self.oemIconBits, fieldNumber: 3)
}
if self.oemFont != .fontSmall {
try visitor.visitSingularEnumField(value: self.oemFont, fieldNumber: 4)
}
if !self.oemText.isEmpty {
try visitor.visitSingularStringField(value: self.oemText, fieldNumber: 5)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: OEMStore, rhs: OEMStore) -> Bool {
if lhs.oemIconWidth != rhs.oemIconWidth {return false}
if lhs.oemIconHeight != rhs.oemIconHeight {return false}
if lhs.oemIconBits != rhs.oemIconBits {return false}
if lhs.oemFont != rhs.oemFont {return false}
if lhs.oemText != rhs.oemText {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

View file

@ -1362,6 +1362,10 @@ struct RadioConfig {
case baud460800 // = 9
case baud576000 // = 10
case baud921600 // = 11
case baud110 // = 12
case baud300 // = 13
case baud600 // = 14
case baud1200 // = 15
case UNRECOGNIZED(Int)
init() {
@ -1382,6 +1386,10 @@ struct RadioConfig {
case 9: self = .baud460800
case 10: self = .baud576000
case 11: self = .baud921600
case 12: self = .baud110
case 13: self = .baud300
case 14: self = .baud600
case 15: self = .baud1200
default: self = .UNRECOGNIZED(rawValue)
}
}
@ -1400,6 +1408,10 @@ struct RadioConfig {
case .baud460800: return 9
case .baud576000: return 10
case .baud921600: return 11
case .baud110: return 12
case .baud300: return 13
case .baud600: return 14
case .baud1200: return 15
case .UNRECOGNIZED(let i): return i
}
}
@ -1550,6 +1562,10 @@ extension RadioConfig.UserPreferences.Serial_Baud: CaseIterable {
.baud460800,
.baud576000,
.baud921600,
.baud110,
.baud300,
.baud600,
.baud1200,
]
}
@ -2454,6 +2470,10 @@ extension RadioConfig.UserPreferences.Serial_Baud: SwiftProtobuf._ProtoNameProvi
9: .same(proto: "BAUD_460800"),
10: .same(proto: "BAUD_576000"),
11: .same(proto: "BAUD_921600"),
12: .same(proto: "BAUD_110"),
13: .same(proto: "BAUD_300"),
14: .same(proto: "BAUD_600"),
15: .same(proto: "BAUD_1200"),
]
}

View file

@ -158,7 +158,7 @@ struct AppSettings: View {
GeometryReader { _ in
List {
Form {
Section(header: Text("USER DETAILS")) {
HStack {

View file

@ -1,5 +1,5 @@
//
// Channel.swift
// ShareChannel.swift
// MeshtasticClient
//
// Created by Garth Vander Houwen on 4/8/22.
@ -18,7 +18,7 @@ struct QrCodeImage {
let filter = CIFilter.qrCodeGenerator()
filter.setValue(data, forKey: "inputMessage")
let transform = CGAffineTransform(scaleX: 15, y: 15)
let transform = CGAffineTransform(scaleX: 20, y: 20)
if let outputImage = filter.outputImage?.transformed(by: transform) {
if let image = context.createCGImage(
outputImage,