@@ -151,7 +151,10 @@ private extension SignalManager {
151
151
@objc func appWillTerminate( ) {
152
152
configuration. logHandler? . log ( . debug, message: #function)
153
153
154
- // run backup in background task to avoid blocking main thread while ensureing app stays open during write
154
+ #if os(watchOS) || os(macOS)
155
+ self . signalCache. backupCache ( )
156
+ #else
157
+ // run backup in background task to avoid blocking main thread while ensuring app stays open during write
155
158
let backgroundTaskID = UIApplication . shared. beginBackgroundTask ( )
156
159
DispatchQueue . global ( qos: . background) . async {
157
160
self . signalCache. backupCache ( )
@@ -160,6 +163,7 @@ private extension SignalManager {
160
163
UIApplication . shared. endBackgroundTask ( backgroundTaskID)
161
164
}
162
165
}
166
+ #endif
163
167
}
164
168
165
169
/// WatchOS doesn't have a notification before it's killed, so we have to use background/foreground
@@ -185,7 +189,10 @@ private extension SignalManager {
185
189
sendTimer? . invalidate ( )
186
190
sendTimer = nil
187
191
188
- // run backup in background task to avoid blocking main thread while ensureing app stays open during write
192
+ #if os(watchOS) || os(macOS)
193
+ self . signalCache. backupCache ( )
194
+ #else
195
+ // run backup in background task to avoid blocking main thread while ensuring app stays open during write
189
196
let backgroundTaskID = UIApplication . shared. beginBackgroundTask ( )
190
197
DispatchQueue . global ( qos: . background) . async {
191
198
self . signalCache. backupCache ( )
@@ -194,6 +201,7 @@ private extension SignalManager {
194
201
UIApplication . shared. endBackgroundTask ( backgroundTaskID)
195
202
}
196
203
}
204
+ #endif
197
205
}
198
206
#endif
199
207
}
0 commit comments