@capgo/capacitor-updater 4.61.10 → 4.61.11

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/README.md CHANGED
@@ -130,7 +130,6 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
130
130
  * [`current()`](#current)
131
131
  * [`reload()`](#reload)
132
132
  * [`setMultiDelay(...)`](#setmultidelay)
133
- * [`setDelay(...)`](#setdelay)
134
133
  * [`cancelDelay()`](#canceldelay)
135
134
  * [`getLatest()`](#getlatest)
136
135
  * [`setChannel(...)`](#setchannel)
@@ -304,23 +303,6 @@ Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the
304
303
  --------------------
305
304
 
306
305
 
307
- ### setDelay(...)
308
-
309
- ```typescript
310
- setDelay(options: DelayCondition) => Promise<void>
311
- ```
312
-
313
- Set <a href="#delaycondition">DelayCondition</a>, skip updates until the condition is met
314
-
315
- | Param | Type | Description |
316
- | ------------- | --------------------------------------------------------- | ------------------------------------------------------------------ |
317
- | **`options`** | <code><a href="#delaycondition">DelayCondition</a></code> | is the {@link <a href="#delaycondition">DelayCondition</a>} to set |
318
-
319
- **Since:** 4.0.0
320
-
321
- --------------------
322
-
323
-
324
306
  ### cancelDelay()
325
307
 
326
308
  ```typescript
@@ -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.1'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.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:7.3.1'
14
+ classpath 'com.android.tools.build:gradle:8.0.2'
15
15
  }
16
16
  }
17
17
 
@@ -19,10 +19,10 @@ apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
21
  namespace "ee.forgr.capacitor_updater"
22
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
23
23
  defaultConfig {
24
24
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
26
26
  versionCode 1
27
27
  versionName "1.0"
28
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -37,8 +37,8 @@ android {
37
37
  abortOnError false
38
38
  }
39
39
  compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_1_8
41
- targetCompatibility JavaVersion.VERSION_1_8
40
+ sourceCompatibility JavaVersion.VERSION_17
41
+ targetCompatibility JavaVersion.VERSION_17
42
42
  }
43
43
  }
44
44
 
@@ -468,12 +468,14 @@ public class CapacitorUpdater {
468
468
  }
469
469
 
470
470
  private String getChecksum(File file) throws IOException {
471
- byte[] bytes = new byte[(int) file.length()];
471
+ CRC32 crc = new CRC32();
472
472
  try (FileInputStream fis = new FileInputStream(file)) {
473
- fis.read(bytes);
473
+ byte[] buffer = new byte[1024];
474
+ int length;
475
+ while ((length = fis.read(buffer)) != -1) {
476
+ crc.update(buffer, 0, length);
477
+ }
474
478
  }
475
- CRC32 crc = new CRC32();
476
- crc.update(bytes);
477
479
  String enc = String.format("%08X", crc.getValue());
478
480
  return enc.toLowerCase();
479
481
  }
@@ -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.61.10";
58
+ private final String PLUGIN_VERSION = "4.61.11";
59
59
  private static final String DELAY_CONDITION_PREFERENCES = "";
60
60
 
61
61
  private SharedPreferences.Editor editor;
@@ -537,6 +537,9 @@ public class CapacitorUpdaterPlugin
537
537
  if (res.has("error")) {
538
538
  call.reject(res.getString("error"));
539
539
  return;
540
+ } else if (res.has("message")) {
541
+ call.reject(res.getString("message"));
542
+ return;
540
543
  } else {
541
544
  call.resolve(res);
542
545
  }
@@ -675,33 +678,6 @@ public class CapacitorUpdaterPlugin
675
678
  }
676
679
  }
677
680
 
678
- @Deprecated
679
- @PluginMethod
680
- public void setDelay(final PluginCall call) {
681
- try {
682
- String kind = call.getString("kind");
683
- String value = call.getString("value");
684
- String delayConditions =
685
- "[{\"kind\":\"" +
686
- kind +
687
- "\", \"value\":\"" +
688
- (value != null ? value : "") +
689
- "\"}]";
690
- if (_setMultiDelay(delayConditions)) {
691
- call.resolve();
692
- } else {
693
- call.reject("Failed to delay update");
694
- }
695
- } catch (final Exception e) {
696
- Log.e(
697
- CapacitorUpdater.TAG,
698
- "Failed to delay update, [Error calling 'setDelay()']",
699
- e
700
- );
701
- call.reject("Failed to delay update", e);
702
- }
703
- }
704
-
705
681
  private boolean _cancelDelay(String source) {
706
682
  try {
707
683
  this.editor.remove(DELAY_CONDITION_PREFERENCES);
@@ -1260,8 +1236,7 @@ public class CapacitorUpdaterPlugin
1260
1236
  Context mContext = this.getContext();
1261
1237
  ActivityManager activityManager =
1262
1238
  (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
1263
- List<ActivityManager.AppTask> runningTasks =
1264
- activityManager.getAppTasks();
1239
+ List<ActivityManager.AppTask> runningTasks = activityManager.getAppTasks();
1265
1240
  ActivityManager.RecentTaskInfo runningTask = runningTasks
1266
1241
  .get(0)
1267
1242
  .getTaskInfo();
package/dist/docs.json CHANGED
@@ -287,45 +287,6 @@
287
287
  ],
288
288
  "slug": "setmultidelay"
289
289
  },
290
- {
291
- "name": "setDelay",
292
- "signature": "(options: DelayCondition) => Promise<void>",
293
- "parameters": [
294
- {
295
- "name": "options",
296
- "docs": "is the {@link DelayCondition} to set",
297
- "type": "DelayCondition"
298
- }
299
- ],
300
- "returns": "Promise<void>",
301
- "tags": [
302
- {
303
- "name": "deprecated",
304
- "text": "use setMultiDelay instead passing a single value in array"
305
- },
306
- {
307
- "name": "returns",
308
- "text": "an Promise resolved directly"
309
- },
310
- {
311
- "name": "param",
312
- "text": "options is the {@link DelayCondition} to set"
313
- },
314
- {
315
- "name": "throws",
316
- "text": "An error if the something went wrong"
317
- },
318
- {
319
- "name": "since",
320
- "text": "4.0.0"
321
- }
322
- ],
323
- "docs": "Set DelayCondition, skip updates until the condition is met",
324
- "complexTypes": [
325
- "DelayCondition"
326
- ],
327
- "slug": "setdelay"
328
- },
329
290
  {
330
291
  "name": "cancelDelay",
331
292
  "signature": "() => Promise<void>",
@@ -1513,6 +1474,86 @@
1513
1474
  "docs": "Configure the current version of the app. This will be used for the first update request.\nIf not set, the plugin will get the version from the native code.\n\nOnly available for Android and iOS.",
1514
1475
  "complexTypes": [],
1515
1476
  "type": "string | undefined"
1477
+ },
1478
+ {
1479
+ "name": "localS3",
1480
+ "tags": [
1481
+ {
1482
+ "text": "undefined",
1483
+ "name": "default"
1484
+ },
1485
+ {
1486
+ "text": "4.17.48",
1487
+ "name": "since"
1488
+ }
1489
+ ],
1490
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1491
+ "complexTypes": [],
1492
+ "type": "boolean | undefined"
1493
+ },
1494
+ {
1495
+ "name": "localHost",
1496
+ "tags": [
1497
+ {
1498
+ "text": "undefined",
1499
+ "name": "default"
1500
+ },
1501
+ {
1502
+ "text": "4.17.48",
1503
+ "name": "since"
1504
+ }
1505
+ ],
1506
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1507
+ "complexTypes": [],
1508
+ "type": "string | undefined"
1509
+ },
1510
+ {
1511
+ "name": "localWebHost",
1512
+ "tags": [
1513
+ {
1514
+ "text": "undefined",
1515
+ "name": "default"
1516
+ },
1517
+ {
1518
+ "text": "4.17.48",
1519
+ "name": "since"
1520
+ }
1521
+ ],
1522
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1523
+ "complexTypes": [],
1524
+ "type": "string | undefined"
1525
+ },
1526
+ {
1527
+ "name": "localSupa",
1528
+ "tags": [
1529
+ {
1530
+ "text": "undefined",
1531
+ "name": "default"
1532
+ },
1533
+ {
1534
+ "text": "4.17.48",
1535
+ "name": "since"
1536
+ }
1537
+ ],
1538
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1539
+ "complexTypes": [],
1540
+ "type": "string | undefined"
1541
+ },
1542
+ {
1543
+ "name": "localSupaAnon",
1544
+ "tags": [
1545
+ {
1546
+ "text": "undefined",
1547
+ "name": "default"
1548
+ },
1549
+ {
1550
+ "text": "4.17.48",
1551
+ "name": "since"
1552
+ }
1553
+ ],
1554
+ "docs": "Configure the CLI to use a local server for testing.",
1555
+ "complexTypes": [],
1556
+ "type": "string | undefined"
1516
1557
  }
1517
1558
  ],
1518
1559
  "docs": "These configuration values are available:"
@@ -86,6 +86,46 @@ declare module "@capacitor/cli" {
86
86
  * @since 4.17.48
87
87
  */
88
88
  version?: string;
89
+ /**
90
+ * Configure the CLI to use a local server for testing or self-hosted update server.
91
+ *
92
+ *
93
+ * @default undefined
94
+ * @since 4.17.48
95
+ */
96
+ localS3?: boolean;
97
+ /**
98
+ * Configure the CLI to use a local server for testing or self-hosted update server.
99
+ *
100
+ *
101
+ * @default undefined
102
+ * @since 4.17.48
103
+ */
104
+ localHost?: string;
105
+ /**
106
+ * Configure the CLI to use a local server for testing or self-hosted update server.
107
+ *
108
+ *
109
+ * @default undefined
110
+ * @since 4.17.48
111
+ */
112
+ localWebHost?: string;
113
+ /**
114
+ * Configure the CLI to use a local server for testing or self-hosted update server.
115
+ *
116
+ *
117
+ * @default undefined
118
+ * @since 4.17.48
119
+ */
120
+ localSupa?: string;
121
+ /**
122
+ * Configure the CLI to use a local server for testing.
123
+ *
124
+ *
125
+ * @default undefined
126
+ * @since 4.17.48
127
+ */
128
+ localSupaAnon?: string;
89
129
  };
90
130
  }
91
131
  }
@@ -327,16 +367,6 @@ export interface CapacitorUpdaterPlugin {
327
367
  setMultiDelay(options: {
328
368
  delayConditions: DelayCondition[];
329
369
  }): Promise<void>;
330
- /**
331
- * Set DelayCondition, skip updates until the condition is met
332
- *
333
- * @deprecated use setMultiDelay instead passing a single value in array
334
- * @returns {Promise<void>} an Promise resolved directly
335
- * @param options is the {@link DelayCondition} to set
336
- * @throws An error if the something went wrong
337
- * @since 4.0.0
338
- */
339
- setDelay(options: DelayCondition): Promise<void>;
340
370
  /**
341
371
  * Cancel delay to updates as usual
342
372
  *
@@ -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.61.10"
18
+ private let PLUGIN_VERSION: String = "4.61.11"
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"
@@ -235,6 +235,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
235
235
  let res = self.implementation.getLatest(url: URL(string: self.updateUrl)!)
236
236
  if res.error != nil {
237
237
  call.reject( res.error!)
238
+ } else if res.message != nil {
239
+ call.reject( res.message!)
238
240
  } else {
239
241
  call.resolve(res.toDict())
240
242
  }
@@ -338,18 +340,6 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
338
340
  }
339
341
  }
340
342
 
341
- @available(*, deprecated, message: "use SetMultiDelay instead")
342
- @objc func setDelay(_ call: CAPPluginCall) {
343
- let kind: String = call.getString("kind", "")
344
- let value: String? = call.getString("value", "")
345
- let delayConditions: String = "[{\"kind\":\"\(kind)\", \"value\":\"\(value ?? "")\"}]"
346
- if _setMultiDelay(delayConditions: delayConditions) {
347
- call.resolve()
348
- } else {
349
- call.reject("Failed to delay update")
350
- }
351
- }
352
-
353
343
  private func _setMultiDelay(delayConditions: String?) -> Bool {
354
344
  if delayConditions != nil && "" != delayConditions {
355
345
  UserDefaults.standard.set(delayConditions, forKey: DELAY_CONDITION_PREFERENCES)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "4.61.10",
3
+ "version": "4.61.11",
4
4
  "packageManager": "pnpm@8.5.1",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",
@@ -53,28 +53,28 @@
53
53
  "prepublishOnly": "npm run build"
54
54
  },
55
55
  "devDependencies": {
56
- "@capacitor/android": "^4.8.0",
57
- "@capacitor/cli": "^4.8.0",
58
- "@capacitor/core": "^4.8.0",
56
+ "@capacitor/android": "^5.0.3",
57
+ "@capacitor/cli": "^5.0.3",
58
+ "@capacitor/core": "^5.0.3",
59
59
  "@capacitor/docgen": "^0.2.1",
60
- "@capacitor/ios": "^4.8.0",
60
+ "@capacitor/ios": "^5.0.3",
61
61
  "@ionic/eslint-config": "^0.3.0",
62
- "@ionic/prettier-config": "^2.0.0",
62
+ "@ionic/prettier-config": "^3.0.0",
63
63
  "@ionic/swiftlint-config": "^1.1.2",
64
- "@types/node": "^18.15.11",
65
- "@typescript-eslint/eslint-plugin": "^5.58.0",
66
- "@typescript-eslint/parser": "^5.58.0",
67
- "eslint": "^8.39.0",
64
+ "@types/node": "^20.2.3",
65
+ "@typescript-eslint/eslint-plugin": "^5.59.7",
66
+ "@typescript-eslint/parser": "^5.59.7",
67
+ "eslint": "^8.41.0",
68
68
  "eslint-plugin-import": "^2.27.5",
69
- "prettier": "^2.8.7",
69
+ "prettier": "^2.8.8",
70
70
  "prettier-plugin-java": "^2.1.0",
71
- "rimraf": "^5.0.0",
72
- "rollup": "^3.20.7",
73
- "swiftlint": "^1.0.1",
71
+ "rimraf": "^5.0.1",
72
+ "rollup": "^3.23.0",
73
+ "swiftlint": "^1.0.2",
74
74
  "typescript": "^5.0.4"
75
75
  },
76
76
  "peerDependencies": {
77
- "@capacitor/core": "^4.0.0"
77
+ "@capacitor/core": "^5.0.0"
78
78
  },
79
79
  "prettier": "@ionic/prettier-config",
80
80
  "swiftlint": "@ionic/swiftlint-config",