Merge pull request #238 from meshtastic/2.0_Alpha_Launch

Share position feature for catalyst
This commit is contained in:
Garth Vander Houwen 2022-11-16 08:22:16 -08:00 committed by GitHub
commit a769dcd5e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 12 deletions

View file

@ -230,6 +230,35 @@ struct ChannelMessageList: View {
}
})
}
#if targetEnvironment(macCatalyst)
HStack {
Spacer()
Button {
let userLongName = bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral.longName : "Unknown"
sendPositionWithMessage = true
if userSettings.meshtasticUsername.count > 0 {
typingMessage = "📍 " + userSettings.meshtasticUsername + " has shared their position with you from node " + userLongName
} else {
typingMessage = "📍 " + userLongName + " has shared their position with you."
}
} label: {
Text("Share Position")
Image(systemName: "mappin.and.ellipse")
.symbolRenderingMode(.hierarchical)
.imageScale(.large).foregroundColor(.accentColor)
}
ProgressView("Bytes: \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
.frame(width: 130)
.padding(5)
.font(.subheadline)
.accentColor(.accentColor)
.padding(.trailing)
}
#endif
HStack(alignment: .top) {
ZStack {

View file

@ -232,8 +232,35 @@ struct UserMessageList: View {
}
})
}
HStack(alignment: .top) {
#if targetEnvironment(macCatalyst)
HStack {
Spacer()
Button {
let userLongName = bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral.longName : "Unknown"
sendPositionWithMessage = true
if userSettings.meshtasticUsername.count > 0 {
typingMessage = "📍 " + userSettings.meshtasticUsername + " has shared their position with you from node " + userLongName + " and requested a response with your position."
} else {
typingMessage = "📍 " + userLongName + " has shared their position and requested a response with your position."
}
} label: {
Text("Share Position")
Image(systemName: "mappin.and.ellipse")
.symbolRenderingMode(.hierarchical)
.imageScale(.large).foregroundColor(.accentColor)
}
ProgressView("Bytes: \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
.frame(width: 130)
.padding(5)
.font(.subheadline)
.accentColor(.accentColor)
.padding(.trailing)
}
#endif
HStack(alignment: .top) {
ZStack {
let kbType = UIKeyboardType(rawValue: UserDefaults.standard.object(forKey: "keyboardType") as? Int ?? 0)
TextField("Message", text: $typingMessage, axis: .vertical)
@ -261,19 +288,13 @@ struct UserMessageList: View {
Button {
let userLongName = bleManager.connectedPeripheral != nil ? bleManager.connectedPeripheral.longName : "Unknown"
sendPositionWithMessage = true
if user.num == bleManager.broadcastNodeNum {
if userSettings.meshtasticUsername.count > 0 {
typingMessage = "📍 " + userSettings.meshtasticUsername + " has shared their position with the mesh from node " + userLongName
} else {
typingMessage = "📍 " + userLongName + " has shared their position with the mesh."
}
if userSettings.meshtasticUsername.count > 0 {
typingMessage = "📍 " + userSettings.meshtasticUsername + " has shared their position with you from node " + userLongName + " and requested a response with your position."
} else {
if userSettings.meshtasticUsername.count > 0 {
typingMessage = "📍 " + userSettings.meshtasticUsername + " has shared their position with you from node " + userLongName
} else {
typingMessage = "📍 " + userLongName + " has shared their position with you."
}
typingMessage = "📍 " + userLongName + " has shared their position and requested a response with your position."
}
} label: {
Image(systemName: "mappin.and.ellipse")
.symbolRenderingMode(.hierarchical)