Update default location, don't send out empty or default location from the new Share position features

This commit is contained in:
Garth Vander Houwen 2022-02-24 07:57:08 -10:00
parent 543debbcce
commit 3f92e52778
4 changed files with 29 additions and 28 deletions

View file

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

View file

@ -897,7 +897,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
print(decodedInfo.packet.decoded.requestID)
print(decodedInfo.packet.priority)
//let mes = routingMessage.
//let error = routingMessage.errorReason
let error = routingMessage.errorReason
//routingMessage.routeRequest
}
@ -1111,7 +1111,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
let fromNodeNum = connectedPeripheral.num
if fromNodeNum <= 0 {
if fromNodeNum <= 0 || (LocationHelper.currentLocation.latitude == LocationHelper.DefaultLocation.latitude && LocationHelper.currentLocation.longitude == LocationHelper.DefaultLocation.longitude) {
return false
}
@ -1199,6 +1199,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
// Send a position out to the mesh if "share location with the mesh" is enabled in settings
if userSettings!.provideLocation {
let success = sendPosition(destNum: connectedPeripheral.num, wantResponse: false)
if !success {

View file

@ -4,8 +4,8 @@ class LocationHelper: NSObject, ObservableObject {
static let shared = LocationHelper()
// Mount Rainier
static let DefaultLocation = CLLocationCoordinate2D(latitude: 46.879967, longitude: -121.726906)
// Apple Park ° N, 122.0090° W
static let DefaultLocation = CLLocationCoordinate2D(latitude: 37.3346, longitude: -122.0090)
static let DefaultAltitude = CLLocationDistance(integerLiteral: 0)

View file

@ -87,28 +87,28 @@ struct NodeList: View {
}
.padding([.leading, .top, .bottom])
}
.swipeActions {
Button {
context.delete(node)
do {
try context.save()
print("Successfully Deleted NodeInfoEntiy: \(node.num)")
} catch {
print("Failed to save context after deleting NodeInfoEntity Num: \(node.num)")
}
} label: {
Label("Delete from app", systemImage: "trash")
}
.tint(.red)
}
// .swipeActions {
//
// Button {
//
// context.delete(node)
//
// do {
//
// try context.save()
// print("Successfully Deleted NodeInfoEntiy: \(node.num)")
//
// } catch {
//
// print("Failed to save context after deleting NodeInfoEntity Num: \(node.num)")
// }
//
// } label: {
//
// Label("Delete from app", systemImage: "trash")
// }
// .tint(.red)
// }
}
}
}