@capawesome/cordova-live-update 0.1.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/LICENSE +21 -0
- package/README.md +1113 -0
- package/dist/docs.json +1654 -0
- package/dist/esm/definitions.d.ts +788 -0
- package/dist/esm/definitions.js +7 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/exec.d.ts +1 -0
- package/dist/esm/exec.js +8 -0
- package/dist/esm/exec.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +46 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/plugin.js +56 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +93 -0
- package/plugin.xml +268 -0
- package/src/android/capawesome-cordova-live-update.gradle +12 -0
- package/src/android/capawesome-live-update.xml +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdate.java +1480 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdateConfig.java +105 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdateHttpClient.java +114 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePathHandler.java +96 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePlugin.java +550 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePreferences.java +151 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/Manifest.java +58 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/ManifestItem.java +37 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/api/GetChannelsResponseItem.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +74 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/events/DownloadBundleProgressEvent.java +33 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/events/NextBundleSetEvent.java +26 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/DeleteBundleOptions.java +18 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/DownloadBundleOptions.java +66 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/FetchChannelsOptions.java +39 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/FetchLatestBundleOptions.java +25 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetChannelOptions.java +18 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetConfigOptions.java +20 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetCustomIdOptions.java +18 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetNextBundleOptions.java +21 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SyncOptions.java +25 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/ChannelResult.java +29 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/FetchChannelsResult.java +29 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +69 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetBlockedBundlesResult.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetBundlesResult.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetChannelResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetConfigResult.java +40 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetCurrentBundleResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetCustomIdResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetDeviceIdResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetDownloadedBundlesResult.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetNextBundleResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetVersionCodeResult.java +21 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetVersionNameResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/IsSyncingResult.java +27 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/ReadyResult.java +32 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/SyncResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/enums/ArtifactType.java +6 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/Callback.java +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/DownloadProgressCallback.java +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/EmptyCallback.java +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/NonEmptyCallback.java +7 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/Result.java +8 -0
- package/src/ios/LiveUpdate.swift +895 -0
- package/src/ios/LiveUpdateArtifactType.swift +4 -0
- package/src/ios/LiveUpdateChannelResult.swift +18 -0
- package/src/ios/LiveUpdateConfig.swift +11 -0
- package/src/ios/LiveUpdateDeleteBundleOptions.swift +13 -0
- package/src/ios/LiveUpdateDownloadBundleOptions.swift +41 -0
- package/src/ios/LiveUpdateDownloadBundleProgressEvent.swift +24 -0
- package/src/ios/LiveUpdateError.swift +62 -0
- package/src/ios/LiveUpdateFetchChannelsOptions.swift +25 -0
- package/src/ios/LiveUpdateFetchChannelsResult.swift +15 -0
- package/src/ios/LiveUpdateFetchLatestBundleOptions.swift +17 -0
- package/src/ios/LiveUpdateFetchLatestBundleResult.swift +42 -0
- package/src/ios/LiveUpdateGetBlockedBundlesResult.swift +15 -0
- package/src/ios/LiveUpdateGetBundlesResult.swift +15 -0
- package/src/ios/LiveUpdateGetChannelResult.swift +15 -0
- package/src/ios/LiveUpdateGetChannelsResponseItem.swift +4 -0
- package/src/ios/LiveUpdateGetConfigResult.swift +18 -0
- package/src/ios/LiveUpdateGetCurrentBundleResult.swift +15 -0
- package/src/ios/LiveUpdateGetCustomIdResult.swift +15 -0
- package/src/ios/LiveUpdateGetDeviceIdResult.swift +15 -0
- package/src/ios/LiveUpdateGetDownloadedBundlesResult.swift +15 -0
- package/src/ios/LiveUpdateGetLatestBundleResponse.swift +8 -0
- package/src/ios/LiveUpdateGetNextBundleResult.swift +15 -0
- package/src/ios/LiveUpdateGetVersionCodeResult.swift +15 -0
- package/src/ios/LiveUpdateGetVersionNameResult.swift +15 -0
- package/src/ios/LiveUpdateHttpClient.swift +58 -0
- package/src/ios/LiveUpdateIsSyncingResult.swift +15 -0
- package/src/ios/LiveUpdateManifest.swift +19 -0
- package/src/ios/LiveUpdateManifestItem.swift +5 -0
- package/src/ios/LiveUpdateNextBundleSetEvent.swift +15 -0
- package/src/ios/LiveUpdatePlugin.swift +521 -0
- package/src/ios/LiveUpdatePreferences.swift +116 -0
- package/src/ios/LiveUpdateReadyResult.swift +21 -0
- package/src/ios/LiveUpdateResult.swift +5 -0
- package/src/ios/LiveUpdateSchemeHandler.swift +286 -0
- package/src/ios/LiveUpdateSetChannelOptions.swift +13 -0
- package/src/ios/LiveUpdateSetConfigOptions.swift +13 -0
- package/src/ios/LiveUpdateSetCustomIdOptions.swift +13 -0
- package/src/ios/LiveUpdateSetNextBundleOptions.swift +13 -0
- package/src/ios/LiveUpdateSyncOptions.swift +17 -0
- package/src/ios/LiveUpdateSyncResult.swift +15 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes;
|
|
2
|
+
|
|
3
|
+
import java.util.ArrayList;
|
|
4
|
+
import java.util.HashSet;
|
|
5
|
+
import java.util.List;
|
|
6
|
+
import java.util.Set;
|
|
7
|
+
import org.json.JSONArray;
|
|
8
|
+
import org.json.JSONException;
|
|
9
|
+
|
|
10
|
+
public class Manifest {
|
|
11
|
+
|
|
12
|
+
private List<ManifestItem> items = new ArrayList<>();
|
|
13
|
+
|
|
14
|
+
public Manifest(JSONArray jsonArray) throws JSONException {
|
|
15
|
+
for (int i = 0; i < jsonArray.length(); i++) {
|
|
16
|
+
ManifestItem manifestItem = new ManifestItem(jsonArray.getJSONObject(i));
|
|
17
|
+
items.add(manifestItem);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public List<ManifestItem> getItems() {
|
|
22
|
+
return items;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static List<ManifestItem> findDuplicateItems(Manifest manifest1, Manifest manifest2) {
|
|
26
|
+
List<ManifestItem> duplicateItems = new ArrayList<>();
|
|
27
|
+
Set<String> checksums = new HashSet<>();
|
|
28
|
+
|
|
29
|
+
for (ManifestItem item : manifest2.getItems()) {
|
|
30
|
+
checksums.add(item.getChecksum());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
for (ManifestItem item : manifest1.getItems()) {
|
|
34
|
+
if (checksums.contains(item.getChecksum())) {
|
|
35
|
+
duplicateItems.add(item);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return duplicateItems;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static List<ManifestItem> findMissingItems(Manifest manifest1, Manifest manifest2) {
|
|
43
|
+
List<ManifestItem> missingItems = new ArrayList<>();
|
|
44
|
+
Set<String> checksums = new HashSet<>();
|
|
45
|
+
|
|
46
|
+
for (ManifestItem item : manifest2.getItems()) {
|
|
47
|
+
checksums.add(item.getChecksum());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (ManifestItem item : manifest1.getItems()) {
|
|
51
|
+
if (!checksums.contains(item.getChecksum())) {
|
|
52
|
+
missingItems.add(item);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return missingItems;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import org.json.JSONObject;
|
|
5
|
+
|
|
6
|
+
public class ManifestItem {
|
|
7
|
+
|
|
8
|
+
@NonNull
|
|
9
|
+
private String checksum;
|
|
10
|
+
|
|
11
|
+
@NonNull
|
|
12
|
+
private String href;
|
|
13
|
+
|
|
14
|
+
@NonNull
|
|
15
|
+
private int sizeInBytes;
|
|
16
|
+
|
|
17
|
+
public ManifestItem(JSONObject json) {
|
|
18
|
+
this.href = json.optString("href");
|
|
19
|
+
this.checksum = json.optString("checksum");
|
|
20
|
+
this.sizeInBytes = json.optInt("sizeInBytes");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@NonNull
|
|
24
|
+
public String getHref() {
|
|
25
|
+
return href;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@NonNull
|
|
29
|
+
public String getChecksum() {
|
|
30
|
+
return checksum;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@NonNull
|
|
34
|
+
public int getSizeInBytes() {
|
|
35
|
+
return sizeInBytes;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.api;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import org.json.JSONObject;
|
|
5
|
+
|
|
6
|
+
public class GetChannelsResponseItem {
|
|
7
|
+
|
|
8
|
+
@NonNull
|
|
9
|
+
private final String id;
|
|
10
|
+
|
|
11
|
+
@NonNull
|
|
12
|
+
private final String name;
|
|
13
|
+
|
|
14
|
+
public GetChannelsResponseItem(@NonNull JSONObject responseJson) {
|
|
15
|
+
this.id = responseJson.optString("id");
|
|
16
|
+
this.name = responseJson.optString("name");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@NonNull
|
|
20
|
+
public String getId() {
|
|
21
|
+
return id;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@NonNull
|
|
25
|
+
public String getName() {
|
|
26
|
+
return name;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.api;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import io.capawesome.cordova.plugins.liveupdate.enums.ArtifactType;
|
|
6
|
+
import java.util.ArrayList;
|
|
7
|
+
import java.util.List;
|
|
8
|
+
import org.json.JSONArray;
|
|
9
|
+
import org.json.JSONObject;
|
|
10
|
+
|
|
11
|
+
public class GetLatestBundleResponse {
|
|
12
|
+
|
|
13
|
+
@NonNull
|
|
14
|
+
private ArtifactType artifactType;
|
|
15
|
+
|
|
16
|
+
@NonNull
|
|
17
|
+
private String bundleId;
|
|
18
|
+
|
|
19
|
+
@Nullable
|
|
20
|
+
private String checksum;
|
|
21
|
+
|
|
22
|
+
@Nullable
|
|
23
|
+
private JSONObject customProperties;
|
|
24
|
+
|
|
25
|
+
@Nullable
|
|
26
|
+
private String signature;
|
|
27
|
+
|
|
28
|
+
@NonNull
|
|
29
|
+
private String url;
|
|
30
|
+
|
|
31
|
+
public GetLatestBundleResponse(JSONObject responseJson) {
|
|
32
|
+
String artifactType = responseJson.optString("artifactType");
|
|
33
|
+
if (artifactType.equals("manifest")) {
|
|
34
|
+
this.artifactType = ArtifactType.MANIFEST;
|
|
35
|
+
} else {
|
|
36
|
+
this.artifactType = ArtifactType.ZIP;
|
|
37
|
+
}
|
|
38
|
+
this.bundleId = responseJson.optString("bundleId");
|
|
39
|
+
this.checksum = responseJson.isNull("checksum") ? null : responseJson.optString("checksum");
|
|
40
|
+
this.customProperties = responseJson.optJSONObject("customProperties");
|
|
41
|
+
this.signature = responseJson.isNull("signature") ? null : responseJson.optString("signature");
|
|
42
|
+
this.url = responseJson.optString("url");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@NonNull
|
|
46
|
+
public ArtifactType getArtifactType() {
|
|
47
|
+
return artifactType;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@NonNull
|
|
51
|
+
public String getBundleId() {
|
|
52
|
+
return bundleId;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Nullable
|
|
56
|
+
public JSONObject getCustomProperties() {
|
|
57
|
+
return customProperties;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@Nullable
|
|
61
|
+
public String getChecksum() {
|
|
62
|
+
return checksum;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Nullable
|
|
66
|
+
public String getSignature() {
|
|
67
|
+
return signature;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@NonNull
|
|
71
|
+
public String getUrl() {
|
|
72
|
+
return url;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.events;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class DownloadBundleProgressEvent implements Result {
|
|
9
|
+
|
|
10
|
+
@NonNull
|
|
11
|
+
private final String bundleId;
|
|
12
|
+
|
|
13
|
+
private final long downloadedBytes;
|
|
14
|
+
private final long totalBytes;
|
|
15
|
+
private final double progress;
|
|
16
|
+
|
|
17
|
+
public DownloadBundleProgressEvent(@NonNull String bundleId, long downloadedBytes, long totalBytes) {
|
|
18
|
+
this.bundleId = bundleId;
|
|
19
|
+
this.downloadedBytes = downloadedBytes;
|
|
20
|
+
this.totalBytes = totalBytes;
|
|
21
|
+
this.progress = (double) downloadedBytes / (double) totalBytes;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@NonNull
|
|
25
|
+
public JSONObject toJSObject() throws JSONException {
|
|
26
|
+
JSONObject result = new JSONObject();
|
|
27
|
+
result.put("bundleId", bundleId);
|
|
28
|
+
result.put("downloadedBytes", downloadedBytes);
|
|
29
|
+
result.put("progress", progress);
|
|
30
|
+
result.put("totalBytes", totalBytes);
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/events/NextBundleSetEvent.java
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.events;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import org.json.JSONException;
|
|
5
|
+
import org.json.JSONObject;
|
|
6
|
+
|
|
7
|
+
public class NextBundleSetEvent {
|
|
8
|
+
|
|
9
|
+
@Nullable
|
|
10
|
+
private final String bundleId;
|
|
11
|
+
|
|
12
|
+
public NextBundleSetEvent(@Nullable String bundleId) {
|
|
13
|
+
this.bundleId = bundleId;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Nullable
|
|
17
|
+
public String getBundleId() {
|
|
18
|
+
return bundleId;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public JSONObject toJSObject() throws JSONException {
|
|
22
|
+
JSONObject result = new JSONObject();
|
|
23
|
+
result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
public class DeleteBundleOptions {
|
|
6
|
+
|
|
7
|
+
@NonNull
|
|
8
|
+
private String bundleId;
|
|
9
|
+
|
|
10
|
+
public DeleteBundleOptions(@NonNull String bundleId) {
|
|
11
|
+
this.bundleId = bundleId;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@NonNull
|
|
15
|
+
public String getBundleId() {
|
|
16
|
+
return bundleId;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import io.capawesome.cordova.plugins.liveupdate.enums.ArtifactType;
|
|
6
|
+
|
|
7
|
+
public class DownloadBundleOptions {
|
|
8
|
+
|
|
9
|
+
@NonNull
|
|
10
|
+
private ArtifactType artifactType;
|
|
11
|
+
|
|
12
|
+
@NonNull
|
|
13
|
+
private String bundleId;
|
|
14
|
+
|
|
15
|
+
@Nullable
|
|
16
|
+
private String checksum;
|
|
17
|
+
|
|
18
|
+
@Nullable
|
|
19
|
+
private String signature;
|
|
20
|
+
|
|
21
|
+
@NonNull
|
|
22
|
+
private String url;
|
|
23
|
+
|
|
24
|
+
public DownloadBundleOptions(
|
|
25
|
+
@NonNull String artifactType,
|
|
26
|
+
@NonNull String bundleId,
|
|
27
|
+
@Nullable String checksum,
|
|
28
|
+
@Nullable String signature,
|
|
29
|
+
@NonNull String url
|
|
30
|
+
) {
|
|
31
|
+
if (artifactType.equals("manifest")) {
|
|
32
|
+
this.artifactType = ArtifactType.MANIFEST;
|
|
33
|
+
} else {
|
|
34
|
+
this.artifactType = ArtifactType.ZIP;
|
|
35
|
+
}
|
|
36
|
+
this.bundleId = bundleId;
|
|
37
|
+
this.checksum = checksum;
|
|
38
|
+
this.signature = signature;
|
|
39
|
+
this.url = url;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@NonNull
|
|
43
|
+
public ArtifactType getArtifactType() {
|
|
44
|
+
return artifactType;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@NonNull
|
|
48
|
+
public String getBundleId() {
|
|
49
|
+
return bundleId;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Nullable
|
|
53
|
+
public String getChecksum() {
|
|
54
|
+
return checksum;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Nullable
|
|
58
|
+
public String getSignature() {
|
|
59
|
+
return signature;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@NonNull
|
|
63
|
+
public String getUrl() {
|
|
64
|
+
return url;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class FetchChannelsOptions {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private final Integer limit;
|
|
12
|
+
|
|
13
|
+
@Nullable
|
|
14
|
+
private final Integer offset;
|
|
15
|
+
|
|
16
|
+
@Nullable
|
|
17
|
+
private final String query;
|
|
18
|
+
|
|
19
|
+
public FetchChannelsOptions(@NonNull JSONObject options) throws JSONException {
|
|
20
|
+
this.limit = options.has("limit") && !options.isNull("limit") ? options.getInt("limit") : null;
|
|
21
|
+
this.offset = options.has("offset") && !options.isNull("offset") ? options.getInt("offset") : null;
|
|
22
|
+
this.query = options.isNull("query") ? null : options.optString("query", null);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Nullable
|
|
26
|
+
public Integer getLimit() {
|
|
27
|
+
return limit;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Nullable
|
|
31
|
+
public Integer getOffset() {
|
|
32
|
+
return offset;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Nullable
|
|
36
|
+
public String getQuery() {
|
|
37
|
+
return query;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class FetchLatestBundleOptions {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private final String channel;
|
|
12
|
+
|
|
13
|
+
public FetchLatestBundleOptions(@NonNull JSONObject options) throws JSONException {
|
|
14
|
+
this.channel = options.optString("channel", null);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public FetchLatestBundleOptions(@Nullable String channel) {
|
|
18
|
+
this.channel = channel;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Nullable
|
|
22
|
+
public String getChannel() {
|
|
23
|
+
return channel;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetChannelOptions.java
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
public class SetChannelOptions {
|
|
6
|
+
|
|
7
|
+
@NonNull
|
|
8
|
+
private String channel;
|
|
9
|
+
|
|
10
|
+
public SetChannelOptions(@NonNull String channel) {
|
|
11
|
+
this.channel = channel;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@NonNull
|
|
15
|
+
public String getChannel() {
|
|
16
|
+
return channel;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetConfigOptions.java
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import org.json.JSONException;
|
|
5
|
+
import org.json.JSONObject;
|
|
6
|
+
|
|
7
|
+
public class SetConfigOptions {
|
|
8
|
+
|
|
9
|
+
@Nullable
|
|
10
|
+
private final String appId;
|
|
11
|
+
|
|
12
|
+
public SetConfigOptions(JSONObject options) throws JSONException {
|
|
13
|
+
this.appId = options.isNull("appId") ? null : options.optString("appId", null);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Nullable
|
|
17
|
+
public String getAppId() {
|
|
18
|
+
return appId;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetCustomIdOptions.java
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
public class SetCustomIdOptions {
|
|
6
|
+
|
|
7
|
+
@NonNull
|
|
8
|
+
private String customId;
|
|
9
|
+
|
|
10
|
+
public SetCustomIdOptions(@NonNull String customId) {
|
|
11
|
+
this.customId = customId;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@NonNull
|
|
15
|
+
public String getCustomId() {
|
|
16
|
+
return customId;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class SetNextBundleOptions {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private final String bundleId;
|
|
12
|
+
|
|
13
|
+
public SetNextBundleOptions(@NonNull JSONObject options) throws JSONException {
|
|
14
|
+
this.bundleId = options.isNull("bundleId") ? null : options.optString("bundleId", null);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@Nullable
|
|
18
|
+
public String getBundleId() {
|
|
19
|
+
return bundleId;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.options;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class SyncOptions {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private final String channel;
|
|
12
|
+
|
|
13
|
+
public SyncOptions(@NonNull JSONObject options) throws JSONException {
|
|
14
|
+
this.channel = options.optString("channel", null);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public SyncOptions(@Nullable String channel) {
|
|
18
|
+
this.channel = channel;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Nullable
|
|
22
|
+
public String getChannel() {
|
|
23
|
+
return channel;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/ChannelResult.java
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class ChannelResult implements Result {
|
|
9
|
+
|
|
10
|
+
@NonNull
|
|
11
|
+
private final String id;
|
|
12
|
+
|
|
13
|
+
@NonNull
|
|
14
|
+
private final String name;
|
|
15
|
+
|
|
16
|
+
public ChannelResult(@NonNull String id, @NonNull String name) {
|
|
17
|
+
this.id = id;
|
|
18
|
+
this.name = name;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@NonNull
|
|
22
|
+
@Override
|
|
23
|
+
public JSONObject toJSObject() throws JSONException {
|
|
24
|
+
JSONObject result = new JSONObject();
|
|
25
|
+
result.put("id", id);
|
|
26
|
+
result.put("name", name);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONArray;
|
|
6
|
+
import org.json.JSONException;
|
|
7
|
+
import org.json.JSONObject;
|
|
8
|
+
|
|
9
|
+
public class FetchChannelsResult implements Result {
|
|
10
|
+
|
|
11
|
+
@NonNull
|
|
12
|
+
private final ChannelResult[] channels;
|
|
13
|
+
|
|
14
|
+
public FetchChannelsResult(@NonNull ChannelResult[] channels) {
|
|
15
|
+
this.channels = channels;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@NonNull
|
|
19
|
+
@Override
|
|
20
|
+
public JSONObject toJSObject() throws JSONException {
|
|
21
|
+
JSONObject result = new JSONObject();
|
|
22
|
+
JSONArray channelsArray = new JSONArray();
|
|
23
|
+
for (ChannelResult channel : channels) {
|
|
24
|
+
channelsArray.put(channel.toJSObject());
|
|
25
|
+
}
|
|
26
|
+
result.put("channels", channelsArray);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import io.capawesome.cordova.plugins.liveupdate.enums.ArtifactType;
|
|
6
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
7
|
+
import org.json.JSONException;
|
|
8
|
+
import org.json.JSONObject;
|
|
9
|
+
|
|
10
|
+
public class FetchLatestBundleResult implements Result {
|
|
11
|
+
|
|
12
|
+
@Nullable
|
|
13
|
+
private final ArtifactType artifactType;
|
|
14
|
+
|
|
15
|
+
@Nullable
|
|
16
|
+
private final String bundleId;
|
|
17
|
+
|
|
18
|
+
@Nullable
|
|
19
|
+
private final String checksum;
|
|
20
|
+
|
|
21
|
+
@Nullable
|
|
22
|
+
private final JSONObject customProperties;
|
|
23
|
+
|
|
24
|
+
@Nullable
|
|
25
|
+
private final String downloadUrl;
|
|
26
|
+
|
|
27
|
+
@Nullable
|
|
28
|
+
private final String signature;
|
|
29
|
+
|
|
30
|
+
public FetchLatestBundleResult(
|
|
31
|
+
@Nullable ArtifactType artifactType,
|
|
32
|
+
@Nullable String bundleId,
|
|
33
|
+
@Nullable String checksum,
|
|
34
|
+
@Nullable JSONObject customProperties,
|
|
35
|
+
@Nullable String downloadUrl,
|
|
36
|
+
@Nullable String signature
|
|
37
|
+
) {
|
|
38
|
+
this.artifactType = artifactType;
|
|
39
|
+
this.bundleId = bundleId;
|
|
40
|
+
this.checksum = checksum;
|
|
41
|
+
this.customProperties = customProperties;
|
|
42
|
+
this.downloadUrl = downloadUrl;
|
|
43
|
+
this.signature = signature;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@NonNull
|
|
47
|
+
public JSONObject toJSObject() throws JSONException {
|
|
48
|
+
JSONObject result = new JSONObject();
|
|
49
|
+
if (artifactType == ArtifactType.MANIFEST) {
|
|
50
|
+
result.put("artifactType", "manifest");
|
|
51
|
+
} else if (artifactType == ArtifactType.ZIP) {
|
|
52
|
+
result.put("artifactType", "zip");
|
|
53
|
+
}
|
|
54
|
+
result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
|
|
55
|
+
if (checksum != null) {
|
|
56
|
+
result.put("checksum", checksum);
|
|
57
|
+
}
|
|
58
|
+
if (customProperties != null) {
|
|
59
|
+
result.put("customProperties", customProperties);
|
|
60
|
+
}
|
|
61
|
+
if (downloadUrl != null) {
|
|
62
|
+
result.put("downloadUrl", downloadUrl);
|
|
63
|
+
}
|
|
64
|
+
if (signature != null) {
|
|
65
|
+
result.put("signature", signature);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONArray;
|
|
6
|
+
import org.json.JSONException;
|
|
7
|
+
import org.json.JSONObject;
|
|
8
|
+
|
|
9
|
+
public class GetBlockedBundlesResult implements Result {
|
|
10
|
+
|
|
11
|
+
@NonNull
|
|
12
|
+
private String[] bundleIds;
|
|
13
|
+
|
|
14
|
+
public GetBlockedBundlesResult(@NonNull String[] bundleIds) {
|
|
15
|
+
this.bundleIds = bundleIds;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public JSONObject toJSObject() throws JSONException {
|
|
19
|
+
JSONArray bundleIdsResult = new JSONArray();
|
|
20
|
+
for (String bundleId : bundleIds) {
|
|
21
|
+
bundleIdsResult.put(bundleId);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
JSONObject result = new JSONObject();
|
|
25
|
+
result.put("bundleIds", bundleIdsResult);
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
}
|