File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,15 +79,25 @@ struct SyncRecordMapper {
7979 }
8080
8181 // Encode complex structs as JSON Data
82- if let sshData = try ? encoder. encode ( connection. sshConfig) {
82+ do {
83+ let sshData = try encoder. encode ( connection. sshConfig)
8384 record [ " sshConfigJson " ] = sshData as CKRecordValue
85+ } catch {
86+ logger. warning ( " Failed to encode SSH config for sync: \( error. localizedDescription) " )
8487 }
85- if let sslData = try ? encoder. encode ( connection. sslConfig) {
88+ do {
89+ let sslData = try encoder. encode ( connection. sslConfig)
8690 record [ " sslConfigJson " ] = sslData as CKRecordValue
91+ } catch {
92+ logger. warning ( " Failed to encode SSL config for sync: \( error. localizedDescription) " )
8793 }
88- if !connection. additionalFields. isEmpty,
89- let fieldsData = try ? encoder. encode ( connection. additionalFields) {
90- record [ " additionalFieldsJson " ] = fieldsData as CKRecordValue
94+ if !connection. additionalFields. isEmpty {
95+ do {
96+ let fieldsData = try encoder. encode ( connection. additionalFields)
97+ record [ " additionalFieldsJson " ] = fieldsData as CKRecordValue
98+ } catch {
99+ logger. warning ( " Failed to encode additional fields for sync: \( error. localizedDescription) " )
100+ }
91101 }
92102
93103 return record
Original file line number Diff line number Diff line change @@ -1042,10 +1042,13 @@ struct ConnectionFormView: View { // swiftlint:disable:this type_body_length
10421042
10431043 private func deleteConnection( ) {
10441044 guard let id = connectionId else { return }
1045- SyncChangeTracker . shared. markDeleted ( . connection, id: id. uuidString)
10461045 var savedConnections = storage. loadConnections ( )
1046+ let hadConnection = savedConnections. contains { $0. id == id }
10471047 savedConnections. removeAll { $0. id == id }
10481048 storage. saveConnections ( savedConnections)
1049+ if hadConnection {
1050+ SyncChangeTracker . shared. markDeleted ( . connection, id: id. uuidString)
1051+ }
10491052 NSApplication . shared. closeWindows ( withId: " connection-form " )
10501053 NotificationCenter . default. post ( name: . connectionUpdated, object: nil )
10511054 }
You can’t perform that action at this time.
0 commit comments