@capgo/capacitor-updater 5.7.4 → 5.7.9
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/android/src/main/java/ee/forgr/capacitor_updater/Callback.java +7 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +126 -203
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +57 -42
- package/ios/Plugin/CapacitorUpdater.swift +0 -6
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,6 @@ import com.android.volley.DefaultRetryPolicy;
|
|
|
23
23
|
import com.android.volley.NetworkResponse;
|
|
24
24
|
import com.android.volley.Request;
|
|
25
25
|
import com.android.volley.RequestQueue;
|
|
26
|
-
import com.android.volley.Response;
|
|
27
26
|
import com.android.volley.VolleyError;
|
|
28
27
|
import com.android.volley.toolbox.HttpHeaderParser;
|
|
29
28
|
import com.android.volley.toolbox.JsonObjectRequest;
|
|
@@ -48,6 +47,7 @@ import java.util.ArrayList;
|
|
|
48
47
|
import java.util.Date;
|
|
49
48
|
import java.util.Iterator;
|
|
50
49
|
import java.util.List;
|
|
50
|
+
import java.util.Objects;
|
|
51
51
|
import java.util.zip.CRC32;
|
|
52
52
|
import java.util.zip.ZipEntry;
|
|
53
53
|
import java.util.zip.ZipInputStream;
|
|
@@ -55,10 +55,6 @@ import javax.crypto.SecretKey;
|
|
|
55
55
|
import org.json.JSONException;
|
|
56
56
|
import org.json.JSONObject;
|
|
57
57
|
|
|
58
|
-
interface Callback {
|
|
59
|
-
void callback(JSObject jsoObject);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
58
|
public class CapacitorUpdater {
|
|
63
59
|
|
|
64
60
|
private static final String AB =
|
|
@@ -94,16 +90,13 @@ public class CapacitorUpdater {
|
|
|
94
90
|
public String deviceID = "";
|
|
95
91
|
public int timeout = 20000;
|
|
96
92
|
|
|
97
|
-
private final FilenameFilter filter =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
!name.startsWith(".DS_Store")
|
|
105
|
-
);
|
|
106
|
-
}
|
|
93
|
+
private final FilenameFilter filter = (f, name) -> {
|
|
94
|
+
// ignore directories generated by mac os x
|
|
95
|
+
return (
|
|
96
|
+
!name.startsWith("__MACOSX") &&
|
|
97
|
+
!name.startsWith(".") &&
|
|
98
|
+
!name.startsWith(".DS_Store")
|
|
99
|
+
);
|
|
107
100
|
};
|
|
108
101
|
|
|
109
102
|
private boolean isProd() {
|
|
@@ -142,23 +135,15 @@ public class CapacitorUpdater {
|
|
|
142
135
|
return (percent * (max - min)) / 100 + min;
|
|
143
136
|
}
|
|
144
137
|
|
|
145
|
-
void notifyDownload(final String id, final int percent) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
138
|
+
void notifyDownload(final String id, final int percent) {}
|
|
148
139
|
|
|
149
|
-
void directUpdateFinish(final BundleInfo latest) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
140
|
+
void directUpdateFinish(final BundleInfo latest) {}
|
|
152
141
|
|
|
153
|
-
void notifyListeners(final String id, final JSObject res) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
142
|
+
void notifyListeners(final String id, final JSObject res) {}
|
|
156
143
|
|
|
157
|
-
private String randomString(
|
|
158
|
-
final StringBuilder sb = new StringBuilder(
|
|
159
|
-
for (int i = 0; i <
|
|
160
|
-
AB.charAt(rnd.nextInt(AB.length()))
|
|
161
|
-
);
|
|
144
|
+
private String randomString() {
|
|
145
|
+
final StringBuilder sb = new StringBuilder(10);
|
|
146
|
+
for (int i = 0; i < 10; i++) sb.append(AB.charAt(rnd.nextInt(AB.length())));
|
|
162
147
|
return sb.toString();
|
|
163
148
|
}
|
|
164
149
|
|
|
@@ -204,8 +189,8 @@ public class CapacitorUpdater {
|
|
|
204
189
|
);
|
|
205
190
|
}
|
|
206
191
|
|
|
192
|
+
assert dir != null;
|
|
207
193
|
if (!dir.isDirectory() && !dir.mkdirs()) {
|
|
208
|
-
final JSObject ret = new JSObject();
|
|
209
194
|
this.sendStats("directory_path_fail");
|
|
210
195
|
throw new FileNotFoundException(
|
|
211
196
|
"Failed to ensure directory: " + dir.getAbsolutePath()
|
|
@@ -247,7 +232,7 @@ public class CapacitorUpdater {
|
|
|
247
232
|
);
|
|
248
233
|
}
|
|
249
234
|
final File destinationFile = new File(this.documentsDir, dest);
|
|
250
|
-
destinationFile.getParentFile().mkdirs();
|
|
235
|
+
Objects.requireNonNull(destinationFile.getParentFile()).mkdirs();
|
|
251
236
|
final String[] entries = sourceFile.list(this.filter);
|
|
252
237
|
if (entries == null || entries.length == 0) {
|
|
253
238
|
throw new IOException(
|
|
@@ -282,17 +267,17 @@ public class CapacitorUpdater {
|
|
|
282
267
|
this.activity.unregisterReceiver(receiver);
|
|
283
268
|
}
|
|
284
269
|
|
|
285
|
-
private BroadcastReceiver receiver = new BroadcastReceiver() {
|
|
270
|
+
private final BroadcastReceiver receiver = new BroadcastReceiver() {
|
|
286
271
|
@Override
|
|
287
272
|
public void onReceive(Context context, Intent intent) {
|
|
288
273
|
String action = intent.getAction();
|
|
289
274
|
Bundle bundle = intent.getExtras();
|
|
290
275
|
if (bundle != null) {
|
|
291
|
-
if (action
|
|
276
|
+
if (Objects.equals(action, DownloadService.PERCENTDOWNLOAD)) {
|
|
292
277
|
String id = bundle.getString(DownloadService.ID);
|
|
293
278
|
int percent = bundle.getInt(DownloadService.PERCENT);
|
|
294
279
|
CapacitorUpdater.this.notifyDownload(id, percent);
|
|
295
|
-
} else if (action
|
|
280
|
+
} else if (Objects.equals(action, DownloadService.NOTIFICATION)) {
|
|
296
281
|
String id = bundle.getString(DownloadService.ID);
|
|
297
282
|
String dest = bundle.getString(DownloadService.FILEDEST);
|
|
298
283
|
String version = bundle.getString(DownloadService.VERSION);
|
|
@@ -357,7 +342,7 @@ public class CapacitorUpdater {
|
|
|
357
342
|
final String checksum;
|
|
358
343
|
checksum = this.getChecksum(downloaded);
|
|
359
344
|
this.notifyDownload(id, 71);
|
|
360
|
-
final File unzipped = this.unzip(id, downloaded, this.randomString(
|
|
345
|
+
final File unzipped = this.unzip(id, downloaded, this.randomString());
|
|
361
346
|
downloaded.delete();
|
|
362
347
|
this.notifyDownload(id, 91);
|
|
363
348
|
final String idName = bundleDirectory + "/" + id;
|
|
@@ -438,7 +423,7 @@ public class CapacitorUpdater {
|
|
|
438
423
|
this.activity.startService(intent);
|
|
439
424
|
}
|
|
440
425
|
|
|
441
|
-
private
|
|
426
|
+
private void downloadFile(
|
|
442
427
|
final String id,
|
|
443
428
|
final String url,
|
|
444
429
|
final String dest
|
|
@@ -447,7 +432,7 @@ public class CapacitorUpdater {
|
|
|
447
432
|
final URLConnection connection = u.openConnection();
|
|
448
433
|
|
|
449
434
|
final File target = new File(this.documentsDir, dest);
|
|
450
|
-
target.getParentFile().mkdirs();
|
|
435
|
+
Objects.requireNonNull(target.getParentFile()).mkdirs();
|
|
451
436
|
target.createNewFile();
|
|
452
437
|
|
|
453
438
|
final long totalLength = connection.getContentLength();
|
|
@@ -477,7 +462,6 @@ public class CapacitorUpdater {
|
|
|
477
462
|
this.sendStats("low_mem_fail");
|
|
478
463
|
throw new IOException("OutOfMemoryError while downloading file");
|
|
479
464
|
}
|
|
480
|
-
return target;
|
|
481
465
|
}
|
|
482
466
|
|
|
483
467
|
private void deleteDirectory(final File file) throws IOException {
|
|
@@ -574,7 +558,7 @@ public class CapacitorUpdater {
|
|
|
574
558
|
final String sessionKey,
|
|
575
559
|
final String checksum
|
|
576
560
|
) {
|
|
577
|
-
final String id = this.randomString(
|
|
561
|
+
final String id = this.randomString();
|
|
578
562
|
this.saveBundleInfo(
|
|
579
563
|
id,
|
|
580
564
|
new BundleInfo(
|
|
@@ -593,7 +577,7 @@ public class CapacitorUpdater {
|
|
|
593
577
|
version,
|
|
594
578
|
sessionKey,
|
|
595
579
|
checksum,
|
|
596
|
-
this.randomString(
|
|
580
|
+
this.randomString()
|
|
597
581
|
);
|
|
598
582
|
}
|
|
599
583
|
|
|
@@ -603,7 +587,7 @@ public class CapacitorUpdater {
|
|
|
603
587
|
final String sessionKey,
|
|
604
588
|
final String checksum
|
|
605
589
|
) throws IOException {
|
|
606
|
-
final String id = this.randomString(
|
|
590
|
+
final String id = this.randomString();
|
|
607
591
|
this.saveBundleInfo(
|
|
608
592
|
id,
|
|
609
593
|
new BundleInfo(
|
|
@@ -615,10 +599,9 @@ public class CapacitorUpdater {
|
|
|
615
599
|
)
|
|
616
600
|
);
|
|
617
601
|
this.notifyDownload(id, 0);
|
|
618
|
-
final String idName = bundleDirectory + "/" + id;
|
|
619
602
|
this.notifyDownload(id, 5);
|
|
620
|
-
final String dest = this.randomString(
|
|
621
|
-
|
|
603
|
+
final String dest = this.randomString();
|
|
604
|
+
this.downloadFile(id, url, dest);
|
|
622
605
|
final Boolean finished =
|
|
623
606
|
this.finishDownload(id, dest, version, sessionKey, checksum, false);
|
|
624
607
|
final BundleStatus status = finished
|
|
@@ -640,7 +623,7 @@ public class CapacitorUpdater {
|
|
|
640
623
|
final File destHot = new File(this.documentsDir, bundleDirectory);
|
|
641
624
|
Log.d(TAG, "list File : " + destHot.getPath());
|
|
642
625
|
if (destHot.exists()) {
|
|
643
|
-
for (final File i : destHot.listFiles()) {
|
|
626
|
+
for (final File i : Objects.requireNonNull(destHot.listFiles())) {
|
|
644
627
|
final String id = i.getName();
|
|
645
628
|
res.add(this.getBundleInfo(id));
|
|
646
629
|
}
|
|
@@ -683,15 +666,12 @@ public class CapacitorUpdater {
|
|
|
683
666
|
private boolean bundleExists(final String id) {
|
|
684
667
|
final File bundle = this.getBundleDirectory(id);
|
|
685
668
|
final BundleInfo bundleInfo = this.getBundleInfo(id);
|
|
686
|
-
|
|
669
|
+
return (
|
|
687
670
|
bundle.isDirectory() &&
|
|
688
671
|
bundle.exists() &&
|
|
689
672
|
new File(bundle.getPath(), "/index.html").exists() &&
|
|
690
673
|
!bundleInfo.isDeleted()
|
|
691
|
-
)
|
|
692
|
-
return true;
|
|
693
|
-
}
|
|
694
|
-
return false;
|
|
674
|
+
);
|
|
695
675
|
}
|
|
696
676
|
|
|
697
677
|
public Boolean set(final BundleInfo bundle) {
|
|
@@ -803,10 +783,10 @@ public class CapacitorUpdater {
|
|
|
803
783
|
);
|
|
804
784
|
retError.put("message", message + ": " + json);
|
|
805
785
|
} catch (UnsupportedEncodingException e) {
|
|
806
|
-
retError.put("message", message + ": " + e
|
|
786
|
+
retError.put("message", message + ": " + e);
|
|
807
787
|
}
|
|
808
788
|
} else {
|
|
809
|
-
retError.put("message", message + ": " + error
|
|
789
|
+
retError.put("message", message + ": " + error);
|
|
810
790
|
}
|
|
811
791
|
Log.e(TAG, message + ": " + retError);
|
|
812
792
|
return retError;
|
|
@@ -820,7 +800,7 @@ public class CapacitorUpdater {
|
|
|
820
800
|
Log.e(TAG, "Error getLatest JSONException", e);
|
|
821
801
|
e.printStackTrace();
|
|
822
802
|
final JSObject retError = new JSObject();
|
|
823
|
-
retError.put("message", "Cannot get info: " + e
|
|
803
|
+
retError.put("message", "Cannot get info: " + e);
|
|
824
804
|
retError.put("error", "json_error");
|
|
825
805
|
callback.callback(retError);
|
|
826
806
|
return;
|
|
@@ -832,49 +812,40 @@ public class CapacitorUpdater {
|
|
|
832
812
|
Request.Method.POST,
|
|
833
813
|
updateUrl,
|
|
834
814
|
json,
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
} else {
|
|
847
|
-
ret.put(key, res.get(key));
|
|
848
|
-
}
|
|
849
|
-
} catch (JSONException e) {
|
|
850
|
-
e.printStackTrace();
|
|
851
|
-
final JSObject retError = new JSObject();
|
|
852
|
-
retError.put("message", "Cannot set info: " + e.toString());
|
|
853
|
-
retError.put("error", "response_error");
|
|
854
|
-
callback.callback(retError);
|
|
815
|
+
res -> {
|
|
816
|
+
final JSObject ret = new JSObject();
|
|
817
|
+
Iterator<String> keys = res.keys();
|
|
818
|
+
while (keys.hasNext()) {
|
|
819
|
+
String key = keys.next();
|
|
820
|
+
if (res.has(key)) {
|
|
821
|
+
try {
|
|
822
|
+
if ("session_key".equals(key)) {
|
|
823
|
+
ret.put("sessionKey", res.get(key));
|
|
824
|
+
} else {
|
|
825
|
+
ret.put(key, res.get(key));
|
|
855
826
|
}
|
|
827
|
+
} catch (JSONException e) {
|
|
828
|
+
e.printStackTrace();
|
|
829
|
+
final JSObject retError = new JSObject();
|
|
830
|
+
retError.put("message", "Cannot set info: " + e);
|
|
831
|
+
retError.put("error", "response_error");
|
|
832
|
+
callback.callback(retError);
|
|
856
833
|
}
|
|
857
834
|
}
|
|
858
|
-
callback.callback(ret);
|
|
859
835
|
}
|
|
836
|
+
callback.callback(ret);
|
|
860
837
|
},
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
CapacitorUpdater.this.createError("Error get latest", error)
|
|
866
|
-
);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
838
|
+
error ->
|
|
839
|
+
callback.callback(
|
|
840
|
+
CapacitorUpdater.this.createError("Error get latest", error)
|
|
841
|
+
)
|
|
869
842
|
);
|
|
870
843
|
this.requestQueue.add(setRetryPolicy(request));
|
|
871
844
|
}
|
|
872
845
|
|
|
873
846
|
public void unsetChannel(final Callback callback) {
|
|
874
847
|
String channelUrl = this.channelUrl;
|
|
875
|
-
if (
|
|
876
|
-
channelUrl == null || "".equals(channelUrl) || channelUrl.length() == 0
|
|
877
|
-
) {
|
|
848
|
+
if (channelUrl == null || channelUrl.isEmpty()) {
|
|
878
849
|
Log.e(TAG, "Channel URL is not set");
|
|
879
850
|
final JSObject retError = new JSObject();
|
|
880
851
|
retError.put("message", "channelUrl missing");
|
|
@@ -882,14 +853,14 @@ public class CapacitorUpdater {
|
|
|
882
853
|
callback.callback(retError);
|
|
883
854
|
return;
|
|
884
855
|
}
|
|
885
|
-
JSONObject json
|
|
856
|
+
JSONObject json;
|
|
886
857
|
try {
|
|
887
858
|
json = this.createInfoObject();
|
|
888
859
|
} catch (JSONException e) {
|
|
889
860
|
Log.e(TAG, "Error unsetChannel JSONException", e);
|
|
890
861
|
e.printStackTrace();
|
|
891
862
|
final JSObject retError = new JSObject();
|
|
892
|
-
retError.put("message", "Cannot get info: " + e
|
|
863
|
+
retError.put("message", "Cannot get info: " + e);
|
|
893
864
|
retError.put("error", "json_error");
|
|
894
865
|
callback.callback(retError);
|
|
895
866
|
return;
|
|
@@ -899,49 +870,37 @@ public class CapacitorUpdater {
|
|
|
899
870
|
Request.Method.DELETE,
|
|
900
871
|
channelUrl,
|
|
901
872
|
json,
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
"message",
|
|
917
|
-
"Cannot unset channel: " + e.toString()
|
|
918
|
-
);
|
|
919
|
-
retError.put("error", "response_error");
|
|
920
|
-
callback.callback(ret);
|
|
921
|
-
}
|
|
873
|
+
res -> {
|
|
874
|
+
final JSObject ret = new JSObject();
|
|
875
|
+
Iterator<String> keys = res.keys();
|
|
876
|
+
while (keys.hasNext()) {
|
|
877
|
+
String key = keys.next();
|
|
878
|
+
if (res.has(key)) {
|
|
879
|
+
try {
|
|
880
|
+
ret.put(key, res.get(key));
|
|
881
|
+
} catch (JSONException e) {
|
|
882
|
+
e.printStackTrace();
|
|
883
|
+
final JSObject retError = new JSObject();
|
|
884
|
+
retError.put("message", "Cannot unset channel: " + e);
|
|
885
|
+
retError.put("error", "response_error");
|
|
886
|
+
callback.callback(ret);
|
|
922
887
|
}
|
|
923
888
|
}
|
|
924
|
-
Log.i(TAG, "Channel unset");
|
|
925
|
-
callback.callback(ret);
|
|
926
889
|
}
|
|
890
|
+
Log.i(TAG, "Channel unset");
|
|
891
|
+
callback.callback(ret);
|
|
927
892
|
},
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
CapacitorUpdater.this.createError("Error unset channel", error)
|
|
933
|
-
);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
893
|
+
error ->
|
|
894
|
+
callback.callback(
|
|
895
|
+
CapacitorUpdater.this.createError("Error unset channel", error)
|
|
896
|
+
)
|
|
936
897
|
);
|
|
937
898
|
this.requestQueue.add(setRetryPolicy(request));
|
|
938
899
|
}
|
|
939
900
|
|
|
940
901
|
public void setChannel(final String channel, final Callback callback) {
|
|
941
902
|
String channelUrl = this.channelUrl;
|
|
942
|
-
if (
|
|
943
|
-
channelUrl == null || "".equals(channelUrl) || channelUrl.length() == 0
|
|
944
|
-
) {
|
|
903
|
+
if (channelUrl == null || channelUrl.isEmpty()) {
|
|
945
904
|
Log.e(TAG, "Channel URL is not set");
|
|
946
905
|
final JSObject retError = new JSObject();
|
|
947
906
|
retError.put("message", "channelUrl missing");
|
|
@@ -949,7 +908,7 @@ public class CapacitorUpdater {
|
|
|
949
908
|
callback.callback(retError);
|
|
950
909
|
return;
|
|
951
910
|
}
|
|
952
|
-
JSONObject json
|
|
911
|
+
JSONObject json;
|
|
953
912
|
try {
|
|
954
913
|
json = this.createInfoObject();
|
|
955
914
|
json.put("channel", channel);
|
|
@@ -957,7 +916,7 @@ public class CapacitorUpdater {
|
|
|
957
916
|
Log.e(TAG, "Error setChannel JSONException", e);
|
|
958
917
|
e.printStackTrace();
|
|
959
918
|
final JSObject retError = new JSObject();
|
|
960
|
-
retError.put("message", "Cannot get info: " + e
|
|
919
|
+
retError.put("message", "Cannot get info: " + e);
|
|
961
920
|
retError.put("error", "json_error");
|
|
962
921
|
callback.callback(retError);
|
|
963
922
|
return;
|
|
@@ -967,46 +926,37 @@ public class CapacitorUpdater {
|
|
|
967
926
|
Request.Method.POST,
|
|
968
927
|
channelUrl,
|
|
969
928
|
json,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
retError.put("error", "response_error");
|
|
985
|
-
callback.callback(ret);
|
|
986
|
-
}
|
|
929
|
+
res -> {
|
|
930
|
+
final JSObject ret = new JSObject();
|
|
931
|
+
Iterator<String> keys = res.keys();
|
|
932
|
+
while (keys.hasNext()) {
|
|
933
|
+
String key = keys.next();
|
|
934
|
+
if (res.has(key)) {
|
|
935
|
+
try {
|
|
936
|
+
ret.put(key, res.get(key));
|
|
937
|
+
} catch (JSONException e) {
|
|
938
|
+
e.printStackTrace();
|
|
939
|
+
final JSObject retError = new JSObject();
|
|
940
|
+
retError.put("message", "Cannot set channel: " + e);
|
|
941
|
+
retError.put("error", "response_error");
|
|
942
|
+
callback.callback(ret);
|
|
987
943
|
}
|
|
988
944
|
}
|
|
989
|
-
Log.i(TAG, "Channel set to \"" + channel);
|
|
990
|
-
callback.callback(ret);
|
|
991
945
|
}
|
|
946
|
+
Log.i(TAG, "Channel set to \"" + channel);
|
|
947
|
+
callback.callback(ret);
|
|
992
948
|
},
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
CapacitorUpdater.this.createError("Error set channel", error)
|
|
998
|
-
);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
949
|
+
error ->
|
|
950
|
+
callback.callback(
|
|
951
|
+
CapacitorUpdater.this.createError("Error set channel", error)
|
|
952
|
+
)
|
|
1001
953
|
);
|
|
1002
954
|
this.requestQueue.add(setRetryPolicy(request));
|
|
1003
955
|
}
|
|
1004
956
|
|
|
1005
957
|
public void getChannel(final Callback callback) {
|
|
1006
958
|
String channelUrl = this.channelUrl;
|
|
1007
|
-
if (
|
|
1008
|
-
channelUrl == null || "".equals(channelUrl) || channelUrl.length() == 0
|
|
1009
|
-
) {
|
|
959
|
+
if (channelUrl == null || channelUrl.isEmpty()) {
|
|
1010
960
|
Log.e(TAG, "Channel URL is not set");
|
|
1011
961
|
final JSObject retError = new JSObject();
|
|
1012
962
|
retError.put("message", "Channel URL is not set");
|
|
@@ -1014,14 +964,14 @@ public class CapacitorUpdater {
|
|
|
1014
964
|
callback.callback(retError);
|
|
1015
965
|
return;
|
|
1016
966
|
}
|
|
1017
|
-
JSONObject json
|
|
967
|
+
JSONObject json;
|
|
1018
968
|
try {
|
|
1019
969
|
json = this.createInfoObject();
|
|
1020
970
|
} catch (JSONException e) {
|
|
1021
971
|
Log.e(TAG, "Error getChannel JSONException", e);
|
|
1022
972
|
e.printStackTrace();
|
|
1023
973
|
final JSObject retError = new JSObject();
|
|
1024
|
-
retError.put("message", "Cannot get info: " + e
|
|
974
|
+
retError.put("message", "Cannot get info: " + e);
|
|
1025
975
|
retError.put("error", "json_error");
|
|
1026
976
|
callback.callback(retError);
|
|
1027
977
|
return;
|
|
@@ -1031,33 +981,26 @@ public class CapacitorUpdater {
|
|
|
1031
981
|
Request.Method.PUT,
|
|
1032
982
|
channelUrl,
|
|
1033
983
|
json,
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
} catch (JSONException e) {
|
|
1045
|
-
e.printStackTrace();
|
|
1046
|
-
}
|
|
984
|
+
res -> {
|
|
985
|
+
final JSObject ret = new JSObject();
|
|
986
|
+
Iterator<String> keys = res.keys();
|
|
987
|
+
while (keys.hasNext()) {
|
|
988
|
+
String key = keys.next();
|
|
989
|
+
if (res.has(key)) {
|
|
990
|
+
try {
|
|
991
|
+
ret.put(key, res.get(key));
|
|
992
|
+
} catch (JSONException e) {
|
|
993
|
+
e.printStackTrace();
|
|
1047
994
|
}
|
|
1048
995
|
}
|
|
1049
|
-
Log.i(TAG, "Channel get to \"" + ret);
|
|
1050
|
-
callback.callback(ret);
|
|
1051
996
|
}
|
|
997
|
+
Log.i(TAG, "Channel get to \"" + ret);
|
|
998
|
+
callback.callback(ret);
|
|
1052
999
|
},
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
CapacitorUpdater.this.createError("Error get channel", error)
|
|
1058
|
-
);
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1000
|
+
error ->
|
|
1001
|
+
callback.callback(
|
|
1002
|
+
CapacitorUpdater.this.createError("Error get channel", error)
|
|
1003
|
+
)
|
|
1061
1004
|
);
|
|
1062
1005
|
this.requestQueue.add(setRetryPolicy(request));
|
|
1063
1006
|
}
|
|
@@ -1068,10 +1011,10 @@ public class CapacitorUpdater {
|
|
|
1068
1011
|
|
|
1069
1012
|
public void sendStats(final String action, final String versionName) {
|
|
1070
1013
|
String statsUrl = this.statsUrl;
|
|
1071
|
-
if (statsUrl == null ||
|
|
1014
|
+
if (statsUrl == null || statsUrl.isEmpty()) {
|
|
1072
1015
|
return;
|
|
1073
1016
|
}
|
|
1074
|
-
JSONObject json
|
|
1017
|
+
JSONObject json;
|
|
1075
1018
|
try {
|
|
1076
1019
|
json = this.createInfoObject();
|
|
1077
1020
|
json.put("action", action);
|
|
@@ -1085,21 +1028,9 @@ public class CapacitorUpdater {
|
|
|
1085
1028
|
Request.Method.POST,
|
|
1086
1029
|
statsUrl,
|
|
1087
1030
|
json,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
Log.i(
|
|
1092
|
-
TAG,
|
|
1093
|
-
"Stats send for \"" + action + "\", version " + versionName
|
|
1094
|
-
);
|
|
1095
|
-
}
|
|
1096
|
-
},
|
|
1097
|
-
new Response.ErrorListener() {
|
|
1098
|
-
@Override
|
|
1099
|
-
public void onErrorResponse(VolleyError error) {
|
|
1100
|
-
CapacitorUpdater.this.createError("Error send stats", error);
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1031
|
+
response ->
|
|
1032
|
+
Log.i(TAG, "Stats send for \"" + action + "\", version " + versionName),
|
|
1033
|
+
error -> CapacitorUpdater.this.createError("Error send stats", error)
|
|
1103
1034
|
);
|
|
1104
1035
|
this.requestQueue.add(setRetryPolicy(request));
|
|
1105
1036
|
}
|
|
@@ -1161,14 +1092,6 @@ public class CapacitorUpdater {
|
|
|
1161
1092
|
this.editor.commit();
|
|
1162
1093
|
}
|
|
1163
1094
|
|
|
1164
|
-
public void setVersionName(final String id, final String name) {
|
|
1165
|
-
if (id != null) {
|
|
1166
|
-
Log.d(TAG, "Setting name for bundle [" + id + "] to " + name);
|
|
1167
|
-
BundleInfo info = this.getBundleInfo(id);
|
|
1168
|
-
this.saveBundleInfo(id, info.setVersionName(name));
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
1095
|
private void setBundleStatus(final String id, final BundleStatus status) {
|
|
1173
1096
|
if (id != null && status != null) {
|
|
1174
1097
|
BundleInfo info = this.getBundleInfo(id);
|
|
@@ -1192,7 +1115,7 @@ public class CapacitorUpdater {
|
|
|
1192
1115
|
|
|
1193
1116
|
public String getCurrentBundlePath() {
|
|
1194
1117
|
String path = this.prefs.getString(WebView.CAP_SERVER_PATH, "public");
|
|
1195
|
-
if (
|
|
1118
|
+
if (path.trim().isEmpty()) {
|
|
1196
1119
|
return "public";
|
|
1197
1120
|
}
|
|
1198
1121
|
return path;
|
|
@@ -8,7 +8,6 @@ package ee.forgr.capacitor_updater;
|
|
|
8
8
|
|
|
9
9
|
import android.app.Activity;
|
|
10
10
|
import android.app.ActivityManager;
|
|
11
|
-
import android.app.Application;
|
|
12
11
|
import android.content.Context;
|
|
13
12
|
import android.content.SharedPreferences;
|
|
14
13
|
import android.content.pm.PackageInfo;
|
|
@@ -36,6 +35,7 @@ import java.util.ArrayList;
|
|
|
36
35
|
import java.util.Date;
|
|
37
36
|
import java.util.Iterator;
|
|
38
37
|
import java.util.List;
|
|
38
|
+
import java.util.Objects;
|
|
39
39
|
import java.util.Timer;
|
|
40
40
|
import java.util.TimerTask;
|
|
41
41
|
import java.util.UUID;
|
|
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
55
55
|
private static final String channelUrlDefault =
|
|
56
56
|
"https://api.capgo.app/channel_self";
|
|
57
57
|
|
|
58
|
-
private final String PLUGIN_VERSION = "5.7.
|
|
58
|
+
private final String PLUGIN_VERSION = "5.7.9";
|
|
59
59
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
60
60
|
|
|
61
61
|
private SharedPreferences.Editor editor;
|
|
@@ -70,7 +70,6 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
70
70
|
private Boolean autoUpdate = false;
|
|
71
71
|
private String updateUrl = "";
|
|
72
72
|
private Version currentVersionNative;
|
|
73
|
-
private Boolean resetWhenUpdate = true;
|
|
74
73
|
private Thread backgroundTask;
|
|
75
74
|
private Boolean taskRunning = false;
|
|
76
75
|
|
|
@@ -167,7 +166,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
167
166
|
this.implementation.appId =
|
|
168
167
|
this.getConfig().getString("appId", this.implementation.appId);
|
|
169
168
|
if (
|
|
170
|
-
this.implementation.appId == null ||
|
|
169
|
+
this.implementation.appId == null || this.implementation.appId.isEmpty()
|
|
171
170
|
) {
|
|
172
171
|
// crash the app
|
|
173
172
|
throw new RuntimeException(
|
|
@@ -215,32 +214,29 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
215
214
|
this.appReadyTimeout = this.getConfig().getInt("appReadyTimeout", 10000);
|
|
216
215
|
this.implementation.timeout =
|
|
217
216
|
this.getConfig().getInt("responseTimeout", 20) * 1000;
|
|
218
|
-
|
|
217
|
+
boolean resetWhenUpdate =
|
|
218
|
+
this.getConfig().getBoolean("resetWhenUpdate", true);
|
|
219
219
|
|
|
220
|
-
if (
|
|
220
|
+
if (resetWhenUpdate) {
|
|
221
221
|
this.cleanupObsoleteVersions();
|
|
222
222
|
}
|
|
223
|
-
final Application application = (Application) this.getContext()
|
|
224
|
-
.getApplicationContext();
|
|
225
223
|
|
|
226
224
|
this.checkForUpdateAfterDelay();
|
|
227
|
-
// application.registerActivityLifecycleCallbacks(this);
|
|
228
225
|
}
|
|
229
226
|
|
|
230
227
|
private void semaphoreWait(Number waitTime) {
|
|
231
228
|
Log.i(CapacitorUpdater.TAG, "semaphoreWait " + waitTime);
|
|
232
229
|
try {
|
|
233
230
|
// Log.i(CapacitorUpdater.TAG, "semaphoreReady count " + CapacitorUpdaterPlugin.this.semaphoreReady.getCount());
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
231
|
+
semaphoreReady.awaitAdvanceInterruptibly(
|
|
232
|
+
semaphoreReady.getPhase(),
|
|
233
|
+
waitTime.longValue(),
|
|
234
|
+
TimeUnit.SECONDS
|
|
235
|
+
);
|
|
239
236
|
// Log.i(CapacitorUpdater.TAG, "semaphoreReady await " + res);
|
|
240
237
|
Log.i(
|
|
241
238
|
CapacitorUpdater.TAG,
|
|
242
|
-
"semaphoreReady count " +
|
|
243
|
-
CapacitorUpdaterPlugin.this.semaphoreReady.getPhase()
|
|
239
|
+
"semaphoreReady count " + semaphoreReady.getPhase()
|
|
244
240
|
);
|
|
245
241
|
} catch (InterruptedException e) {
|
|
246
242
|
Log.i(CapacitorUpdater.TAG, "semaphoreWait InterruptedException");
|
|
@@ -252,17 +248,16 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
252
248
|
|
|
253
249
|
private void semaphoreUp() {
|
|
254
250
|
Log.i(CapacitorUpdater.TAG, "semaphoreUp");
|
|
255
|
-
|
|
251
|
+
semaphoreReady.register();
|
|
256
252
|
}
|
|
257
253
|
|
|
258
254
|
private void semaphoreDown() {
|
|
259
255
|
Log.i(CapacitorUpdater.TAG, "semaphoreDown");
|
|
260
256
|
Log.i(
|
|
261
257
|
CapacitorUpdater.TAG,
|
|
262
|
-
"semaphoreDown count " +
|
|
263
|
-
CapacitorUpdaterPlugin.this.semaphoreReady.getPhase()
|
|
258
|
+
"semaphoreDown count " + semaphoreReady.getPhase()
|
|
264
259
|
);
|
|
265
|
-
|
|
260
|
+
semaphoreReady.arriveAndDeregister();
|
|
266
261
|
}
|
|
267
262
|
|
|
268
263
|
private void sendReadyToJs(final BundleInfo current, final String msg) {
|
|
@@ -292,8 +287,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
292
287
|
try {
|
|
293
288
|
if (
|
|
294
289
|
!"".equals(previous.getOriginalString()) &&
|
|
295
|
-
!
|
|
296
|
-
.
|
|
290
|
+
!Objects.equals(
|
|
291
|
+
this.currentVersionNative.getOriginalString(),
|
|
292
|
+
previous.getOriginalString()
|
|
293
|
+
)
|
|
297
294
|
) {
|
|
298
295
|
Log.i(
|
|
299
296
|
CapacitorUpdater.TAG,
|
|
@@ -483,7 +480,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
483
480
|
} else {
|
|
484
481
|
if (
|
|
485
482
|
CapacitorUpdaterPlugin.this._isAutoUpdateEnabled() &&
|
|
486
|
-
triggerAutoUpdate
|
|
483
|
+
Boolean.TRUE.equals(triggerAutoUpdate)
|
|
487
484
|
) {
|
|
488
485
|
Log.i(
|
|
489
486
|
CapacitorUpdater.TAG,
|
|
@@ -528,7 +525,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
528
525
|
} else {
|
|
529
526
|
if (
|
|
530
527
|
CapacitorUpdaterPlugin.this._isAutoUpdateEnabled() &&
|
|
531
|
-
triggerAutoUpdate
|
|
528
|
+
Boolean.TRUE.equals(triggerAutoUpdate)
|
|
532
529
|
) {
|
|
533
530
|
Log.i(
|
|
534
531
|
CapacitorUpdater.TAG,
|
|
@@ -606,7 +603,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
606
603
|
final JSObject ret = new JSObject();
|
|
607
604
|
ret.put("version", version);
|
|
608
605
|
CapacitorUpdaterPlugin.this.notifyListeners("downloadFailed", ret);
|
|
609
|
-
|
|
606
|
+
final BundleInfo current =
|
|
607
|
+
CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
608
|
+
CapacitorUpdaterPlugin.this.implementation.sendStats(
|
|
609
|
+
"download_fail",
|
|
610
|
+
current.getVersionName()
|
|
611
|
+
);
|
|
610
612
|
}
|
|
611
613
|
});
|
|
612
614
|
} catch (final Exception e) {
|
|
@@ -615,7 +617,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
615
617
|
final JSObject ret = new JSObject();
|
|
616
618
|
ret.put("version", version);
|
|
617
619
|
CapacitorUpdaterPlugin.this.notifyListeners("downloadFailed", ret);
|
|
618
|
-
|
|
620
|
+
final BundleInfo current =
|
|
621
|
+
CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
622
|
+
CapacitorUpdaterPlugin.this.implementation.sendStats(
|
|
623
|
+
"download_fail",
|
|
624
|
+
current.getVersionName()
|
|
625
|
+
);
|
|
619
626
|
}
|
|
620
627
|
}
|
|
621
628
|
|
|
@@ -822,9 +829,6 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
822
829
|
if (this.periodCheckDelay == 0 || !this._isAutoUpdateEnabled()) {
|
|
823
830
|
return;
|
|
824
831
|
}
|
|
825
|
-
// The delay should be equal to this.periodCheckDelay.
|
|
826
|
-
// In appMovedToForeground we schedule a backgroundDownload and it happens BEFORE this scheduleAtFixedRate
|
|
827
|
-
// As such we get a race condition
|
|
828
832
|
final Timer timer = new Timer();
|
|
829
833
|
timer.scheduleAtFixedRate(
|
|
830
834
|
new TimerTask() {
|
|
@@ -835,14 +839,17 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
835
839
|
CapacitorUpdaterPlugin.this.updateUrl,
|
|
836
840
|
res -> {
|
|
837
841
|
if (res.has("error")) {
|
|
838
|
-
Log.e(
|
|
842
|
+
Log.e(
|
|
843
|
+
CapacitorUpdater.TAG,
|
|
844
|
+
Objects.requireNonNull(res.getString("error"))
|
|
845
|
+
);
|
|
839
846
|
return;
|
|
840
847
|
} else if (res.has("version")) {
|
|
841
848
|
String newVersion = res.getString("version");
|
|
842
849
|
String currentVersion = String.valueOf(
|
|
843
850
|
CapacitorUpdaterPlugin.this.implementation.getCurrentBundle()
|
|
844
851
|
);
|
|
845
|
-
if (!
|
|
852
|
+
if (!Objects.equals(newVersion, currentVersion)) {
|
|
846
853
|
Log.i(
|
|
847
854
|
CapacitorUpdater.TAG,
|
|
848
855
|
"New version found: " + newVersion
|
|
@@ -857,7 +864,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
857
864
|
}
|
|
858
865
|
}
|
|
859
866
|
},
|
|
860
|
-
|
|
867
|
+
0,
|
|
861
868
|
this.periodCheckDelay
|
|
862
869
|
);
|
|
863
870
|
}
|
|
@@ -967,7 +974,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
967
974
|
for (DelayCondition condition : delayConditionList) {
|
|
968
975
|
String kind = condition.getKind().toString();
|
|
969
976
|
String value = condition.getValue();
|
|
970
|
-
if (!
|
|
977
|
+
if (!kind.isEmpty()) {
|
|
971
978
|
switch (kind) {
|
|
972
979
|
case "background":
|
|
973
980
|
if (!killed) {
|
|
@@ -1020,7 +1027,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1020
1027
|
private Boolean _isAutoUpdateEnabled() {
|
|
1021
1028
|
final CapConfig config = CapConfig.loadDefault(this.getActivity());
|
|
1022
1029
|
String serverUrl = config.getServerUrl();
|
|
1023
|
-
if (serverUrl != null && !
|
|
1030
|
+
if (serverUrl != null && !serverUrl.isEmpty()) {
|
|
1024
1031
|
// log warning autoupdate disabled when serverUrl is set
|
|
1025
1032
|
Log.w(
|
|
1026
1033
|
CapacitorUpdater.TAG,
|
|
@@ -1030,7 +1037,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1030
1037
|
return (
|
|
1031
1038
|
CapacitorUpdaterPlugin.this.autoUpdate &&
|
|
1032
1039
|
!"".equals(CapacitorUpdaterPlugin.this.updateUrl) &&
|
|
1033
|
-
(serverUrl == null ||
|
|
1040
|
+
(serverUrl == null || serverUrl.isEmpty())
|
|
1034
1041
|
);
|
|
1035
1042
|
}
|
|
1036
1043
|
|
|
@@ -1077,7 +1084,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1077
1084
|
Boolean error
|
|
1078
1085
|
) {
|
|
1079
1086
|
if (error) {
|
|
1080
|
-
Log.i(
|
|
1087
|
+
Log.i(
|
|
1088
|
+
CapacitorUpdater.TAG,
|
|
1089
|
+
"endBackGroundTaskWithNotif error" + error.toString()
|
|
1090
|
+
);
|
|
1081
1091
|
this.implementation.sendStats("download_fail", current.getVersionName());
|
|
1082
1092
|
final JSObject ret = new JSObject();
|
|
1083
1093
|
ret.put("version", latestVersionName);
|
|
@@ -1149,7 +1159,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1149
1159
|
|
|
1150
1160
|
if (
|
|
1151
1161
|
latestVersionName != null &&
|
|
1152
|
-
!
|
|
1162
|
+
!latestVersionName.isEmpty() &&
|
|
1153
1163
|
!current.getVersionName().equals(latestVersionName)
|
|
1154
1164
|
) {
|
|
1155
1165
|
final BundleInfo latest =
|
|
@@ -1308,7 +1318,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1308
1318
|
delayUpdatePreferences,
|
|
1309
1319
|
type
|
|
1310
1320
|
);
|
|
1311
|
-
if (delayConditionList != null && delayConditionList.
|
|
1321
|
+
if (delayConditionList != null && !delayConditionList.isEmpty()) {
|
|
1312
1322
|
Log.i(CapacitorUpdater.TAG, "Update delayed to next backgrounding");
|
|
1313
1323
|
return;
|
|
1314
1324
|
}
|
|
@@ -1442,8 +1452,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1442
1452
|
}
|
|
1443
1453
|
|
|
1444
1454
|
public void appMovedToBackground() {
|
|
1455
|
+
final BundleInfo current =
|
|
1456
|
+
CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
1445
1457
|
CapacitorUpdaterPlugin.this.implementation.sendStats(
|
|
1446
|
-
"app_moved_to_background"
|
|
1458
|
+
"app_moved_to_background",
|
|
1459
|
+
current.getVersionName()
|
|
1447
1460
|
);
|
|
1448
1461
|
Log.i(CapacitorUpdater.TAG, "Checking for pending update");
|
|
1449
1462
|
try {
|
|
@@ -1504,10 +1517,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1504
1517
|
ActivityManager.RecentTaskInfo runningTask = runningTasks
|
|
1505
1518
|
.get(0)
|
|
1506
1519
|
.getTaskInfo();
|
|
1507
|
-
String className =
|
|
1520
|
+
String className = Objects
|
|
1521
|
+
.requireNonNull(runningTask.baseIntent.getComponent())
|
|
1522
|
+
.getClassName();
|
|
1523
|
+
assert runningTask.topActivity != null;
|
|
1508
1524
|
String runningActivity = runningTask.topActivity.getClassName();
|
|
1509
|
-
|
|
1510
|
-
return isThisAppActivity;
|
|
1525
|
+
return className.equals(runningActivity);
|
|
1511
1526
|
} catch (NullPointerException e) {
|
|
1512
1527
|
return false;
|
|
1513
1528
|
}
|
|
@@ -950,12 +950,6 @@ extension CustomError: LocalizedError {
|
|
|
950
950
|
UserDefaults.standard.synchronize()
|
|
951
951
|
}
|
|
952
952
|
|
|
953
|
-
public func setVersionName(id: String, version: String) {
|
|
954
|
-
print("\(self.TAG) Setting version for folder [\(id)] to \(version)")
|
|
955
|
-
let info = self.getBundleInfo(id: id)
|
|
956
|
-
self.saveBundleInfo(id: id, bundle: info.setVersionName(version: version))
|
|
957
|
-
}
|
|
958
|
-
|
|
959
953
|
private func setBundleStatus(id: String, status: BundleStatus) {
|
|
960
954
|
print("\(self.TAG) Setting status for bundle [\(id)] to \(status)")
|
|
961
955
|
let info = self.getBundleInfo(id: id)
|
|
@@ -15,7 +15,7 @@ import Version
|
|
|
15
15
|
@objc(CapacitorUpdaterPlugin)
|
|
16
16
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
17
17
|
public var implementation = CapacitorUpdater()
|
|
18
|
-
private let PLUGIN_VERSION: String = "5.7.
|
|
18
|
+
private let PLUGIN_VERSION: String = "5.7.9"
|
|
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"
|