Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions packages/live-update/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -992,21 +992,22 @@ Remove all listeners for this plugin.

#### FetchLatestBundleResult

| Prop | Type | Description | Since |
| ---------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | 6.7.0 |
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the latest bundle. On Capawesome Cloud, this is the ID of the app build artifact. If `null`, no bundle is available. | 6.6.0 |
| **`checksum`** | <code>string</code> | The checksum of the latest bundle if the bundle is self-hosted. If the bundle is hosted on Capawesome Cloud, the checksum will be returned as response header when downloading the bundle. | 7.1.0 |
| **`customProperties`** | <code>{ [key: string]: string; }</code> | Custom properties that are associated with the latest bundle. | 7.0.0 |
| **`downloadUrl`** | <code>string</code> | The URL of the latest bundle to download. Pass this URL to the `downloadBundle(...)` method to download the bundle. | 6.7.0 |
| **`signature`** | <code>string</code> | The signature of the latest bundle if the bundle is self-hosted. If the bundle is hosted on Capawesome Cloud, the signature will be returned as response header when downloading the bundle. | 7.1.0 |
| Prop | Type | Description | Since |
| ---------------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | 6.7.0 |
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the latest bundle. On Capawesome Cloud, this is the ID of the app build artifact. If `null`, no bundle is available. | 6.6.0 |
| **`channel`** | <code>string</code> | The name of the channel that the bundle is actually from. This is the resolved channel after applying any forced channel assignment and may differ from the channel set by the Live Update SDK. | 8.3.0 |
| **`checksum`** | <code>string</code> | The checksum of the latest bundle if the bundle is self-hosted. If the bundle is hosted on Capawesome Cloud, the checksum will be returned as response header when downloading the bundle. | 7.1.0 |
| **`customProperties`** | <code>{ [key: string]: string; }</code> | Custom properties that are associated with the latest bundle. | 7.0.0 |
| **`downloadUrl`** | <code>string</code> | The URL of the latest bundle to download. Pass this URL to the `downloadBundle(...)` method to download the bundle. | 6.7.0 |
| **`signature`** | <code>string</code> | The signature of the latest bundle if the bundle is self-hosted. If the bundle is hosted on Capawesome Cloud, the signature will be returned as response header when downloading the bundle. | 7.1.0 |


#### FetchLatestBundleOptions

| Prop | Type | Description | Since |
| ------------- | ------------------- | ---------------------------------------------------------------- | ----- |
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
| Prop | Type | Description | Since |
| ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
| **`channel`** | <code>string</code> | The preferred channel name from which the latest bundle should be fetched. This is the SDK preference and may be overridden by a forced channel assignment configured in the Capawesome Cloud Console. | 6.7.0 |


#### GetBlockedBundlesResult
Expand Down Expand Up @@ -1140,9 +1141,9 @@ Remove all listeners for this plugin.

#### SyncOptions

| Prop | Type | Description | Since |
| ------------- | ------------------- | ---------------------------------------------------------------- | ----- |
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
| Prop | Type | Description | Since |
| ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
| **`channel`** | <code>string</code> | The preferred channel name from which the latest bundle should be fetched. This is the SDK preference and may be overridden by a forced channel assignment configured in the Capawesome Cloud Console. | 6.7.0 |


#### PluginListenerHandle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,15 @@ public void fetchLatestBundle(@NonNull FetchLatestBundleOptions options, @NonNul
public void success(@Nullable GetLatestBundleResponse response) {
ArtifactType artifactType = response == null ? null : response.getArtifactType();
String bundleId = response == null ? null : response.getBundleId();
String channel = response == null ? null : response.getChannelName();
String checksum = response == null ? null : response.getChecksum();
JSONObject customProperties = response == null ? null : response.getCustomProperties();
String downloadUrl = response == null ? null : response.getUrl();
String signature = response == null ? null : response.getSignature();
FetchLatestBundleResult result = new FetchLatestBundleResult(
artifactType,
bundleId,
channel,
checksum,
customProperties,
downloadUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class GetLatestBundleResponse {
@NonNull
private String bundleId;

@Nullable
private String channelName;

@Nullable
private String checksum;

Expand All @@ -36,6 +39,7 @@ public GetLatestBundleResponse(JSONObject responseJson) {
this.artifactType = ArtifactType.ZIP;
}
this.bundleId = responseJson.optString("bundleId");
this.channelName = responseJson.isNull("channelName") ? null : responseJson.optString("channelName");
this.checksum = responseJson.isNull("checksum") ? null : responseJson.optString("checksum");
this.customProperties = responseJson.optJSONObject("customProperties");
this.signature = responseJson.isNull("signature") ? null : responseJson.optString("signature");
Expand All @@ -52,6 +56,11 @@ public String getBundleId() {
return bundleId;
}

@Nullable
public String getChannelName() {
return channelName;
}

@Nullable
public JSONObject getCustomProperties() {
return customProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class FetchLatestBundleResult implements Result {
@Nullable
private final String bundleId;

@Nullable
private final String channel;

@Nullable
private final String checksum;

Expand All @@ -30,13 +33,15 @@ public class FetchLatestBundleResult implements Result {
public FetchLatestBundleResult(
@Nullable ArtifactType artifactType,
@Nullable String bundleId,
@Nullable String channel,
@Nullable String checksum,
@Nullable JSONObject customProperties,
@Nullable String downloadUrl,
@Nullable String signature
) {
this.artifactType = artifactType;
this.bundleId = bundleId;
this.channel = channel;
this.checksum = checksum;
this.customProperties = customProperties;
this.downloadUrl = downloadUrl;
Expand All @@ -52,6 +57,9 @@ public JSObject toJSObject() {
result.put("artifactType", "zip");
}
result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
if (channel != null) {
result.put("channel", channel);
}
if (checksum != null) {
result.put("checksum", checksum);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import Capacitor
@objc public class FetchLatestBundleResult: NSObject, Result {
private let artifactType: ArtifactType?
private let bundleId: String?
private let channel: String?
private let checksum: String?
private let customProperties: [String: Any]?
private let downloadUrl: String?
private let signature: String?

init(artifactType: ArtifactType?, bundleId: String?, checksum: String?, customProperties: [String: Any]?, downloadUrl: String?, signature: String?) {
init(artifactType: ArtifactType?, bundleId: String?, channel: String?, checksum: String?, customProperties: [String: Any]?, downloadUrl: String?, signature: String?) {
self.artifactType = artifactType
self.bundleId = bundleId
self.channel = channel
self.checksum = checksum
self.customProperties = customProperties
self.downloadUrl = downloadUrl
Expand All @@ -26,6 +28,9 @@ import Capacitor
result["artifactType"] = "zip"
}
result["bundleId"] = bundleId == nil ? NSNull() : bundleId
if let channel = channel {
result["channel"] = channel
}
if let checksum = checksum {
result["checksum"] = checksum
}
Expand Down
2 changes: 1 addition & 1 deletion packages/live-update/ios/Plugin/LiveUpdate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ import CommonCrypto

@objc public func fetchLatestBundle(_ options: FetchLatestBundleOptions) async throws -> FetchLatestBundleResult {
let response: GetLatestBundleResponse? = try await self.fetchLatestBundle(options)
return FetchLatestBundleResult(artifactType: response?.artifactType, bundleId: response?.bundleId, checksum: response?.checksum, customProperties: response?.customProperties, downloadUrl: response?.url, signature: response?.signature)
return FetchLatestBundleResult(artifactType: response?.artifactType, bundleId: response?.bundleId, channel: response?.channelName, checksum: response?.checksum, customProperties: response?.customProperties, downloadUrl: response?.url, signature: response?.signature)
}

@objc public func getBlockedBundles(completion: @escaping (Result?, Error?) -> Void) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
public struct GetLatestBundleResponse: Codable {
var artifactType: ArtifactType
var bundleId: String
var channelName: String?
var checksum: String?
var customProperties: [String: String]?
var signature: String?
Expand Down
19 changes: 17 additions & 2 deletions packages/live-update/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,10 @@ export interface Channel {
*/
export interface FetchLatestBundleOptions {
/**
* The name of the channel where the latest bundle is fetched from.
* The preferred channel name from which the latest bundle should be fetched.
*
* This is the SDK preference and may be overridden by a forced channel assignment
* configured in the Capawesome Cloud Console.
*
* @since 6.7.0
*/
Expand All @@ -585,6 +588,15 @@ export interface FetchLatestBundleResult {
* @since 6.6.0
*/
bundleId: string | null;
/**
* The name of the channel that the bundle is actually from.
*
* This is the resolved channel after applying any forced channel assignment
* and may differ from the channel set by the Live Update SDK.
*
* @since 8.3.0
*/
channel?: string;
/**
* The checksum of the latest bundle if the bundle is self-hosted.
*
Expand Down Expand Up @@ -915,7 +927,10 @@ export interface SetNextBundleOptions {
*/
export interface SyncOptions {
/**
* The name of the channel where the latest bundle is fetched from.
* The preferred channel name from which the latest bundle should be fetched.
*
* This is the SDK preference and may be overridden by a forced channel assignment
* configured in the Capawesome Cloud Console.
*
* @since 6.7.0
*/
Expand Down
Loading