@capgo/capacitor-updater 4.12.11 → 4.13.2

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.
@@ -16,6 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.dependency 'SSZipArchive'
17
17
  s.dependency 'Alamofire'
18
18
  s.dependency 'Version'
19
- s.dependency 'SwiftyRSA'
20
19
  s.swift_version = '5.1'
21
20
  end
package/README.md CHANGED
@@ -404,7 +404,7 @@ Set Channel for this device
404
404
  ### addListener('download', ...)
405
405
 
406
406
  ```typescript
407
- addListener(eventName: 'download', listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
407
+ addListener(eventName: "download", listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
408
408
  ```
409
409
 
410
410
  Listen for download event in the App, let you know when the download is started, loading and finished
@@ -424,7 +424,7 @@ Listen for download event in the App, let you know when the download is started,
424
424
  ### addListener('noNeedUpdate', ...)
425
425
 
426
426
  ```typescript
427
- addListener(eventName: 'noNeedUpdate', listenerFunc: NoNeedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
427
+ addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
428
428
  ```
429
429
 
430
430
  Listen for no need to update event, usefull when you want force check every time the app is launched
@@ -444,7 +444,7 @@ Listen for no need to update event, usefull when you want force check every time
444
444
  ### addListener('updateAvailable', ...)
445
445
 
446
446
  ```typescript
447
- addListener(eventName: 'updateAvailable', listenerFunc: UpdateAvailabledListener) => Promise<PluginListenerHandle> & PluginListenerHandle
447
+ addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener) => Promise<PluginListenerHandle> & PluginListenerHandle
448
448
  ```
449
449
 
450
450
  Listen for availbale update event, usefull when you want to force check every time the app is launched
@@ -464,7 +464,7 @@ Listen for availbale update event, usefull when you want to force check every ti
464
464
  ### addListener('downloadComplete', ...)
465
465
 
466
466
  ```typescript
467
- addListener(eventName: 'downloadComplete', listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
467
+ addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
468
468
  ```
469
469
 
470
470
  Listen for download event in the App, let you know when the download is started, loading and finished
@@ -484,7 +484,7 @@ Listen for download event in the App, let you know when the download is started,
484
484
  ### addListener('majorAvailable', ...)
485
485
 
486
486
  ```typescript
487
- addListener(eventName: 'majorAvailable', listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle
487
+ addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle
488
488
  ```
489
489
 
490
490
  Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
@@ -504,7 +504,7 @@ Listen for Major update event in the App, let you know when major update is bloc
504
504
  ### addListener('updateFailed', ...)
505
505
 
506
506
  ```typescript
507
- addListener(eventName: 'updateFailed', listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
507
+ addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
508
508
  ```
509
509
 
510
510
  Listen for update fail event in the App, let you know when update has fail to install at next app start
@@ -524,7 +524,7 @@ Listen for update fail event in the App, let you know when update has fail to in
524
524
  ### addListener('downloadFailed', ...)
525
525
 
526
526
  ```typescript
527
- addListener(eventName: 'downloadFailed', listenerFunc: DownloadFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
527
+ addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
528
528
  ```
529
529
 
530
530
  Listen for download fail event in the App, let you know when download has fail finished
@@ -544,7 +544,7 @@ Listen for download fail event in the App, let you know when download has fail f
544
544
  ### addListener('appReloaded', ...)
545
545
 
546
546
  ```typescript
547
- addListener(eventName: 'appReloaded', listenerFunc: AppReloadedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
547
+ addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
548
548
  ```
549
549
 
550
550
  Listen for download fail event in the App, let you know when download has fail finished
@@ -727,12 +727,12 @@ Get the state of auto update config. This will return `false` in manual mode.
727
727
 
728
728
  #### BundleStatus
729
729
 
730
- <code>'success' | 'error' | 'pending' | 'downloading'</code>
730
+ <code>"success" | "error" | "pending" | "downloading"</code>
731
731
 
732
732
 
733
733
  #### DelayUntilNext
734
734
 
735
- <code>'background' | 'kill' | 'nativeVersion' | 'date'</code>
735
+ <code>"background" | "kill" | "nativeVersion" | "date"</code>
736
736
 
737
737
 
738
738
  #### DownloadChangeListener
@@ -11,138 +11,198 @@ import org.json.JSONTokener;
11
11
 
