Skip to content

Commit

Permalink
fix: issue build
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Feb 10, 2022
1 parent 0155e64 commit 0129eb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
@objc func appMovedToForeground() {
DispatchQueue.main.async {
print("✨ Capacitor-updater: Check for update in the server")
let url = URL(string: autoUpdateUrl)!
let res = implementation.getLatest(url: url)
let url = URL(string: self.autoUpdateUrl)!
let res = self.implementation.getLatest(url: url)
if (res == nil) {
return
}
guard let downloadUrl = URL(string: res?.url ?? "") else {
return
}
let currentVersion = implementation.getVersionName()
let currentVersion = self.implementation.getVersionName()
let failingVersion = UserDefaults.standard.string(forKey: "failingVersion") ?? ""
let newVersion = res?.version ?? ""
if (newVersion != "" && newVersion != currentVersion && newVersion != failingVersion) {
let dl = implementation.download(url: downloadUrl)
let dl = self.implementation.download(url: downloadUrl)
print("✨ Capacitor-updater: New version: " + newVersion + " found. Current is " + (currentVersion == "" ? "builtin" : currentVersion) + ", next backgrounding will trigger update.")
UserDefaults.standard.set(dl, forKey: "nextVersion")
UserDefaults.standard.set(newVersion, forKey: "nextVersionName")
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capacitor-updater",
"version": "1.1.5",
"version": "1.1.6",
"license": "AGPL-3.0-only",
"description": "Download app update from url",
"main": "dist/plugin.cjs.js",
Expand Down

0 comments on commit 0129eb8

Please sign in to comment.