Update notifications after policy/request-change (IOS-241)
This commit is contained in:
parent
48f58642ac
commit
d87deffa6d
|
@ -156,7 +156,7 @@ class NotificationPolicyViewController: UIViewController {
|
||||||
filterPrivateMentions: viewModel.privateMentions
|
filterPrivateMentions: viewModel.privateMentions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
NotificationCenter.default.post(name: .notificationFilteringChanged, object: nil)
|
||||||
} catch {
|
} catch {
|
||||||
//TODO: Error Handling
|
//TODO: Error Handling
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,6 @@ extension NotificationRequestsTableViewController: NotificationRequestTableViewC
|
||||||
cell.rejectNotificationRequestButton.isUserInteractionEnabled = false
|
cell.rejectNotificationRequestButton.isUserInteractionEnabled = false
|
||||||
cell.acceptNotificationRequestButton.isUserInteractionEnabled = false
|
cell.acceptNotificationRequestButton.isUserInteractionEnabled = false
|
||||||
|
|
||||||
//TODO: Send request, update cell, reload notification requests AND general notifications
|
|
||||||
Task { [weak self] in
|
Task { [weak self] in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
do {
|
do {
|
||||||
|
@ -110,6 +109,8 @@ extension NotificationRequestsTableViewController: NotificationRequestTableViewC
|
||||||
|
|
||||||
let requests = try await context.apiService.notificationRequests(authenticationBox: authContext.mastodonAuthenticationBox).value
|
let requests = try await context.apiService.notificationRequests(authenticationBox: authContext.mastodonAuthenticationBox).value
|
||||||
|
|
||||||
|
NotificationCenter.default.post(name: .notificationFilteringChanged, object: nil)
|
||||||
|
|
||||||
if requests.count > 0 {
|
if requests.count > 0 {
|
||||||
|
|
||||||
await MainActor.run { [weak self] in
|
await MainActor.run { [weak self] in
|
||||||
|
@ -154,6 +155,8 @@ extension NotificationRequestsTableViewController: NotificationRequestTableViewC
|
||||||
|
|
||||||
let requests = try await context.apiService.notificationRequests(authenticationBox: authContext.mastodonAuthenticationBox).value
|
let requests = try await context.apiService.notificationRequests(authenticationBox: authContext.mastodonAuthenticationBox).value
|
||||||
|
|
||||||
|
NotificationCenter.default.post(name: .notificationFilteringChanged, object: nil)
|
||||||
|
|
||||||
if requests.count > 0 {
|
if requests.count > 0 {
|
||||||
|
|
||||||
await MainActor.run { [weak self] in
|
await MainActor.run { [weak self] in
|
||||||
|
|
|
@ -89,6 +89,17 @@ final class NotificationTimelineViewModel {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
|
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(Self.notificationFilteringChanged(_:)), name: .notificationFilteringChanged, object: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
//MARK: - Notifications
|
||||||
|
|
||||||
|
@objc func notificationFilteringChanged(_ notification: Notification) {
|
||||||
|
dataController.records = []
|
||||||
|
Task { [weak self] in
|
||||||
|
await self?.loadLatest()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,3 +142,7 @@ extension APIService {
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension Notification.Name {
|
||||||
|
public static let notificationFilteringChanged = Notification.Name(rawValue: "org.joinmastodon.app.notificationFilteringsChanged")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue