@capgo/capacitor-updater 7.50.2 → 7.51.16

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.
Files changed (32) hide show
  1. package/CapgoCapacitorUpdater.podspec +0 -2
  2. package/Package.swift +4 -5
  3. package/README.md +53 -48
  4. package/android/build.gradle +6 -6
  5. package/android/src/main/java/ee/forgr/capacitor_updater/AppLifecycleObserver.java +29 -2
  6. package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +7 -3
  7. package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +1 -0
  8. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +427 -116
  9. package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +1108 -182
  10. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +102 -31
  11. package/android/src/main/java/ee/forgr/capacitor_updater/DataManager.java +23 -7
  12. package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +2 -2
  13. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +11 -0
  14. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +513 -201
  15. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +103 -3
  16. package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +1 -1
  17. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +115 -133
  18. package/dist/docs.json +32 -8
  19. package/dist/esm/definitions.d.ts +41 -17
  20. package/dist/esm/definitions.js.map +1 -1
  21. package/ios/Sources/CapacitorUpdaterPlugin/AES.swift +124 -0
  22. package/ios/Sources/CapacitorUpdaterPlugin/BundleInfo.swift +9 -1
  23. package/ios/Sources/CapacitorUpdaterPlugin/BundleStatus.swift +3 -0
  24. package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +806 -92
  25. package/ios/Sources/CapacitorUpdaterPlugin/CapgoRawRsa.swift +36 -0
  26. package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +1020 -270
  27. package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +49 -31
  28. package/ios/Sources/CapacitorUpdaterPlugin/RSA.swift +73 -251
  29. package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +44 -20
  30. package/ios/Sources/CapacitorUpdaterPlugin/WebViewStatsReporter.swift +28 -0
  31. package/package.json +13 -8
  32. package/ios/Sources/CapacitorUpdaterPlugin/BigInt.swift +0 -39
@@ -86,6 +86,10 @@ final class WebViewStatsReporter {
86
86
  }
87
87
  writeSession(true);
88
88
  setInterval(function(){writeSession(true);},15000);
89
+ function pageDuration(){
90
+ var started=Number(window.__capgoWebViewSessionStartedAt||Date.now());
91
+ return String(Math.max(0,Date.now()-started));
92
+ }
89
93
  function markClean(){writeSession(false);}
90
94
  window.addEventListener('pagehide',markClean,true);
91
95
  window.addEventListener('beforeunload',markClean,true);
@@ -120,6 +124,22 @@ final class WebViewStatsReporter {
120
124
  source:s(event&&event.blockedURI)
121
125
  });
122
126
  },true);
127
+ document.addEventListener('DOMContentLoaded',function(){
128
+ send({
129
+ type:'webview_dom_content_loaded',
130
+ message:'WebView DOM content loaded',
131
+ duration_ms:pageDuration(),
132
+ page_started_at:String(window.__capgoWebViewSessionStartedAt)
133
+ });
134
+ },true);
135
+ window.addEventListener('load',function(){
136
+ send({
137
+ type:'webview_page_loaded',
138
+ message:'WebView page loaded',
139
+ duration_ms:pageDuration(),
140
+ page_started_at:String(window.__capgoWebViewSessionStartedAt)
141
+ });
142
+ },true);
123
143
  document.addEventListener('deviceready',scheduleFlush,false);
124
144
  setTimeout(scheduleFlush,0);
125
145
  })();