12
12
  public class BundleInfo {
13
13
 
14
- private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
15
-
16
- public static final String ID_BUILTIN = "builtin";
17
- public static final String VERSION_UNKNOWN = "unknown";
18
- public static final String DOWNLOADED_BUILTIN = "1970-01-01T00:00:00.000Z";
19
-
20
- private final String downloaded;
21
- private final String id;
22
- private final String version;
23
- private final String checksum;
24
- private final BundleStatus status;
25
-
26
- static {
27
- sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
28
- }
29
-
30
- public BundleInfo(final BundleInfo source) {
31
- this(source.id, source.version, source.status, source.downloaded, source.checksum);
32
- }
33
-
34
- public BundleInfo(final String id, final String version, final BundleStatus status, final Date downloaded, final String checksum) {
35
- this(id, version, status, sdf.format(downloaded), checksum);
36
- }
37
-
38
- public BundleInfo(final String id, final String version, final BundleStatus status, final String downloaded, final String checksum) {
39
- this.downloaded = downloaded.trim();
40
- this.id = id;
41
- this.version = version;
42
- this.checksum = checksum;
43
- this.status = status;
44
- }
45
-
46
- public Boolean isBuiltin() {
47
- return ID_BUILTIN.equals(this.id);
48
- }
49
-
50
- public Boolean isUnknown() {
51
- return VERSION_UNKNOWN.equals(this.id);
52
- }
53
-
54
- public Boolean isErrorStatus() {
55
- return BundleStatus.ERROR == this.status;
56
- }
57
-
58
- public Boolean isDeleted() {
59
- return BundleStatus.DELETED == this.status;
60
- }
61
-
62
- public boolean isDownloaded() {
63
- return !this.isBuiltin() && this.downloaded != null && !this.downloaded.equals("") && !this.isDeleted();
64
- }
65
-
66
- public String getDownloaded() {
67
- return this.isBuiltin() ? DOWNLOADED_BUILTIN : this.downloaded;
68
- }
69
-
70
- public BundleInfo setDownloaded(Date downloaded) {
71
- return new BundleInfo(this.id, this.version, this.status, downloaded, this.checksum);
72
- }
73
-
74
- public String getChecksum() {
75
- return this.isBuiltin() ? "" : this.checksum;
76
- }
77
-
78
- public BundleInfo setChecksum(String checksum) {
79
- return new BundleInfo(this.id, this.version, this.status, this.downloaded, checksum);
80
- }
81
-
82
- public String getId() {
83
- return this.isBuiltin() ? ID_BUILTIN : this.id;
84
- }
85
-
86
- public BundleInfo setId(String id) {
87
- return new BundleInfo(id, this.version, this.status, this.downloaded, this.checksum);
88
- }
89
-
90
- public String getVersionName() {
91
- return this.version == null ? ID_BUILTIN : this.version;
92
- }
93
-
94
- public BundleInfo setVersionName(String version) {
95
- return new BundleInfo(this.id, version, this.status, this.downloaded, this.checksum);
96
- }
97
-
98
- public BundleStatus getStatus() {
99
- return this.isBuiltin() ? BundleStatus.SUCCESS : this.status;
100
- }
101
-
102
- public BundleInfo setStatus(BundleStatus status) {
103
- return new BundleInfo(this.id, this.version, status, this.downloaded, this.checksum);
104
- }
105
-
106
- public static BundleInfo fromJSON(final JSObject json) throws JSONException {
107
- return BundleInfo.fromJSON(json.toString());
108
- }
109
-
110
- public static BundleInfo fromJSON(final String jsonString) throws JSONException {
111
- JSONObject json = new JSONObject(new JSONTokener(jsonString));
112
- return new BundleInfo(
113
- json.has("id") ? json.getString("id") : "",
114
- json.has("version") ? json.getString("version") : BundleInfo.VERSION_UNKNOWN,
115
- json.has("status") ? BundleStatus.fromString(json.getString("status")) : BundleStatus.PENDING,
116
- json.has("downloaded") ? json.getString("downloaded") : "",
117
- json.has("checksum") ? json.getString("checksum") : ""
118
- );
119
- }
120
-
121
- public JSObject toJSON() {
122
- final JSObject result = new JSObject();
123
- result.put("id", this.getId());
124
- result.put("version", this.getVersionName());
125
- result.put("downloaded", this.getDownloaded());
126
- result.put("checksum", this.getChecksum());
127
- result.put("status", this.getStatus());
128
- return result;
129
- }
130
-
131
- @Override
132
- public boolean equals(final Object o) {
133
- if (this == o) return true;
134
- if (!(o instanceof BundleInfo)) return false;
135
- final BundleInfo that = (BundleInfo) o;
136
- return this.getId().equals(that.getId());
137
- }
138
-
139
- @Override
140
- public int hashCode() {
141
- return Objects.hash(this.version);
142
- }
143
-
144
- @Override
145
- public String toString() {
146
- return this.toJSON().toString();
147
- }
14
+ private static final SimpleDateFormat sdf = new SimpleDateFormat(
15
+ "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
16
+ );
17
+
18
+ public static final String ID_BUILTIN = "builtin";
19
+ public static final String VERSION_UNKNOWN = "unknown";
20
+ public static final String DOWNLOADED_BUILTIN = "1970-01-01T00:00:00.000Z";
21
+
22
+ private final String downloaded;
23
+ private final String id;
24
+ private final String version;
25
+ private final String checksum;
26
+ private final BundleStatus status;
27
+
28
+ static {
29
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
30
+ }
31
+
32
+ public BundleInfo(final BundleInfo source) {
33
+ this(
34
+ source.id,
35
+ source.version,
36
+ source.status,
37
+ source.downloaded,
38
+ source.checksum
39
+ );
40
+ }
41
+
42
+ public BundleInfo(
43
+ final String id,
44
+ final String version,
45
+ final BundleStatus status,
46
+ final Date downloaded,
47
+ final String checksum
48
+ ) {
49
+ this(id, version, status, sdf.format(downloaded), checksum);
50
+ }
51
+
52
+ public BundleInfo(
53
+ final String id,
54
+ final String version,
55
+ final BundleStatus status,
56
+ final String downloaded,
57
+ final String checksum
58
+ ) {
59
+ this.downloaded = downloaded.trim();
60
+ this.id = id;
61
+ this.version = version;
62
+ this.checksum = checksum;
63
+ this.status = status;
64
+ }
65
+
66
+ public Boolean isBuiltin() {
67
+ return ID_BUILTIN.equals(this.id);
68
+ }
69
+
70
+ public Boolean isUnknown() {
71
+ return VERSION_UNKNOWN.equals(this.id);
72
+ }
73
+
74
+ public Boolean isErrorStatus() {
75
+ return BundleStatus.ERROR == this.status;
76
+ }
77
+
78
+ public Boolean isDeleted() {
79
+ return BundleStatus.DELETED == this.status;
80
+ }
81
+
82
+ public boolean isDownloaded() {
83
+ return (
84
+ !this.isBuiltin() &&
85
+ this.downloaded != null &&
86
+ !this.downloaded.equals("") &&
87
+ !this.isDeleted()
88
+ );
89
+ }
90
+
91
+ public String getDownloaded() {
92
+ return this.isBuiltin() ? DOWNLOADED_BUILTIN : this.downloaded;
93
+ }
94
+
95
+ public BundleInfo setDownloaded(Date downloaded) {
96
+ return new BundleInfo(
97
+ this.id,
98
+ this.version,
99
+ this.status,
100
+ downloaded,
101
+ this.checksum
102
+ );
103
+ }
104
+
105
+ public String getChecksum() {
106
+ return this.isBuiltin() ? "" : this.checksum;
107
+ }
108
+
109
+ public BundleInfo setChecksum(String checksum) {
110
+ return new BundleInfo(
111
+ this.id,
112
+ this.version,
113
+ this.status,
114
+ this.downloaded,
115
+ checksum
116
+ );
117
+ }
118
+
119
+ public String getId() {
120
+ return this.isBuiltin() ? ID_BUILTIN : this.id;
121
+ }
122
+
123
+ public BundleInfo setId(String id) {
124
+ return new BundleInfo(
125
+ id,
126
+ this.version,
127
+ this.status,
128
+ this.downloaded,
129
+ this.checksum
130
+ );
131
+ }
132
+
133
+ public String getVersionName() {
134
+ return this.version == null ? ID_BUILTIN : this.version;
135
+ }
136
+
137
+ public BundleInfo setVersionName(String version) {
138
+ return new BundleInfo(
139
+ this.id,
140
+ version,
141
+ this.status,
142
+ this.downloaded,
143
+ this.checksum
144
+ );
145
+ }
146
+
147
+ public BundleStatus getStatus() {
148
+ return this.isBuiltin() ? BundleStatus.SUCCESS : this.status;
149
+ }
150
+
151
+ public BundleInfo setStatus(BundleStatus status) {
152
+ return new BundleInfo(
153
+ this.id,
154
+ this.version,
155
+ status,
156
+ this.downloaded,
157
+ this.checksum
158
+ );
159
+ }
160
+
161
+ public static BundleInfo fromJSON(final JSObject json) throws JSONException {
162
+ return BundleInfo.fromJSON(json.toString());
163
+ }
164
+
165
+ public static BundleInfo fromJSON(final String jsonString)
166
+ throws JSONException {
167
+ JSONObject json = new JSONObject(new JSONTokener(jsonString));
168
+ return new BundleInfo(
169
+ json.has("id") ? json.getString("id") : "",
170
+ json.has("version")
171
+ ? json.getString("version")
172
+ : BundleInfo.VERSION_UNKNOWN,
173
+ json.has("status")
174
+ ? BundleStatus.fromString(json.getString("status"))
175
+ : BundleStatus.PENDING,
176
+ json.has("downloaded") ? json.getString("downloaded") : "",
177
+ json.has("checksum") ? json.getString("checksum") : ""
178
+ );
179
+ }
180
+
181
+ public JSObject toJSON() {
182
+ final JSObject result = new JSObject();
183
+ result.put("id", this.getId());
184
+ result.put("version", this.getVersionName());
185
+ result.put("downloaded", this.getDownloaded());
186
+ result.put("checksum", this.getChecksum());
187
+ result.put("status", this.getStatus());
188
+ return result;
189
+ }
190
+
191
+ @Override
192
+ public boolean equals(final Object o) {
193
+ if (this == o) return true;
194
+ if (!(o instanceof BundleInfo)) return false;
195
+ final BundleInfo that = (BundleInfo) o;
196
+ return this.getId().equals(that.getId());
197
+ }
198
+
199
+ @Override
200
+ public int hashCode() {
201
+ return Objects.hash(this.version);
202
+ }
203
+
204
+ @Override
205
+ public String toString() {
206
+ return this.toJSON().toString();
207
+ }
148
208
  }
