@capgo/capacitor-updater 6.14.25 → 6.14.29
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.
- package/CapgoCapacitorUpdater.podspec +3 -2
- package/Package.swift +2 -2
- package/README.md +341 -74
- package/android/build.gradle +20 -8
- package/android/proguard-rules.pro +22 -5
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +52 -16
- package/android/src/main/java/ee/forgr/capacitor_updater/Callback.java +2 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1196 -514
- package/android/src/main/java/ee/forgr/capacitor_updater/{CapacitorUpdater.java → CapgoUpdater.java} +522 -154
- package/android/src/main/java/ee/forgr/capacitor_updater/{CryptoCipher.java → CryptoCipherV1.java} +17 -9
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipherV2.java +15 -26
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +0 -3
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +260 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +300 -119
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +63 -25
- package/android/src/main/java/ee/forgr/capacitor_updater/Logger.java +338 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeDetector.java +72 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +169 -0
- package/dist/docs.json +652 -63
- package/dist/esm/definitions.d.ts +265 -15
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/history.d.ts +1 -0
- package/dist/esm/history.js +283 -0
- package/dist/esm/history.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +12 -1
- package/dist/esm/web.js +29 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +311 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +311 -2
- package/dist/plugin.js.map +1 -1
- package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/AES.swift +6 -3
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +1575 -0
- package/ios/{Plugin/CapacitorUpdater.swift → Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift} +365 -139
- package/ios/{Plugin/CryptoCipher.swift → Sources/CapacitorUpdaterPlugin/CryptoCipherV1.swift} +13 -6
- package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/CryptoCipherV2.swift +33 -27
- package/ios/Sources/CapacitorUpdaterPlugin/DelayUpdateUtils.swift +220 -0
- package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/InternalUtils.swift +47 -0
- package/ios/Sources/CapacitorUpdaterPlugin/Logger.swift +310 -0
- package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/RSA.swift +1 -0
- package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +112 -0
- package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/UserDefaultsExtension.swift +0 -2
- package/package.json +20 -16
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +0 -1031
- /package/{LICENCE → LICENSE} +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/BigInt.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/BundleInfo.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/BundleStatus.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayCondition.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayUntilNext.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/Info.plist +0 -0
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,7 +11,7 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -49,18 +49,30 @@ repositories {
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
dependencies {
|
|
52
|
-
def work_version = "2.10.
|
|
52
|
+
def work_version = "2.10.5"
|
|
53
53
|
implementation "androidx.work:work-runtime:$work_version"
|
|
54
|
-
implementation "com.google.android.gms:play-services-tasks:18.2.
|
|
55
|
-
implementation "com.google.guava:guava:
|
|
54
|
+
implementation "com.google.android.gms:play-services-tasks:18.2.1"
|
|
55
|
+
implementation "com.google.guava:guava:33.4.8-android"
|
|
56
56
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
57
57
|
implementation project(':capacitor-android')
|
|
58
58
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
59
59
|
implementation 'io.github.g00fy2:versioncompare:1.5.0'
|
|
60
|
-
implementation 'com.google.code.gson:gson:2.11.0'
|
|
61
60
|
testImplementation "junit:junit:$junitVersion"
|
|
61
|
+
testImplementation 'org.mockito:mockito-core:5.14.2'
|
|
62
|
+
testImplementation 'org.json:json:20250517'
|
|
63
|
+
testImplementation 'org.robolectric:robolectric:4.13'
|
|
62
64
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
63
65
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
64
66
|
implementation 'org.brotli:dec:0.1.2'
|
|
65
67
|
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
66
68
|
}
|
|
69
|
+
|
|
70
|
+
tasks.withType(Test) {
|
|
71
|
+
testLogging {
|
|
72
|
+
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
73
|
+
exceptionFormat "full"
|
|
74
|
+
showStandardStreams = true
|
|
75
|
+
showCauses = true
|
|
76
|
+
showStackTraces = true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -20,9 +20,26 @@
|
|
|
20
20
|
# hide the original source file name.
|
|
21
21
|
#-renamesourcefileattribute SourceFile
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
-keepattributes *Annotation
|
|
23
|
+
# Preserve annotation and signature metadata used by runtime checks
|
|
24
|
+
-keepattributes *Annotation*, Signature
|
|
25
25
|
|
|
26
|
-
#
|
|
27
|
-
-keep class ee.forgr.capacitor_updater
|
|
28
|
-
|
|
26
|
+
# Preserve the entire Capgo plugin package
|
|
27
|
+
-keep class ee.forgr.capacitor_updater.** { *; }
|
|
28
|
+
|
|
29
|
+
# Preserve Capacitor classes and members accessed via reflection for autoSplashscreen
|
|
30
|
+
# These rules are safe even if SplashScreen plugin is not present - they only reference core Capacitor classes
|
|
31
|
+
-keep class com.getcapacitor.Bridge {
|
|
32
|
+
com.getcapacitor.MessageHandler msgHandler;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
-keep class com.getcapacitor.MessageHandler { *; }
|
|
36
|
+
|
|
37
|
+
-keep class com.getcapacitor.PluginCall {
|
|
38
|
+
<init>(com.getcapacitor.MessageHandler, java.lang.String, java.lang.String, java.lang.String, com.getcapacitor.JSObject);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Keep SplashScreen plugin methods that are called via reflection
|
|
42
|
+
# This applies to any plugin, not just SplashScreen
|
|
43
|
+
-keep class * implements com.getcapacitor.PluginHandle {
|
|
44
|
+
public void invoke(java.lang.String, com.getcapacitor.PluginCall);
|
|
45
|
+
}
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
package ee.forgr.capacitor_updater;
|
|
8
8
|
|
|
9
|
-
import com.getcapacitor.JSObject;
|
|
10
9
|
import java.text.SimpleDateFormat;
|
|
11
10
|
import java.util.Date;
|
|
11
|
+
import java.util.HashMap;
|
|
12
|
+
import java.util.Map;
|
|
12
13
|
import java.util.Objects;
|
|
13
14
|
import java.util.TimeZone;
|
|
14
15
|
import org.json.JSONException;
|
|
@@ -42,11 +43,11 @@ public class BundleInfo {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
public BundleInfo(final String id, final String version, final BundleStatus status, final String downloaded, final String checksum) {
|
|
45
|
-
this.downloaded = downloaded.trim();
|
|
46
|
-
this.id = id;
|
|
46
|
+
this.downloaded = downloaded != null ? downloaded.trim() : "";
|
|
47
|
+
this.id = id != null ? id : "";
|
|
47
48
|
this.version = version;
|
|
48
|
-
this.checksum = checksum;
|
|
49
|
-
this.status = status;
|
|
49
|
+
this.checksum = checksum != null ? checksum : "";
|
|
50
|
+
this.status = status != null ? status : BundleStatus.ERROR;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
public Boolean isBuiltin() {
|
|
@@ -70,7 +71,7 @@ public class BundleInfo {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
public String getDownloaded() {
|
|
73
|
-
return this.isBuiltin() ? DOWNLOADED_BUILTIN : this.downloaded;
|
|
74
|
+
return this.isBuiltin() ? DOWNLOADED_BUILTIN : (this.downloaded != null ? this.downloaded : "");
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
public BundleInfo setDownloaded(Date downloaded) {
|
|
@@ -78,7 +79,7 @@ public class BundleInfo {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
public String getChecksum() {
|
|
81
|
-
return this.isBuiltin() ? "" : this.checksum;
|
|
82
|
+
return this.isBuiltin() ? "" : (this.checksum != null ? this.checksum : "");
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
public BundleInfo setChecksum(String checksum) {
|
|
@@ -102,17 +103,16 @@ public class BundleInfo {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
public BundleStatus getStatus() {
|
|
105
|
-
|
|
106
|
+
if (this.isBuiltin()) {
|
|
107
|
+
return BundleStatus.SUCCESS;
|
|
108
|
+
}
|
|
109
|
+
return this.status != null ? this.status : BundleStatus.ERROR;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
public BundleInfo setStatus(BundleStatus status) {
|
|
109
113
|
return new BundleInfo(this.id, this.version, status, this.downloaded, this.checksum);
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
public static BundleInfo fromJSON(final JSObject json) throws JSONException {
|
|
113
|
-
return BundleInfo.fromJSON(json.toString());
|
|
114
|
-
}
|
|
115
|
-
|
|
116
116
|
public static BundleInfo fromJSON(final String jsonString) throws JSONException {
|
|
117
117
|
JSONObject json = new JSONObject(new JSONTokener(jsonString));
|
|
118
118
|
return new BundleInfo(
|
|
@@ -124,13 +124,13 @@ public class BundleInfo {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
public
|
|
128
|
-
final
|
|
127
|
+
public Map<String, Object> toJSONMap() {
|
|
128
|
+
final Map<String, Object> result = new HashMap<>();
|
|
129
129
|
result.put("id", this.getId());
|
|
130
130
|
result.put("version", this.getVersionName());
|
|
131
131
|
result.put("downloaded", this.getDownloaded());
|
|
132
132
|
result.put("checksum", this.getChecksum());
|
|
133
|
-
result.put("status", this.getStatus());
|
|
133
|
+
result.put("status", this.getStatus().toString());
|
|
134
134
|
return result;
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -149,6 +149,42 @@ public class BundleInfo {
|
|
|
149
149
|
|
|
150
150
|
@Override
|
|
151
151
|
public String toString() {
|
|
152
|
-
|
|
152
|
+
try {
|
|
153
|
+
// Build JSON manually with extra safety checks
|
|
154
|
+
StringBuilder json = new StringBuilder();
|
|
155
|
+
json.append("{");
|
|
156
|
+
|
|
157
|
+
// Safe ID access
|
|
158
|
+
String safeId = this.id != null ? this.id : "";
|
|
159
|
+
if (this.isBuiltin()) safeId = ID_BUILTIN;
|
|
160
|
+
json.append("\"id\":\"").append(safeId).append("\",");
|
|
161
|
+
|
|
162
|
+
// Safe version access
|
|
163
|
+
String safeVersion = this.version != null ? this.version : ID_BUILTIN;
|
|
164
|
+
json.append("\"version\":\"").append(safeVersion).append("\",");
|
|
165
|
+
|
|
166
|
+
// Safe downloaded access
|
|
167
|
+
String safeDownloaded = this.downloaded != null ? this.downloaded : "";
|
|
168
|
+
if (this.isBuiltin()) safeDownloaded = DOWNLOADED_BUILTIN;
|
|
169
|
+
json.append("\"downloaded\":\"").append(safeDownloaded).append("\",");
|
|
170
|
+
|
|
171
|
+
// Safe checksum access
|
|
172
|
+
String safeChecksum = this.checksum != null ? this.checksum : "";
|
|
173
|
+
json.append("\"checksum\":\"").append(safeChecksum).append("\",");
|
|
174
|
+
|
|
175
|
+
// Safe status access
|
|
176
|
+
BundleStatus safeStatus = this.status != null ? this.status : BundleStatus.ERROR;
|
|
177
|
+
if (this.isBuiltin()) safeStatus = BundleStatus.SUCCESS;
|
|
178
|
+
json.append("\"status\":\"").append(safeStatus.toString()).append("\"");
|
|
179
|
+
|
|
180
|
+
json.append("}");
|
|
181
|
+
return json.toString();
|
|
182
|
+
} catch (Exception e) {
|
|
183
|
+
// Log the error for debugging but still return valid JSON
|
|
184
|
+
System.err.println("BundleInfo toString() error: " + e.getMessage());
|
|
185
|
+
e.printStackTrace();
|
|
186
|
+
// Return absolute minimal JSON
|
|
187
|
+
return "{\"id\":\"" + (this.id != null ? this.id : "unknown") + "\",\"status\":\"error\"}";
|
|
188
|
+
}
|
|
153
189
|
}
|
|
154
190
|
}
|