Skip to content

Commit

Permalink
Fix send event method
Browse files Browse the repository at this point in the history
  • Loading branch information
armandsLa committed Mar 31, 2024
1 parent 25ca097 commit 5cbf63a
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions ios/Classes/HomeWidgetBackgroundWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,17 @@ public struct HomeWidgetBackgroundWorker {
}

static func sendEvent(url: URL?, appGroup: String) async {
DispatchQueue.main.async {
let preferences = UserDefaults.init(suiteName: appGroup)
let callback = preferences?.object(forKey: callbackKey) as! Int64

channel?.invokeMethod(
"",
arguments: [
callback,
url?.absoluteString,
])
guard let _channel = channel else {
return
}
let preferences = UserDefaults.init(suiteName: appGroup)
guard let _callback = preferences?.object(forKey: callbackKey) as? Int64 else {
return
}
await withCheckedContinuation { continuation in
_channel.invokeMethod("", arguments: [_callback, url?.absoluteString]) { _ in
continuation.resume()
}
}
}
}

0 comments on commit 5cbf63a

Please sign in to comment.