Skip to content

Commit

Permalink
Merge pull request #1467 from planetary-social/fix-push-notification-…
Browse files Browse the repository at this point in the history
…service-crash

(Probably) fixed a crash in PushNotificationService.listen
  • Loading branch information
joshuatbrown authored Sep 6, 2024
2 parents 720c5a7 + 59e79a5 commit adb9c9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Release Notes
- Fixed a crash that could occur while Nos was in the background.
- Fixed a bug where Nos sometimes wouldn't reconnect to relays.
- Added nos.lol to the default relay list for new accounts and removed relay.snort.social.
- Show quoted notes in note cards.
Expand Down
10 changes: 8 additions & 2 deletions Nos/Service/PushNotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import Combine
@Dependency(\.persistenceController) private var persistenceController
@Dependency(\.router) private var router
@Dependency(\.analytics) private var analytics
@Dependency(\.crashReporting) private var crashReporting
@Dependency(\.userDefaults) private var userDefaults
@Dependency(\.currentUser) private var currentUser

Expand Down Expand Up @@ -91,8 +92,13 @@ import Combine
cacheName: nil
)
notificationWatcher?.delegate = self
try? await modelContext.perform {
try self.notificationWatcher?.performFetch()
await modelContext.perform { [weak self] in
do {
try self?.notificationWatcher?.performFetch()
} catch {
Log.error("Error watching notifications:")
self?.crashReporting.report(error)
}
}

let userMentionsFilter = Filter(
Expand Down

0 comments on commit adb9c9b

Please sign in to comment.