Convert receiveRemoteNotification to async/await.
This commit is contained in:
parent
402ee970cc
commit
887e35068e
@ -408,17 +408,9 @@ public enum FetchType {
|
||||
|
||||
grantingType.requestOAuthAccessToken(with: response, transport: transport, secretsProvider: secretsProvider, completion: completion)
|
||||
}
|
||||
|
||||
private func receiveRemoteNotification(userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
delegate.receiveRemoteNotification(for: self, userInfo: userInfo, completion: completion)
|
||||
}
|
||||
|
||||
public func receiveRemoteNotification(userInfo: [AnyHashable: Any]) async {
|
||||
await withCheckedContinuation { continuation in
|
||||
self.receiveRemoteNotification(userInfo: userInfo) {
|
||||
continuation.resume()
|
||||
}
|
||||
}
|
||||
await delegate.receiveRemoteNotification(for: self, userInfo: userInfo)
|
||||
}
|
||||
|
||||
public func refreshAll() async throws {
|
||||
|
@ -23,7 +23,7 @@ import Secrets
|
||||
|
||||
var refreshProgress: DownloadProgress { get }
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void)
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async
|
||||
|
||||
func refreshAll(for account: Account) async throws
|
||||
func syncArticleStatus(for account: Account) async throws
|
||||
|
@ -69,7 +69,16 @@ enum CloudKitAccountDelegateError: LocalizedError {
|
||||
database = SyncDatabase(databasePath: databasePath)
|
||||
}
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||
|
||||
await withCheckedContinuation { continuation in
|
||||
self.receiveRemoteNotification(for: account, userInfo: userInfo) {
|
||||
continuation.resume()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
let op = CloudKitRemoteNotificationOperation(accountZone: accountZone, articlesZone: articlesZone, userInfo: userInfo)
|
||||
op.completionBlock = { mainThreadOperaion in
|
||||
completion()
|
||||
|
@ -75,8 +75,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
|
||||
|
||||
}
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
completion()
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||
}
|
||||
|
||||
func refreshAll(for account: Account) async throws {
|
||||
|
@ -104,8 +104,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
|
||||
|
||||
// MARK: Account API
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
completion()
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||
}
|
||||
|
||||
func refreshAll(for account: Account) async throws {
|
||||
|
@ -40,8 +40,7 @@ final class LocalAccountDelegate: AccountDelegate {
|
||||
|
||||
let refreshProgress = DownloadProgress(numberOfTasks: 0)
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
completion()
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||
}
|
||||
|
||||
func refreshAll(for account: Account) async throws {
|
||||
|
@ -57,10 +57,9 @@ final class NewsBlurAccountDelegate: AccountDelegate {
|
||||
database = SyncDatabase(databasePath: dataFolder.appending("/DB.sqlite3"))
|
||||
}
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
completion()
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||
}
|
||||
|
||||
|
||||
func refreshAll(for account: Account) async throws {
|
||||
|
||||
try await withCheckedThrowingContinuation { continuation in
|
||||
|
@ -101,10 +101,9 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
|
||||
self.variant = variant
|
||||
}
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
completion()
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||
}
|
||||
|
||||
|
||||
func refreshAll(for account: Account) async throws {
|
||||
|
||||
try await withCheckedThrowingContinuation { continuation in
|
||||
|
Loading…
x
Reference in New Issue
Block a user