@@ -164,6 +184,8 @@ final class WebViewStatsReporter {
164
184
  "href": call.getString("href"),
165
185
  "user_agent": call.getString("user_agent"),
166
186
  "session_id": call.getString("session_id"),
187
+ "duration_ms": call.getString("duration_ms"),
188
+ "page_started_at": call.getString("page_started_at"),
167
189
  "previous_session_id": call.getString("previous_session_id"),
168
190
  "previous_href": call.getString("previous_href"),
169
191
  "previous_started_at": call.getString("previous_started_at"),
@@ -187,6 +209,10 @@ final class WebViewStatsReporter {
187
209
  return "webview_render_process_gone"
188
210
  case "web_content_process_terminated":
189
211
  return "webview_content_process_terminated"
212
+ case "webview_dom_content_loaded":
213
+ return "webview_dom_content_loaded"
214
+ case "webview_page_loaded":
215
+ return "webview_page_loaded"
190
216
  case "javascript_error":
191
217
  return "webview_javascript_error"
192
218
  default:
@@ -206,6 +232,8 @@ final class WebViewStatsReporter {
206
232
  put(&metadata, key: "href", value: sanitizeUrl(payloadValue(values, "href")), maxLength: 512)
207
233
  put(&metadata, key: "user_agent", value: payloadValue(values, "user_agent"), maxLength: 256)
208
234
  put(&metadata, key: "session_id", value: payloadValue(values, "session_id"), maxLength: 128)
235
+ put(&metadata, key: "duration_ms", value: payloadValue(values, "duration_ms"), maxLength: 32)
236
+ put(&metadata, key: "page_started_at", value: payloadValue(values, "page_started_at"), maxLength: 64)
209
237
  put(&metadata, key: "previous_session_id", value: payloadValue(values, "previous_session_id"), maxLength: 128)
210
238
  put(&metadata, key: "previous_href", value: sanitizeUrl(payloadValue(values, "previous_href")), maxLength: 512)
211
239
  put(&metadata, key: "previous_started_at", value: payloadValue(values, "previous_started_at"), maxLength: 64)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "7.50.2",
3
+ "version": "7.51.16",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",
@@ -72,19 +72,24 @@
72
72
  "watch": "tsc --watch",
73
73
  "prepublishOnly": "bun run build",
74
74
  "check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs",
75
+ "changelog:ai": "node scripts/generate-ai-changelog.mjs",
75
76
  "example:install": "cd example-app && bun install --frozen-lockfile",
76
- "example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build"
77
+ "example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build",
78
+ "native:contract:crypto": "bun run native:contract:crypto:ios && bun run native:contract:crypto:android",
79
+ "native:contract:crypto:ios": "./scripts/test-ios.sh -only-testing:CapacitorUpdaterPluginTests/RsaContractTests",
80
+ "native:contract:crypto:android": "cd android && ./gradlew testDebugUnitTest --tests ee.forgr.capacitor_updater.RsaContractTest && cd ..",
81
+ "generate:rsa-contract": "bun scripts/generate-rsa-contract-fixtures.mjs"
77
82
  },
78
83
  "devDependencies": {
79
- "@capacitor/android": "^7.4.3",
80
- "@capacitor/cli": "^7.4.3",
81
- "@capacitor/core": "^7.4.3",
84
+ "@capacitor/android": "^7.0.0",
85
+ "@capacitor/cli": "^7.0.0",
86
+ "@capacitor/core": "^7.0.0",
82
87
  "@capacitor/docgen": "^0.3.0",
83
- "@capacitor/ios": "^7.4.3",
88
+ "@capacitor/ios": "^7.0.0",
84
89
  "@ionic/eslint-config": "^0.4.0",
85
90
  "@ionic/prettier-config": "^4.0.0",
86
91
  "@ionic/swiftlint-config": "^2.0.0",
87
- "@types/node": "^24.3.0",
92
+ "@types/node": "^26.0.0",
88
93
  "eslint": "^8.57.0",
89
94
  "eslint-plugin-import": "^2.32.0",
90
95
  "husky": "^9.1.7",
@@ -97,7 +102,7 @@
97
102
  "prettier-pretty-check": "^0.2.0"
98
103
  },
99
104
  "peerDependencies": {
100
- "@capacitor/core": ">=7.0.0"
105
+ "@capacitor/core": "^7.0.0"
101
106
  },
102
107
  "prettier": "@ionic/prettier-config",
103
108
  "swiftlint": "@ionic/swiftlint-config",
@@ -1,39 +0,0 @@
1
- import BigInt
2
-
3
- // Add this custom power function to ensure safer handling of power operations
4
-
5
- // Manual exponentiation using the square-and-multiply algorithm
6
- // which is more efficient and avoids using the built-in functions that might handle BigInt differently
7
- extension BigInt {
8
- func manualPower(_ exponent: BigInt, modulus: BigInt) -> BigInt {
9
- // Quick checks
10
- if modulus == 0 {
11
- return 0
12
- }
13
-
14
- if exponent == 0 {
15
- return 1
16
- }
17
-
18
- guard let base = self.magnitude as? BigUInt,
19
- let exp = exponent.magnitude as? BigUInt,
20
- let mod = modulus.magnitude as? BigUInt else {
21
- return 0
22
- }
23
-
24
- // Square and multiply algorithm for modular exponentiation
25
- var result = BigUInt(1)
26
- var currentBase = base % mod
27
- var currentExp = exp
28
-
29
- while currentExp > 0 {
30
- if currentExp & 1 == 1 {
31
- result = (result * currentBase) % mod
32
- }
33
- currentBase = (currentBase * currentBase) % mod
34
- currentExp >>= 1
35
- }
36
-
37
- return BigInt(result)
38
- }
39
- }