@capgo/capacitor-updater 4.12.11 → 4.13.3
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 +0 -1
- package/README.md +10 -10
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +194 -134
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +23 -23
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +812 -687
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1117 -829
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +147 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +45 -41
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +4 -4
- package/dist/docs.json +16 -16
- package/dist/esm/definitions.d.ts +12 -12
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +34 -34
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +34 -34
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +34 -34
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +56 -19
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +19 -11
- package/ios/Plugin/CryptoCipher.swift +261 -0
- package/package.json +2 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/RSACipher.java +0 -51
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
package ee.forgr.capacitor_updater;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Created by Awesometic
|
|
5
|
+
* It's encrypt returns Base64 encoded, and also decrypt for Base64 encoded cipher
|
|
6
|
+
* references: http://stackoverflow.com/questions/12471999/rsa-encryption-decryption-in-android
|
|
7
|
+
*/
|
|
8
|
+
import android.util.Base64;
|
|
9
|
+
import java.security.GeneralSecurityException;
|
|
10
|
+
import java.security.InvalidAlgorithmParameterException;
|
|
11
|
+
import java.security.InvalidKeyException;
|
|
12
|
+
import java.security.KeyFactory;
|
|
13
|
+
import java.security.NoSuchAlgorithmException;
|
|
14
|
+
import java.security.PrivateKey;
|
|
15
|
+
import java.security.spec.InvalidKeySpecException;
|
|
16
|
+
import java.security.spec.MGF1ParameterSpec;
|
|
17
|
+
import java.security.spec.PKCS8EncodedKeySpec;
|
|
18
|
+
import javax.crypto.BadPaddingException;
|
|
19
|
+
import javax.crypto.Cipher;
|
|
20
|
+
import javax.crypto.IllegalBlockSizeException;
|
|
21
|
+
import javax.crypto.NoSuchPaddingException;
|
|
22
|
+
import javax.crypto.SecretKey;
|
|
23
|
+
import javax.crypto.spec.IvParameterSpec;
|
|
24
|
+
import javax.crypto.spec.OAEPParameterSpec;
|
|
25
|
+
import javax.crypto.spec.PSource;
|
|
26
|
+
import javax.crypto.spec.SecretKeySpec;
|
|
27
|
+
|
|
28
|
+
public class CryptoCipher {
|
|
29
|
+
|
|
30
|
+
public static byte[] decryptRSA(byte[] source, PrivateKey privateKey)
|
|
31
|
+
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
|
|
32
|
+
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPPadding");
|
|
33
|
+
OAEPParameterSpec oaepParams = new OAEPParameterSpec(
|
|
34
|
+
"SHA-256",
|
|
35
|
+
"MGF1",
|
|
36
|
+
new MGF1ParameterSpec("SHA-256"),
|
|
37
|
+
PSource.PSpecified.DEFAULT
|
|
38
|
+
);
|
|
39
|
+
cipher.init(Cipher.DECRYPT_MODE, privateKey, oaepParams);
|
|
40
|
+
byte[] decryptedBytes = cipher.doFinal(source);
|
|
41
|
+
return decryptedBytes;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public static byte[] decryptAES(byte[] cipherText, SecretKey key, byte[] iv) {
|
|
45
|
+
try {
|
|
46
|
+
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
|
|
47
|
+
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
|
48
|
+
SecretKeySpec keySpec = new SecretKeySpec(key.getEncoded(), "AES");
|
|
49
|
+
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivParameterSpec);
|
|
50
|
+
byte[] decryptedText = cipher.doFinal(cipherText);
|
|
51
|
+
return decryptedText;
|
|
52
|
+
} catch (Exception e) {
|
|
53
|
+
e.printStackTrace();
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public static SecretKey byteToSessionKey(byte[] session_key) {
|
|
59
|
+
// rebuild key using SecretKeySpec
|
|
60
|
+
SecretKey originalKey = new SecretKeySpec(
|
|
61
|
+
session_key,
|
|
62
|
+
0,
|
|
63
|
+
session_key.length,
|
|
64
|
+
"AES"
|
|
65
|
+
);
|
|
66
|
+
return originalKey;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private static PrivateKey readPkcs8PrivateKey(byte[] pkcs8Bytes)
|
|
70
|
+
throws GeneralSecurityException {
|
|
71
|
+
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
|
72
|
+
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8Bytes);
|
|
73
|
+
try {
|
|
74
|
+
return keyFactory.generatePrivate(keySpec);
|
|
75
|
+
} catch (InvalidKeySpecException e) {
|
|
76
|
+
throw new IllegalArgumentException("Unexpected key format!", e);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private static byte[] join(byte[] byteArray1, byte[] byteArray2) {
|
|
81
|
+
byte[] bytes = new byte[byteArray1.length + byteArray2.length];
|
|
82
|
+
System.arraycopy(byteArray1, 0, bytes, 0, byteArray1.length);
|
|
83
|
+
System.arraycopy(
|
|
84
|
+
byteArray2,
|
|
85
|
+
0,
|
|
86
|
+
bytes,
|
|
87
|
+
byteArray1.length,
|
|
88
|
+
byteArray2.length
|
|
89
|
+
);
|
|
90
|
+
return bytes;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private static PrivateKey readPkcs1PrivateKey(byte[] pkcs1Bytes)
|
|
94
|
+
throws GeneralSecurityException {
|
|
95
|
+
// We can't use Java internal APIs to parse ASN.1 structures, so we build a PKCS#8 key Java can understand
|
|
96
|
+
int pkcs1Length = pkcs1Bytes.length;
|
|
97
|
+
int totalLength = pkcs1Length + 22;
|
|
98
|
+
byte[] pkcs8Header = new byte[] {
|
|
99
|
+
0x30,
|
|
100
|
+
(byte) 0x82,
|
|
101
|
+
(byte) ((totalLength >> 8) & 0xff),
|
|
102
|
+
(byte) (totalLength & 0xff), // Sequence + total length
|
|
103
|
+
0x2,
|
|
104
|
+
0x1,
|
|
105
|
+
0x0, // Integer (0)
|
|
106
|
+
0x30,
|
|
107
|
+
0xD,
|
|
108
|
+
0x6,
|
|
109
|
+
0x9,
|
|
110
|
+
0x2A,
|
|
111
|
+
(byte) 0x86,
|
|
112
|
+
0x48,
|
|
113
|
+
(byte) 0x86,
|
|
114
|
+
(byte) 0xF7,
|
|
115
|
+
0xD,
|
|
116
|
+
0x1,
|
|
117
|
+
0x1,
|
|
118
|
+
0x1,
|
|
119
|
+
0x5,
|
|
120
|
+
0x0, // Sequence: 1.2.840.113549.1.1.1, NULL
|
|
121
|
+
0x4,
|
|
122
|
+
(byte) 0x82,
|
|
123
|
+
(byte) ((pkcs1Length >> 8) & 0xff),
|
|
124
|
+
(byte) (pkcs1Length & 0xff), // Octet string + length
|
|
125
|
+
};
|
|
126
|
+
byte[] pkcs8bytes = join(pkcs8Header, pkcs1Bytes);
|
|
127
|
+
return readPkcs8PrivateKey(pkcs8bytes);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
public static PrivateKey stringToPrivateKey(String private_key)
|
|
131
|
+
throws GeneralSecurityException {
|
|
132
|
+
// Base64 decode the result
|
|
133
|
+
|
|
134
|
+
String pkcs1Pem = private_key.toString();
|
|
135
|
+
pkcs1Pem = pkcs1Pem.replace("-----BEGIN RSA PRIVATE KEY-----", "");
|
|
136
|
+
pkcs1Pem = pkcs1Pem.replace("-----END RSA PRIVATE KEY-----", "");
|
|
137
|
+
pkcs1Pem = pkcs1Pem.replace("\\n", "");
|
|
138
|
+
pkcs1Pem = pkcs1Pem.replace(" ", "");
|
|
139
|
+
|
|
140
|
+
byte[] pkcs1EncodedBytes = Base64.decode(
|
|
141
|
+
pkcs1Pem.getBytes(),
|
|
142
|
+
Base64.DEFAULT
|
|
143
|
+
);
|
|
144
|
+
// extract the private key
|
|
145
|
+
return readPkcs1PrivateKey(pkcs1EncodedBytes);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -4,45 +4,49 @@ import java.util.Objects;
|
|
|
4
4
|
|
|
5
5
|
public class DelayCondition {
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
private DelayUntilNext kind;
|
|
8
|
+
private String value;
|
|
9
|
+
|
|
10
|
+
public DelayCondition(DelayUntilNext kind, String value) {
|
|
11
|
+
this.kind = kind;
|
|
12
|
+
this.value = value;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public DelayUntilNext getKind() {
|
|
16
|
+
return kind;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public void setKind(DelayUntilNext kind) {
|
|
20
|
+
this.kind = kind;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public String getValue() {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public void setValue(String value) {
|
|
28
|
+
this.value = value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public boolean equals(Object o) {
|
|
33
|
+
if (this == o) return true;
|
|
34
|
+
if (!(o instanceof DelayCondition)) return false;
|
|
35
|
+
DelayCondition that = (DelayCondition) o;
|
|
36
|
+
return (
|
|
37
|
+
getKind() == that.getKind() && Objects.equals(getValue(), that.getValue())
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Override
|
|
42
|
+
public int hashCode() {
|
|
43
|
+
return Objects.hash(getKind(), getValue());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Override
|
|
47
|
+
public String toString() {
|
|
48
|
+
return (
|
|
49
|
+
"DelayCondition{" + "kind=" + kind + ", value='" + value + '\'' + '}'
|
|
50
|
+
);
|
|
51
|
+
}
|
|
48
52
|
}
|
package/dist/docs.json
CHANGED
|
@@ -472,7 +472,7 @@
|
|
|
472
472
|
},
|
|
473
473
|
{
|
|
474
474
|
"name": "addListener",
|
|
475
|
-
"signature": "(eventName:
|
|
475
|
+
"signature": "(eventName: \"download\", listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
476
476
|
"parameters": [
|
|
477
477
|
{
|
|
478
478
|
"name": "eventName",
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
},
|
|
502
502
|
{
|
|
503
503
|
"name": "addListener",
|
|
504
|
-
"signature": "(eventName:
|
|
504
|
+
"signature": "(eventName: \"noNeedUpdate\", listenerFunc: NoNeedListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
505
505
|
"parameters": [
|
|
506
506
|
{
|
|
507
507
|
"name": "eventName",
|
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
},
|
|
531
531
|
{
|
|
532
532
|
"name": "addListener",
|
|
533
|
-
"signature": "(eventName:
|
|
533
|
+
"signature": "(eventName: \"updateAvailable\", listenerFunc: UpdateAvailabledListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
534
534
|
"parameters": [
|
|
535
535
|
{
|
|
536
536
|
"name": "eventName",
|
|
@@ -559,7 +559,7 @@
|
|
|
559
559
|
},
|
|
560
560
|
{
|
|
561
561
|
"name": "addListener",
|
|
562
|
-
"signature": "(eventName:
|
|
562
|
+
"signature": "(eventName: \"downloadComplete\", listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
563
563
|
"parameters": [
|
|
564
564
|
{
|
|
565
565
|
"name": "eventName",
|
|
@@ -588,7 +588,7 @@
|
|
|
588
588
|
},
|
|
589
589
|
{
|
|
590
590
|
"name": "addListener",
|
|
591
|
-
"signature": "(eventName:
|
|
591
|
+
"signature": "(eventName: \"majorAvailable\", listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
592
592
|
"parameters": [
|
|
593
593
|
{
|
|
594
594
|
"name": "eventName",
|
|
@@ -617,7 +617,7 @@
|
|
|
617
617
|
},
|
|
618
618
|
{
|
|
619
619
|
"name": "addListener",
|
|
620
|
-
"signature": "(eventName:
|
|
620
|
+
"signature": "(eventName: \"updateFailed\", listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
621
621
|
"parameters": [
|
|
622
622
|
{
|
|
623
623
|
"name": "eventName",
|
|
@@ -646,7 +646,7 @@
|
|
|
646
646
|
},
|
|
647
647
|
{
|
|
648
648
|
"name": "addListener",
|
|
649
|
-
"signature": "(eventName:
|
|
649
|
+
"signature": "(eventName: \"downloadFailed\", listenerFunc: DownloadFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
650
650
|
"parameters": [
|
|
651
651
|
{
|
|
652
652
|
"name": "eventName",
|
|
@@ -675,7 +675,7 @@
|
|
|
675
675
|
},
|
|
676
676
|
{
|
|
677
677
|
"name": "addListener",
|
|
678
|
-
"signature": "(eventName:
|
|
678
|
+
"signature": "(eventName: \"appReloaded\", listenerFunc: AppReloadedListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
679
679
|
"parameters": [
|
|
680
680
|
{
|
|
681
681
|
"name": "eventName",
|
|
@@ -1183,19 +1183,19 @@
|
|
|
1183
1183
|
"docs": "",
|
|
1184
1184
|
"types": [
|
|
1185
1185
|
{
|
|
1186
|
-
"text": "
|
|
1186
|
+
"text": "\"success\"",
|
|
1187
1187
|
"complexTypes": []
|
|
1188
1188
|
},
|
|
1189
1189
|
{
|
|
1190
|
-
"text": "
|
|
1190
|
+
"text": "\"error\"",
|
|
1191
1191
|
"complexTypes": []
|
|
1192
1192
|
},
|
|
1193
1193
|
{
|
|
1194
|
-
"text": "
|
|
1194
|
+
"text": "\"pending\"",
|
|
1195
1195
|
"complexTypes": []
|
|
1196
1196
|
},
|
|
1197
1197
|
{
|
|
1198
|
-
"text": "
|
|
1198
|
+
"text": "\"downloading\"",
|
|
1199
1199
|
"complexTypes": []
|
|
1200
1200
|
}
|
|
1201
1201
|
]
|
|
@@ -1206,19 +1206,19 @@
|
|
|
1206
1206
|
"docs": "",
|
|
1207
1207
|
"types": [
|
|
1208
1208
|
{
|
|
1209
|
-
"text": "
|
|
1209
|
+
"text": "\"background\"",
|
|
1210
1210
|
"complexTypes": []
|
|
1211
1211
|
},
|
|
1212
1212
|
{
|
|
1213
|
-
"text": "
|
|
1213
|
+
"text": "\"kill\"",
|
|
1214
1214
|
"complexTypes": []
|
|
1215
1215
|
},
|
|
1216
1216
|
{
|
|
1217
|
-
"text": "
|
|
1217
|
+
"text": "\"nativeVersion\"",
|
|
1218
1218
|
"complexTypes": []
|
|
1219
1219
|
},
|
|
1220
1220
|
{
|
|
1221
|
-
"text": "
|
|
1221
|
+
"text": "\"date\"",
|
|
1222
1222
|
"complexTypes": []
|
|
1223
1223
|
}
|
|
1224
1224
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginListenerHandle } from
|
|
2
|
-
declare module
|
|
1
|
+
import type { PluginListenerHandle } from "@capacitor/core";
|
|
2
|
+
declare module "@capacitor/cli" {
|
|
3
3
|
interface PluginsConfig {
|
|
4
4
|
/**
|
|
5
5
|
* These configuration values are available:
|
|
@@ -189,8 +189,8 @@ export interface DelayCondition {
|
|
|
189
189
|
kind: DelayUntilNext;
|
|
190
190
|
value?: string;
|
|
191
191
|
}
|
|
192
|
-
export type BundleStatus =
|
|
193
|
-
export type DelayUntilNext =
|
|
192
|
+
export type BundleStatus = "success" | "error" | "pending" | "downloading";
|
|
193
|
+
export type DelayUntilNext = "background" | "kill" | "nativeVersion" | "date";
|
|
194
194
|
export type DownloadChangeListener = (state: DownloadEvent) => void;
|
|
195
195
|
export type NoNeedListener = (state: noNeedEvent) => void;
|
|
196
196
|
export type UpdateAvailabledListener = (state: updateAvailableEvent) => void;
|
|
@@ -366,49 +366,49 @@ export interface CapacitorUpdaterPlugin {
|
|
|
366
366
|
*
|
|
367
367
|
* @since 2.0.11
|
|
368
368
|
*/
|
|
369
|
-
addListener(eventName:
|
|
369
|
+
addListener(eventName: "download", listenerFunc: DownloadChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
370
370
|
/**
|
|
371
371
|
* Listen for no need to update event, usefull when you want force check every time the app is launched
|
|
372
372
|
*
|
|
373
373
|
* @since 4.0.0
|
|
374
374
|
*/
|
|
375
|
-
addListener(eventName:
|
|
375
|
+
addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
376
376
|
/**
|
|
377
377
|
* Listen for availbale update event, usefull when you want to force check every time the app is launched
|
|
378
378
|
*
|
|
379
379
|
* @since 4.0.0
|
|
380
380
|
*/
|
|
381
|
-
addListener(eventName:
|
|
381
|
+
addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
382
382
|
/**
|
|
383
383
|
* Listen for download event in the App, let you know when the download is started, loading and finished
|
|
384
384
|
*
|
|
385
385
|
* @since 4.0.0
|
|
386
386
|
*/
|
|
387
|
-
addListener(eventName:
|
|
387
|
+
addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
388
388
|
/**
|
|
389
389
|
* Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
|
|
390
390
|
*
|
|
391
391
|
* @since 2.3.0
|
|
392
392
|
*/
|
|
393
|
-
addListener(eventName:
|
|
393
|
+
addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
394
394
|
/**
|
|
395
395
|
* Listen for update fail event in the App, let you know when update has fail to install at next app start
|
|
396
396
|
*
|
|
397
397
|
* @since 2.3.0
|
|
398
398
|
*/
|
|
399
|
-
addListener(eventName:
|
|
399
|
+
addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
400
400
|
/**
|
|
401
401
|
* Listen for download fail event in the App, let you know when download has fail finished
|
|
402
402
|
*
|
|
403
403
|
* @since 4.0.0
|
|
404
404
|
*/
|
|
405
|
-
addListener(eventName:
|
|
405
|
+
addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
406
406
|
/**
|
|
407
407
|
* Listen for download fail event in the App, let you know when download has fail finished
|
|
408
408
|
*
|
|
409
409
|
* @since 4.3.0
|
|
410
410
|
*/
|
|
411
|
-
addListener(eventName:
|
|
411
|
+
addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
412
412
|
/**
|
|
413
413
|
* Get unique ID used to identify device (sent to auto update server)
|
|
414
414
|
*
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CapacitorUpdaterPlugin } from
|
|
1
|
+
import type { CapacitorUpdaterPlugin } from "./definitions";
|
|
2
2
|
declare const CapacitorUpdater: CapacitorUpdaterPlugin;
|
|
3
|
-
export * from
|
|
3
|
+
export * from "./definitions";
|
|
4
4
|
export { CapacitorUpdater };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerPlugin } from
|
|
2
|
-
const CapacitorUpdater = registerPlugin(
|
|
3
|
-
web: () => import(
|
|
1
|
+
import { registerPlugin } from "@capacitor/core";
|
|
2
|
+
const CapacitorUpdater = registerPlugin("CapacitorUpdater", {
|
|
3
|
+
web: () => import("./web").then((m) => new m.CapacitorUpdaterWeb()),
|
|
4
4
|
});
|
|
5
|
-
export * from
|
|
5
|
+
export * from "./definitions";
|
|
6
6
|
export { CapacitorUpdater };
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,gBAAgB,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,gBAAgB,GAAG,cAAc,CACrC,kBAAkB,EAClB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;CACpE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
2
|
-
import type { CapacitorUpdaterPlugin, BundleInfo, latestVersion, DelayCondition, channelRes, SetChannelOptions, getChannelRes, SetCustomIdOptions } from
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
|
+
import type { CapacitorUpdaterPlugin, BundleInfo, latestVersion, DelayCondition, channelRes, SetChannelOptions, getChannelRes, SetCustomIdOptions } from "./definitions";
|
|
3
3
|
export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorUpdaterPlugin {
|
|
4
4
|
download(options: {
|
|
5
5
|
url: string;
|
package/dist/esm/web.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
2
|
const BUNDLE_BUILTIN = {
|
|
3
|
-
status:
|
|
4
|
-
version:
|
|
5
|
-
downloaded:
|
|
6
|
-
id:
|
|
7
|
-
checksum:
|
|
3
|
+
status: "success",
|
|
4
|
+
version: "",
|
|
5
|
+
downloaded: "1970-01-01T00:00:00.000Z",
|
|
6
|
+
id: "builtin",
|
|
7
|
+
checksum: "",
|
|
8
8
|
};
|
|
9
9
|
export class CapacitorUpdaterWeb extends WebPlugin {
|
|
10
10
|
async download(options) {
|
|
11
|
-
console.warn(
|
|
11
|
+
console.warn("Cannot download version in web", options);
|
|
12
12
|
return BUNDLE_BUILTIN;
|
|
13
13
|
}
|
|
14
14
|
async next(options) {
|
|
15
|
-
console.warn(
|
|
15
|
+
console.warn("Cannot set next version in web", options);
|
|
16
16
|
return BUNDLE_BUILTIN;
|
|
17
17
|
}
|
|
18
18
|
async isAutoUpdateEnabled() {
|
|
19
|
-
console.warn(
|
|
19
|
+
console.warn("Cannot get isAutoUpdateEnabled in web");
|
|
20
20
|
return { enabled: false };
|
|
21
21
|
}
|
|
22
22
|
async set(options) {
|
|
23
|
-
console.warn(
|
|
23
|
+
console.warn("Cannot set active bundle in web", options);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
async getDeviceId() {
|
|
27
|
-
console.warn(
|
|
28
|
-
return { deviceId:
|
|
27
|
+
console.warn("Cannot get ID in web");
|
|
28
|
+
return { deviceId: "default" };
|
|
29
29
|
}
|
|
30
30
|
async getPluginVersion() {
|
|
31
|
-
console.warn(
|
|
32
|
-
return { version:
|
|
31
|
+
console.warn("Cannot get plugin version in web");
|
|
32
|
+
return { version: "default" };
|
|
33
33
|
}
|
|
34
34
|
async delete(options) {
|
|
35
|
-
console.warn(
|
|
35
|
+
console.warn("Cannot delete bundle in web", options);
|
|
36
36
|
}
|
|
37
37
|
async list() {
|
|
38
|
-
console.warn(
|
|
38
|
+
console.warn("Cannot list bundles in web");
|
|
39
39
|
return { bundles: [] };
|
|
40
40
|
}
|
|
41
41
|
async reset(options) {
|
|
42
|
-
console.warn(
|
|
42
|
+
console.warn("Cannot reset version in web", options);
|
|
43
43
|
}
|
|
44
44
|
async current() {
|
|
45
|
-
console.warn(
|
|
46
|
-
return { bundle: BUNDLE_BUILTIN, native:
|
|
45
|
+
console.warn("Cannot get current bundle in web");
|
|
46
|
+
return { bundle: BUNDLE_BUILTIN, native: "0.0.0" };
|
|
47
47
|
}
|
|
48
48
|
async reload() {
|
|
49
|
-
console.warn(
|
|
49
|
+
console.warn("Cannot reload current bundle in web");
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
async getLatest() {
|
|
53
|
-
console.warn(
|
|
53
|
+
console.warn("Cannot getLatest current bundle in web");
|
|
54
54
|
return {
|
|
55
|
-
version:
|
|
56
|
-
message:
|
|
55
|
+
version: "0.0.0",
|
|
56
|
+
message: "Cannot getLatest current bundle in web",
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
async setChannel(options) {
|
|
60
|
-
console.warn(
|
|
60
|
+
console.warn("Cannot setChannel in web", options);
|
|
61
61
|
return {
|
|
62
|
-
status:
|
|
63
|
-
error:
|
|
62
|
+
status: "error",
|
|
63
|
+
error: "Cannot setChannel in web",
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
async setCustomId(options) {
|
|
67
|
-
console.warn(
|
|
67
|
+
console.warn("Cannot setCustomId in web", options);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
async getChannel() {
|
|
71
|
-
console.warn(
|
|
71
|
+
console.warn("Cannot getChannel in web");
|
|
72
72
|
return {
|
|
73
|
-
status:
|
|
74
|
-
error:
|
|
73
|
+
status: "error",
|
|
74
|
+
error: "Cannot getChannel in web",
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
async notifyAppReady() {
|
|
78
|
-
console.warn(
|
|
78
|
+
console.warn("Cannot notify App Ready in web");
|
|
79
79
|
return BUNDLE_BUILTIN;
|
|
80
80
|
}
|
|
81
81
|
async setMultiDelay(options) {
|
|
82
|
-
console.warn(
|
|
82
|
+
console.warn("Cannot setMultiDelay in web", options === null || options === void 0 ? void 0 : options.delayConditions);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
async setDelay(option) {
|
|
86
|
-
console.warn(
|
|
86
|
+
console.warn("Cannot setDelay in web", option);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
async cancelDelay() {
|
|
90
|
-
console.warn(
|
|
90
|
+
console.warn("Cannot cancelDelay in web");
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAa5C,MAAM,cAAc,GAAe;IACjC,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,EAAE;IACX,UAAU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