Revert "nostrdb: close database when backgrounded"
This reverts commit da2bdad18d.
This commit was reverted because it was causing crashes (Occasional `EXC_BAD_ACCESS` errors when accessing database transactions), and because the push notification extension uses Ndb in a read-only manner, which means we no longer need these changes
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
committed by
William Casarin
parent
6e0af0ba10
commit
26bd50c948
@@ -448,25 +448,18 @@ struct ContentView: View {
|
||||
break
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { obj in
|
||||
print("📙 DAMUS ACTIVE NOTIFY")
|
||||
try? damus_state.ndb.reopen()
|
||||
}
|
||||
.onChange(of: scenePhase) { (phase: ScenePhase) in
|
||||
guard let damus_state else { return }
|
||||
switch phase {
|
||||
case .background:
|
||||
print("📙 DAMUS BACKGROUNDED")
|
||||
Task { @MainActor in
|
||||
damus_state.ndb.close()
|
||||
}
|
||||
break
|
||||
case .inactive:
|
||||
print("📙 DAMUS INACTIVE")
|
||||
break
|
||||
case .active:
|
||||
print("📙 DAMUS ACTIVE")
|
||||
damus_state.pool.ping()
|
||||
guard let ds = damus_state else { return }
|
||||
ds.pool.ping()
|
||||
@unknown default:
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user