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)
|
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 {
|
public func receiveRemoteNotification(userInfo: [AnyHashable: Any]) async {
|
||||||
await withCheckedContinuation { continuation in
|
await delegate.receiveRemoteNotification(for: self, userInfo: userInfo)
|
||||||
self.receiveRemoteNotification(userInfo: userInfo) {
|
|
||||||
continuation.resume()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func refreshAll() async throws {
|
public func refreshAll() async throws {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import Secrets
|
||||||
|
|
||||||
var refreshProgress: DownloadProgress { get }
|
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 refreshAll(for account: Account) async throws
|
||||||
func syncArticleStatus(for account: Account) async throws
|
func syncArticleStatus(for account: Account) async throws
|
||||||
|
|
|
@ -69,7 +69,16 @@ enum CloudKitAccountDelegateError: LocalizedError {
|
||||||
database = SyncDatabase(databasePath: databasePath)
|
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)
|
let op = CloudKitRemoteNotificationOperation(accountZone: accountZone, articlesZone: articlesZone, userInfo: userInfo)
|
||||||
op.completionBlock = { mainThreadOperaion in
|
op.completionBlock = { mainThreadOperaion in
|
||||||
completion()
|
completion()
|
||||||
|
|
|
@ -75,8 +75,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||||
completion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshAll(for account: Account) async throws {
|
func refreshAll(for account: Account) async throws {
|
||||||
|
|
|
@ -104,8 +104,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
|
||||||
|
|
||||||
// MARK: Account API
|
// MARK: Account API
|
||||||
|
|
||||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||||
completion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshAll(for account: Account) async throws {
|
func refreshAll(for account: Account) async throws {
|
||||||
|
|
|
@ -40,8 +40,7 @@ final class LocalAccountDelegate: AccountDelegate {
|
||||||
|
|
||||||
let refreshProgress = DownloadProgress(numberOfTasks: 0)
|
let refreshProgress = DownloadProgress(numberOfTasks: 0)
|
||||||
|
|
||||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||||
completion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshAll(for account: Account) async throws {
|
func refreshAll(for account: Account) async throws {
|
||||||
|
|
|
@ -57,10 +57,9 @@ final class NewsBlurAccountDelegate: AccountDelegate {
|
||||||
database = SyncDatabase(databasePath: dataFolder.appending("/DB.sqlite3"))
|
database = SyncDatabase(databasePath: dataFolder.appending("/DB.sqlite3"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||||
completion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshAll(for account: Account) async throws {
|
func refreshAll(for account: Account) async throws {
|
||||||
|
|
||||||
try await withCheckedThrowingContinuation { continuation in
|
try await withCheckedThrowingContinuation { continuation in
|
||||||
|
|
|
@ -101,10 +101,9 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
|
||||||
self.variant = variant
|
self.variant = variant
|
||||||
}
|
}
|
||||||
|
|
||||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async {
|
||||||
completion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshAll(for account: Account) async throws {
|
func refreshAll(for account: Account) async throws {
|
||||||
|
|
||||||
try await withCheckedThrowingContinuation { continuation in
|
try await withCheckedThrowingContinuation { continuation in
|
||||||
|
|
Loading…
Reference in New Issue