Skip to content

Commit

Permalink
fix: init version
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Mar 28, 2022
1 parent 4b6623c commit 94eeb9c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
var LatestVersionNative: Version = "0.0.0"
var currentVersionNative: Version = "0.0.0"
do {
currentVersionNative = try Version(Bundle.main.buildVersionNumber ?? "")
LatestVersionNative = try Version(UserDefaults.standard.string(forKey: "LatestVersionNative") ?? "")
currentVersionNative = try Version(Bundle.main.buildVersionNumber ?? "0.0.0")
LatestVersionNative = try Version(UserDefaults.standard.string(forKey: "LatestVersionNative") ?? "0.0.0")
} catch {
print("✨ Capacitor-updater: Cannot get version native \(currentVersionNative)")
}
Expand Down Expand Up @@ -200,10 +200,10 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
var newVersion: Version = "0.0.0"
var currentVersionNative: Version = "0.0.0"
do {
currentVersionForCompare = try Version(currentVersion)
newVersion = try Version(res?.version ?? "")
currentVersionNative = try Version(Bundle.main.buildVersionNumber ?? "")
failingVersion = try Version(UserDefaults.standard.string(forKey: "failingVersion") ?? "")
currentVersionForCompare = try Version(currentVersion == "" ? "0.0.0" : currentVersion)
newVersion = try Version(res?.version ?? "0.0.0")
currentVersionNative = try Version(Bundle.main.buildVersionNumber ?? "0.0.0")
failingVersion = try Version(UserDefaults.standard.string(forKey: "failingVersion") ?? "0.0.0")
} catch {
print("✨ Capacitor-updater: Cannot get version \(failingVersion) \(currentVersionForCompare) \(newVersion) \(currentVersionNative)")
}
Expand Down

0 comments on commit 94eeb9c

Please sign in to comment.