mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #252 from meshtastic/2.0.6_Working_Changes
2.0.6 working changes
This commit is contained in:
commit
fa54be085a
5 changed files with 54 additions and 29 deletions
|
|
@ -39,6 +39,8 @@
|
|||
</uniquenessConstraints>
|
||||
</entity>
|
||||
<entity name="DeviceConfigEntity" representedClassName="DeviceConfigEntity" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="buttonGpio" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="buzzerGpio" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="debugLogEnabled" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||
<attribute name="role" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="serialEnabled" optional="YES" attributeType="Boolean" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
|
|
@ -59,6 +61,7 @@
|
|||
<attribute name="enabled" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||
<attribute name="output" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="outputMilliseconds" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="usePWM" optional="YES" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES"/>
|
||||
<relationship name="externalNotificationConfigNode" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="NodeInfoEntity" inverseName="externalNotificationConfig" inverseEntity="NodeInfoEntity"/>
|
||||
</entity>
|
||||
<entity name="LoRaConfigEntity" representedClassName="LoRaConfigEntity" syncable="YES" codeGenerationType="class">
|
||||
|
|
@ -251,4 +254,13 @@
|
|||
<fetchRequest name="fetchedPropertyFetchRequest" entity="MessageEntity" predicateString="((toUser.num == $FETCH_SOURCE.num) OR (fromUser.num == $FETCH_SOURCE.num)) AND toUser != nil AND fromUser != nil AND isEmoji == false AND admin = false"/>
|
||||
</fetchedProperty>
|
||||
</entity>
|
||||
<entity name="WaypointEntity" representedClassName="WaypointEntity" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="expire" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="id" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="latitudeI" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="locked" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||
<attribute name="longDescription" optional="YES" attributeType="String" maxValueString="100"/>
|
||||
<attribute name="longitudeI" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="name" optional="YES" attributeType="String" maxValueString="30"/>
|
||||
</entity>
|
||||
</model>
|
||||
|
|
@ -29,7 +29,7 @@ struct ChannelMessageList: View {
|
|||
@State private var deleteMessageId: Int64 = 0
|
||||
@State private var replyMessageId: Int64 = 0
|
||||
@State private var sendPositionWithMessage: Bool = false
|
||||
@State private var refreshId = UUID()
|
||||
//@State private var refreshId = UUID()
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
|
|
@ -218,13 +218,13 @@ struct ChannelMessageList: View {
|
|||
.scrollDismissesKeyboard(.immediately)
|
||||
.onAppear(perform: {
|
||||
self.bleManager.context = context
|
||||
refreshId = UUID()
|
||||
// refreshId = UUID()
|
||||
if channel.allPrivateMessages.count > 0 {
|
||||
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
|
||||
}
|
||||
})
|
||||
.onChange(of: channel.allPrivateMessages, perform: { messages in
|
||||
refreshId = UUID()
|
||||
// refreshId = UUID()
|
||||
if channel.allPrivateMessages.count > 0 {
|
||||
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,8 +86,10 @@ struct Contacts: View {
|
|||
.contextMenu {
|
||||
Button {
|
||||
channel.mute = !channel.mute
|
||||
|
||||
do {
|
||||
try context.save()
|
||||
self.context.refresh(channel, mergeChanges: true)
|
||||
} catch {
|
||||
context.rollback()
|
||||
print("💥 Save Channel Mute Error")
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ struct UserMessageList: View {
|
|||
@State private var deleteMessageId: Int64 = 0
|
||||
@State private var replyMessageId: Int64 = 0
|
||||
@State private var sendPositionWithMessage: Bool = false
|
||||
@State private var refreshId = UUID()
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
|
|
@ -220,13 +219,11 @@ struct UserMessageList: View {
|
|||
.scrollDismissesKeyboard(.immediately)
|
||||
.onAppear(perform: {
|
||||
self.bleManager.context = context
|
||||
refreshId = UUID()
|
||||
if user.messageList.count > 0 {
|
||||
scrollView.scrollTo(user.messageList.last!.messageId)
|
||||
}
|
||||
})
|
||||
.onChange(of: user.messageList, perform: { messages in
|
||||
refreshId = UUID()
|
||||
if user.messageList.count > 0 {
|
||||
scrollView.scrollTo(user.messageList.last!.messageId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ struct ExternalNotificationConfig: View {
|
|||
@State var alertBell = false
|
||||
@State var alertMessage = false
|
||||
@State var active = false
|
||||
@State var usePWM = true
|
||||
@State var output = 0
|
||||
@State var outputMilliseconds = 0
|
||||
|
||||
|
|
@ -79,36 +80,43 @@ struct ExternalNotificationConfig: View {
|
|||
Label("Alert when receiving a message", systemImage: "message")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
}
|
||||
Section(header: Text("GPIO")) {
|
||||
Toggle(isOn: $active) {
|
||||
Label("Active", systemImage: "togglepower")
|
||||
Toggle(isOn: $usePWM) {
|
||||
Label("Use PWM Buzzer", systemImage: "light.beacon.max.fill")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
Text("Specifies whether the external circuit is triggered when the device's GPIO is low or high.")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
Picker("GPIO to monitor", selection: $output) {
|
||||
ForEach(0..<40) {
|
||||
if $0 == 0 {
|
||||
Text("Unset")
|
||||
} else {
|
||||
Text("Pin \($0)")
|
||||
}
|
||||
if !usePWM {
|
||||
Section(header: Text("GPIO")) {
|
||||
Toggle(isOn: $active) {
|
||||
Label("Active", systemImage: "togglepower")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
Text("Specifies whether the external circuit is triggered when the device's GPIO is low or high.")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.visible)
|
||||
Picker("GPIO to monitor", selection: $output) {
|
||||
ForEach(0..<40) {
|
||||
if $0 == 0 {
|
||||
Text("Unset")
|
||||
} else {
|
||||
Text("Pin \($0)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
Text("Specifies the GPIO that your external circuit is attached to on the device.")
|
||||
.font(.caption)
|
||||
Picker("GPIO Output Duration", selection: $outputMilliseconds ) {
|
||||
ForEach(OutputIntervals.allCases) { oi in
|
||||
Text(oi.description)
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
Text("Specifies the GPIO that your external circuit is attached to on the device.")
|
||||
.font(.caption)
|
||||
Picker("GPIO Output Duration", selection: $outputMilliseconds ) {
|
||||
ForEach(OutputIntervals.allCases) { oi in
|
||||
Text(oi.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
Text("Specifies how long the monitored GPIO should output.")
|
||||
.font(.caption)
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
Text("Specifies how long the monitored GPIO should output.")
|
||||
.font(.caption)
|
||||
}
|
||||
|
||||
}
|
||||
.disabled(bleManager.connectedPeripheral == nil)
|
||||
Button {
|
||||
|
|
@ -157,6 +165,7 @@ struct ExternalNotificationConfig: View {
|
|||
self.active = node?.externalNotificationConfig?.active ?? false
|
||||
self.output = Int(node?.externalNotificationConfig?.output ?? 0)
|
||||
self.outputMilliseconds = Int(node?.externalNotificationConfig?.outputMilliseconds ?? 0)
|
||||
self.usePWM = node?.externalNotificationConfig?.usePWM ?? true
|
||||
self.hasChanges = false
|
||||
}
|
||||
.onChange(of: enabled) { newEnabled in
|
||||
|
|
@ -189,6 +198,11 @@ struct ExternalNotificationConfig: View {
|
|||
if newOutputMs != node!.externalNotificationConfig!.outputMilliseconds { hasChanges = true }
|
||||
}
|
||||
}
|
||||
.onChange(of: usePWM) { newUsePWM in
|
||||
if node != nil && node!.externalNotificationConfig != nil {
|
||||
if newUsePWM != node!.externalNotificationConfig!.usePWM { hasChanges = true }
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue