@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
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetBundlesResult.java
ADDED
|
@@ -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 GetBundlesResult implements Result {
|
|
10
|
+
|
|
11
|
+
@NonNull
|
|
12
|
+
private String[] bundleIds;
|
|
13
|
+
|
|
14
|
+
public GetBundlesResult(@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
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetChannelResult.java
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class GetChannelResult implements Result {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private String channel;
|
|
12
|
+
|
|
13
|
+
public GetChannelResult(@Nullable String channel) {
|
|
14
|
+
this.channel = channel;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSONObject toJSObject() throws JSONException {
|
|
18
|
+
JSONObject result = new JSONObject();
|
|
19
|
+
result.put("channel", channel == null ? JSONObject.NULL : channel);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetConfigResult.java
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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.interfaces.Result;
|
|
6
|
+
import org.json.JSONException;
|
|
7
|
+
import org.json.JSONObject;
|
|
8
|
+
|
|
9
|
+
public class GetConfigResult implements Result {
|
|
10
|
+
|
|
11
|
+
@Nullable
|
|
12
|
+
private final String appId;
|
|
13
|
+
|
|
14
|
+
@NonNull
|
|
15
|
+
private final String autoUpdateStrategy;
|
|
16
|
+
|
|
17
|
+
public GetConfigResult(@Nullable String appId, @NonNull String autoUpdateStrategy) {
|
|
18
|
+
this.appId = appId;
|
|
19
|
+
this.autoUpdateStrategy = autoUpdateStrategy;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Nullable
|
|
23
|
+
public String getAppId() {
|
|
24
|
+
return appId;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@NonNull
|
|
28
|
+
public String getAutoUpdateStrategy() {
|
|
29
|
+
return autoUpdateStrategy;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Override
|
|
33
|
+
@NonNull
|
|
34
|
+
public JSONObject toJSObject() throws JSONException {
|
|
35
|
+
JSONObject result = new JSONObject();
|
|
36
|
+
result.put("appId", appId == null ? JSONObject.NULL : appId);
|
|
37
|
+
result.put("autoUpdateStrategy", autoUpdateStrategy);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class GetCurrentBundleResult implements Result {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private String bundleId;
|
|
12
|
+
|
|
13
|
+
public GetCurrentBundleResult(@Nullable String bundleId) {
|
|
14
|
+
this.bundleId = bundleId;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSONObject toJSObject() throws JSONException {
|
|
18
|
+
JSONObject result = new JSONObject();
|
|
19
|
+
result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetCustomIdResult.java
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class GetCustomIdResult implements Result {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private String customId;
|
|
12
|
+
|
|
13
|
+
public GetCustomIdResult(@Nullable String customId) {
|
|
14
|
+
this.customId = customId;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSONObject toJSObject() throws JSONException {
|
|
18
|
+
JSONObject result = new JSONObject();
|
|
19
|
+
result.put("customId", customId == null ? JSONObject.NULL : customId);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetDeviceIdResult.java
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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 GetDeviceIdResult implements Result {
|
|
9
|
+
|
|
10
|
+
@NonNull
|
|
11
|
+
private String deviceId;
|
|
12
|
+
|
|
13
|
+
public GetDeviceIdResult(@NonNull String deviceId) {
|
|
14
|
+
this.deviceId = deviceId;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSONObject toJSObject() throws JSONException {
|
|
18
|
+
JSONObject result = new JSONObject();
|
|
19
|
+
result.put("deviceId", deviceId == null ? JSONObject.NULL : deviceId);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -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 GetDownloadedBundlesResult implements Result {
|
|
10
|
+
|
|
11
|
+
@NonNull
|
|
12
|
+
private String[] bundleIds;
|
|
13
|
+
|
|
14
|
+
public GetDownloadedBundlesResult(@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
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class GetNextBundleResult implements Result {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private String bundleId;
|
|
12
|
+
|
|
13
|
+
public GetNextBundleResult(@Nullable String bundleId) {
|
|
14
|
+
this.bundleId = bundleId;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSONObject toJSObject() throws JSONException {
|
|
18
|
+
JSONObject result = new JSONObject();
|
|
19
|
+
result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class GetVersionCodeResult implements Result {
|
|
9
|
+
|
|
10
|
+
private String versionCode;
|
|
11
|
+
|
|
12
|
+
public GetVersionCodeResult(String versionCode) {
|
|
13
|
+
this.versionCode = versionCode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public JSONObject toJSObject() throws JSONException {
|
|
17
|
+
JSONObject result = new JSONObject();
|
|
18
|
+
result.put("versionCode", versionCode);
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 GetVersionNameResult implements Result {
|
|
9
|
+
|
|
10
|
+
@NonNull
|
|
11
|
+
private String versionName;
|
|
12
|
+
|
|
13
|
+
public GetVersionNameResult(@NonNull String versionName) {
|
|
14
|
+
this.versionName = versionName;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSONObject toJSObject() throws JSONException {
|
|
18
|
+
JSONObject result = new JSONObject();
|
|
19
|
+
result.put("versionName", versionName);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/IsSyncingResult.java
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 IsSyncingResult implements Result {
|
|
9
|
+
|
|
10
|
+
private final boolean syncing;
|
|
11
|
+
|
|
12
|
+
public IsSyncingResult(boolean syncing) {
|
|
13
|
+
this.syncing = syncing;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public boolean getSyncing() {
|
|
17
|
+
return syncing;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Override
|
|
21
|
+
@NonNull
|
|
22
|
+
public JSONObject toJSObject() throws JSONException {
|
|
23
|
+
JSONObject result = new JSONObject();
|
|
24
|
+
result.put("syncing", syncing);
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.LiveUpdate;
|
|
5
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
6
|
+
import org.json.JSONException;
|
|
7
|
+
import org.json.JSONObject;
|
|
8
|
+
|
|
9
|
+
public class ReadyResult implements Result {
|
|
10
|
+
|
|
11
|
+
@Nullable
|
|
12
|
+
private String currentBundleId;
|
|
13
|
+
|
|
14
|
+
@Nullable
|
|
15
|
+
private String previousBundleId;
|
|
16
|
+
|
|
17
|
+
private boolean rollback;
|
|
18
|
+
|
|
19
|
+
public ReadyResult(@Nullable String currentBundleId, @Nullable String previousBundleId, boolean rollback) {
|
|
20
|
+
this.currentBundleId = currentBundleId;
|
|
21
|
+
this.previousBundleId = previousBundleId;
|
|
22
|
+
this.rollback = rollback;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public JSONObject toJSObject() throws JSONException {
|
|
26
|
+
JSONObject result = new JSONObject();
|
|
27
|
+
result.put("currentBundleId", currentBundleId == null ? JSONObject.NULL : currentBundleId);
|
|
28
|
+
result.put("previousBundleId", previousBundleId == null ? JSONObject.NULL : previousBundleId);
|
|
29
|
+
result.put("rollback", rollback);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package io.capawesome.cordova.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import io.capawesome.cordova.plugins.liveupdate.interfaces.Result;
|
|
5
|
+
import org.json.JSONException;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class SyncResult implements Result {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private final String nextBundleId;
|
|
12
|
+
|
|
13
|
+
public SyncResult(@Nullable String nextBundleId) {
|
|
14
|
+
this.nextBundleId = nextBundleId;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSONObject toJSObject() throws JSONException {
|
|
18
|
+
JSONObject result = new JSONObject();
|
|
19
|
+
result.put("nextBundleId", nextBundleId == null ? JSONObject.NULL : nextBundleId);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|