@capgo/capacitor-updater 4.44.0 → 4.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin
|
|
|
55
55
|
private static final String channelUrlDefault =
|
|
56
56
|
"https://api.capgo.app/channel_self";
|
|
57
57
|
|
|
58
|
-
private final String PLUGIN_VERSION = "4.
|
|
58
|
+
private final String PLUGIN_VERSION = "4.51.0";
|
|
59
59
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
60
60
|
|
|
61
61
|
private SharedPreferences.Editor editor;
|
|
@@ -169,11 +169,12 @@ public class CapacitorUpdaterPlugin
|
|
|
169
169
|
try {
|
|
170
170
|
if (
|
|
171
171
|
!"".equals(previous.getOriginalString()) &&
|
|
172
|
-
this.currentVersionNative.
|
|
172
|
+
!this.currentVersionNative.getOriginalString()
|
|
173
|
+
.equals(previous.getOriginalString())
|
|
173
174
|
) {
|
|
174
175
|
Log.i(
|
|
175
176
|
CapacitorUpdater.TAG,
|
|
176
|
-
"New native
|
|
177
|
+
"New native version detected: " + this.currentVersionNative
|
|
177
178
|
);
|
|
178
179
|
this.implementation.reset(true);
|
|
179
180
|
final List<BundleInfo> installed = this.implementation.list();
|
|
@@ -1174,6 +1175,12 @@ public class CapacitorUpdaterPlugin
|
|
|
1174
1175
|
}
|
|
1175
1176
|
|
|
1176
1177
|
public void appMovedToForeground() {
|
|
1178
|
+
final BundleInfo current =
|
|
1179
|
+
CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
1180
|
+
CapacitorUpdaterPlugin.this.implementation.sendStats(
|
|
1181
|
+
"app_moved_to_foreground",
|
|
1182
|
+
current.getVersionName()
|
|
1183
|
+
);
|
|
1177
1184
|
this._checkCancelDelay(true);
|
|
1178
1185
|
if (CapacitorUpdaterPlugin.this._isAutoUpdateEnabled()) {
|
|
1179
1186
|
this.backgroundDownload();
|
|
@@ -1182,6 +1189,12 @@ public class CapacitorUpdaterPlugin
|
|
|
1182
1189
|
}
|
|
1183
1190
|
|
|
1184
1191
|
public void appMovedToBackground() {
|
|
1192
|
+
final BundleInfo current =
|
|
1193
|
+
CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
1194
|
+
CapacitorUpdaterPlugin.this.implementation.sendStats(
|
|
1195
|
+
"app_moved_to_background",
|
|
1196
|
+
current.getVersionName()
|
|
1197
|
+
);
|
|
1185
1198
|
Log.i(CapacitorUpdater.TAG, "Checking for pending update");
|
|
1186
1199
|
try {
|
|
1187
1200
|
Gson gson = new Gson();
|
|
@@ -1237,17 +1250,23 @@ public class CapacitorUpdaterPlugin
|
|
|
1237
1250
|
}
|
|
1238
1251
|
|
|
1239
1252
|
private boolean isMainActivity() {
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
.
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1253
|
+
try {
|
|
1254
|
+
Context mContext = this.getContext();
|
|
1255
|
+
ActivityManager activityManager =
|
|
1256
|
+
(ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
|
1257
|
+
List<ActivityManager.AppTask> runningTasks =
|
|
1258
|
+
activityManager.getAppTasks();
|
|
1259
|
+
ActivityManager.RecentTaskInfo runningTask = runningTasks
|
|
1260
|
+
.get(0)
|
|
1261
|
+
.getTaskInfo();
|
|
1262
|
+
String className = runningTask.baseIntent.getComponent().getClassName();
|
|
1263
|
+
String runningActivity = runningTask.topActivity.getClassName();
|
|
1264
|
+
boolean isThisAppActivity = className.equals(runningActivity);
|
|
1265
|
+
return isThisAppActivity;
|
|
1266
|
+
} catch (final Exception e) {
|
|
1267
|
+
Log.e(CapacitorUpdater.TAG, "Error getting Main Activity", e);
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1251
1270
|
}
|
|
1252
1271
|
|
|
1253
1272
|
@Override
|
|
@@ -78,7 +78,7 @@ import Foundation
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
public func getVersionName() -> String {
|
|
81
|
-
return
|
|
81
|
+
return self.version.isEmpty ? BundleInfo.ID_BUILTIN : self.version
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
public func setVersionName(version: String) -> BundleInfo {
|
|
@@ -15,7 +15,7 @@ import Version
|
|
|
15
15
|
@objc(CapacitorUpdaterPlugin)
|
|
16
16
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
17
17
|
private var implementation = CapacitorUpdater()
|
|
18
|
-
private let PLUGIN_VERSION: String = "4.
|
|
18
|
+
private let PLUGIN_VERSION: String = "4.51.0"
|
|
19
19
|
static let updateUrlDefault = "https://api.capgo.app/updates"
|
|
20
20
|
static let statsUrlDefault = "https://api.capgo.app/stats"
|
|
21
21
|
static let channelUrlDefault = "https://api.capgo.app/channel_self"
|
|
@@ -74,7 +74,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
74
74
|
} catch {
|
|
75
75
|
print("\(self.implementation.TAG) Cannot get version native \(currentVersionNative)")
|
|
76
76
|
}
|
|
77
|
-
if LatestVersionNative != "0.0.0" && currentVersionNative.
|
|
77
|
+
if LatestVersionNative != "0.0.0" && self.currentVersionNative.description != LatestVersionNative.description {
|
|
78
78
|
_ = self._reset(toLastSuccessful: false)
|
|
79
79
|
let res = implementation.list()
|
|
80
80
|
res.forEach { version in
|
|
@@ -630,6 +630,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
630
630
|
}
|
|
631
631
|
|
|
632
632
|
@objc func appMovedToForeground() {
|
|
633
|
+
let current: BundleInfo = self.implementation.getCurrentBundle()
|
|
634
|
+
self.implementation.sendStats(action: "app_moved_to_foreground", versionName: current.getVersionName())
|
|
633
635
|
if backgroundWork != nil && taskRunning {
|
|
634
636
|
backgroundWork!.cancel()
|
|
635
637
|
print("\(self.implementation.TAG) Background Timer Task canceled, Activity resumed before timer completes")
|
|
@@ -643,6 +645,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
643
645
|
}
|
|
644
646
|
|
|
645
647
|
@objc func appMovedToBackground() {
|
|
648
|
+
let current: BundleInfo = self.implementation.getCurrentBundle()
|
|
649
|
+
self.implementation.sendStats(action: "app_moved_to_background", versionName: current.getVersionName())
|
|
646
650
|
print("\(self.implementation.TAG) Check for pending update")
|
|
647
651
|
let delayUpdatePreferences = UserDefaults.standard.string(forKey: DELAY_CONDITION_PREFERENCES) ?? "[]"
|
|
648
652
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-updater",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.51.0",
|
|
4
4
|
"packageManager": "pnpm@8.2.0",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "Live update for capacitor apps",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"@types/node": "^18.15.11",
|
|
65
65
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
66
66
|
"@typescript-eslint/parser": "^5.58.0",
|
|
67
|
-
"eslint": "^8.
|
|
67
|
+
"eslint": "^8.39.0",
|
|
68
68
|
"eslint-plugin-import": "^2.27.5",
|
|
69
69
|
"prettier": "^2.8.7",
|
|
70
70
|
"prettier-plugin-java": "^2.1.0",
|
|
71
71
|
"rimraf": "^4.4.1",
|
|
72
|
-
"rollup": "^3.20.
|
|
72
|
+
"rollup": "^3.20.7",
|
|
73
73
|
"swiftlint": "^1.0.1",
|
|
74
|
-
"typescript": "^5.0.
|
|
74
|
+
"typescript": "^5.0.4"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@capacitor/core": "^4.0.0 || ^5.0.0"
|