Skip to content

Commit

Permalink
fix: DispatchQueue.global for period check
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Mar 19, 2024
1 parent 366c9e7 commit e2d6cd1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,14 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
return
}
let timer = Timer.scheduledTimer(withTimeInterval: TimeInterval(periodCheckDelay), repeats: true) { _ in
let res = self.implementation.getLatest(url: url)
let current = self.implementation.getCurrentBundle()
DispatchQueue.global(qos: .background).async {
let res = self.implementation.getLatest(url: url)
let current = self.implementation.getCurrentBundle()

if res.version != current.getVersionName() {
print("\(self.implementation.TAG) New version found: \(res.version)")
self.backgroundDownload()
if res.version != current.getVersionName() {
print("\(self.implementation.TAG) New version found: \(res.version)")
self.backgroundDownload()
}
}
}
RunLoop.current.add(timer, forMode: .default)
Expand Down

0 comments on commit e2d6cd1

Please sign in to comment.