Merge pull request #250 from meshtastic/2.0.6_Working_Changes

Updates for 2.0.6
This commit is contained in:
Garth Vander Houwen 2022-11-26 19:25:21 -08:00 committed by GitHub
commit 77da49b757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 42 deletions

View file

@ -971,7 +971,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0.5;
MARKETING_VERSION = 2.0.6;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
@ -1004,7 +1004,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0.5;
MARKETING_VERSION = 2.0.6;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;

View file

@ -882,7 +882,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
var dataMessage = DataMessage()
dataMessage.payload = try! adminPacket.serializedData()
dataMessage.portnum = PortNum.adminApp
meshPacket.decoded = dataMessage
var toRadio: ToRadio!

View file

@ -105,41 +105,3 @@ public func clearCoreDataDatabase(context: NSManagedObjectContext) {
}
}
}
public func setChannelMute(channel: Int32, mute: Bool, context: NSManagedObjectContext) {
let fetchChannelRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "ChannelEntity")
fetchChannelRequest.predicate = NSPredicate(format: "index == %lld", Int32(channel))
do {
let fetchedChannel = try context.fetch(fetchChannelRequest) as! [ChannelEntity]
fetchedChannel[0].mute = mute
fetchedChannel[0].objectWillChange.send()
do {
try context.save()
} catch {
context.rollback()
print("💥 Save Channel Error")
}
} catch {
print("💥 Fetch Channel Error")
}
}
public func setUserMute(num: Int64, mute: Bool, context: NSManagedObjectContext) {
let fetchUserRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "UserEntity")
fetchUserRequest.predicate = NSPredicate(format: "num == %lld", Int64(num))
do {
let fetchedUser = try context.fetch(fetchUserRequest) as! [UserEntity]
fetchedUser[0].mute = mute
do {
try context.save()
} catch {
context.rollback()
print("💥 Save User Mute Error")
}
} catch {
print("💥 Fetch User Error")
}
}

View file

@ -84,6 +84,17 @@ struct Contacts: View {
}
.frame(maxWidth: .infinity, maxHeight: 80, alignment: .leading)
.contextMenu {
Button {
channel.mute = !channel.mute
do {
try context.save()
} catch {
context.rollback()
print("💥 Save Channel Mute Error")
}
} label: {
Label(channel.mute ? "Show Alerts" : "Hide Alerts", systemImage: channel.mute ? "bell" : "bell.slash")
}
if channel.allPrivateMessages.count > 0 {
Button(role: .destructive) {
isPresentingDeleteChannelMessagesConfirm = true
@ -159,7 +170,13 @@ struct Contacts: View {
.frame(maxWidth: .infinity, maxHeight: 80, alignment: .leading)
.contextMenu {
Button {
setUserMute(num: user.num, mute: !user.mute, context: context)
user.mute = !user.mute
do {
try context.save()
} catch {
context.rollback()
print("💥 Save User Mute Error")
}
} label: {
Label(user.mute ? "Show Alerts" : "Hide Alerts", systemImage: user.mute ? "bell" : "bell.slash")
}