Skip to content

Commit

Permalink
fix: versionBuild use override if present
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed May 12, 2023
1 parent 841ec18 commit eccc8a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public void notifyListeners(final String id, final JSObject res) {
.getPackageManager()
.getPackageInfo(this.getContext().getPackageName(), 0);
this.implementation.activity = this.getActivity();
this.implementation.versionBuild = pInfo.versionName;
this.implementation.versionBuild =
this.getConfig().getString("version", pInfo.versionName);
this.implementation.PLUGIN_VERSION = this.PLUGIN_VERSION;
this.implementation.versionCode = Integer.toString(pInfo.versionCode);
this.implementation.requestQueue =
Expand Down
2 changes: 1 addition & 1 deletion ios/Plugin/CapacitorUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ extension CustomError: LocalizedError {

@objc public class CapacitorUpdater: NSObject {

private let versionName: String = Bundle.main.versionName ?? ""
private let versionCode: String = Bundle.main.versionCode ?? ""
private let versionOs = UIDevice.current.systemVersion
private let documentsDir: URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
Expand All @@ -233,6 +232,7 @@ extension CustomError: LocalizedError {

public let TAG: String = "✨ Capacitor-updater:"
public let CAP_SERVER_PATH: String = "serverBasePath"
public var versionName: String = ""
public var customId: String = ""
public var PLUGIN_VERSION: String = ""
public let timeout: Double = 20
Expand Down
1 change: 1 addition & 0 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
} catch {
print("\(self.implementation.TAG) Cannot get version native \(currentVersionNative)")
}
implementation.versionName = getConfig().getString("version", Bundle.main.versionName)!
autoDeleteFailed = getConfig().getBoolean("autoDeleteFailed", true)
autoDeletePrevious = getConfig().getBoolean("autoDeletePrevious", true)
updateUrl = getConfig().getString("updateUrl", CapacitorUpdaterPlugin.updateUrlDefault)!
Expand Down

0 comments on commit eccc8a6

Please sign in to comment.