@capgo/capacitor-updater 4.61.10 → 5.0.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.
- package/README.md +0 -18
- package/android/build.gradle +8 -8
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +5 -30
- package/dist/docs.json +0 -39
- package/dist/esm/definitions.d.ts +0 -10
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +3 -13
- package/package.json +15 -15
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
|
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.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:
|
|
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 :
|
|
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 :
|
|
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.
|
|
41
|
-
targetCompatibility JavaVersion.
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -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 = "
|
|
58
|
+
private final String PLUGIN_VERSION = "5.0.0";
|
|
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>",
|
|
@@ -327,16 +327,6 @@ export interface CapacitorUpdaterPlugin {
|
|
|
327
327
|
setMultiDelay(options: {
|
|
328
328
|
delayConditions: DelayCondition[];
|
|
329
329
|
}): 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
330
|
/**
|
|
341
331
|
* Cancel delay to updates as usual
|
|
342
332
|
*
|
|
@@ -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 = "
|
|
18
|
+
private let PLUGIN_VERSION: String = "5.0.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"
|
|
@@ -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": "
|
|
3
|
+
"version": "5.0.0",
|
|
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": "^
|
|
57
|
-
"@capacitor/cli": "^
|
|
58
|
-
"@capacitor/core": "^
|
|
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": "^
|
|
60
|
+
"@capacitor/ios": "^5.0.3",
|
|
61
61
|
"@ionic/eslint-config": "^0.3.0",
|
|
62
|
-
"@ionic/prettier-config": "^
|
|
62
|
+
"@ionic/prettier-config": "^3.0.0",
|
|
63
63
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
66
|
-
"@typescript-eslint/parser": "^5.
|
|
67
|
-
"eslint": "^8.
|
|
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.
|
|
69
|
+
"prettier": "^2.8.8",
|
|
70
70
|
"prettier-plugin-java": "^2.1.0",
|
|
71
|
-
"rimraf": "^5.0.
|
|
72
|
-
"rollup": "^3.
|
|
73
|
-
"swiftlint": "^1.0.
|
|
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": "^
|
|
77
|
+
"@capacitor/core": "^5.0.0"
|
|
78
78
|
},
|
|
79
79
|
"prettier": "@ionic/prettier-config",
|
|
80
80
|
"swiftlint": "@ionic/swiftlint-config",
|