@@ -4,35 +4,35 @@ import java.util.HashMap;
4
4
  import java.util.Map;
5
5
 
6
6
  public enum BundleStatus {
7
- SUCCESS("success"),
8
- ERROR("error"),
9
- PENDING("pending"),
10
- DELETED("deleted"),
11
- DOWNLOADING("downloading");
7
+ SUCCESS("success"),
8
+ ERROR("error"),
9
+ PENDING("pending"),
10
+ DELETED("deleted"),
11
+ DOWNLOADING("downloading");
12
12
 
13
- public final String label;
13
+ public final String label;
14
14
 
15
- private static final Map<String, BundleStatus> BY_LABEL = new HashMap<>();
15
+ private static final Map<String, BundleStatus> BY_LABEL = new HashMap<>();
16
16
 
17
- static {
18
- for (final BundleStatus e : values()) {
19
- BY_LABEL.put(e.label, e);
20
- }
17
+ static {
18
+ for (final BundleStatus e : values()) {
19
+ BY_LABEL.put(e.label, e);
21
20
  }
21
+ }
22
22
 
23
- BundleStatus(final String label) {
24
- this.label = label;
25
- }
23
+ BundleStatus(final String label) {
24
+ this.label = label;
25
+ }
26
26
 
27
- @Override
28
- public String toString() {
29
- return this.label;
30
- }
27
+ @Override
28
+ public String toString() {
29
+ return this.label;
30
+ }
31
31
 
32
- public static BundleStatus fromString(final String status) {
33
- if (status == null || status.isEmpty()) {
34
- return BundleStatus.PENDING;
35
- }
36
- return BundleStatus.BY_LABEL.get(status);
32
+ public static BundleStatus fromString(final String status) {
33
+ if (status == null || status.isEmpty()) {
34
+ return BundleStatus.PENDING;
37
35
  }
36
+ return BundleStatus.BY_LABEL.get(status);
37
+ }
38
38
  }