@capawesome/capacitor-live-update 6.0.4 → 6.0.5-dev.c56b7a8.1715927657

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/README.md CHANGED
@@ -125,25 +125,76 @@ A working example can be found here: [robingenz/capacitor-plugin-demo](https://g
125
125
  ```typescript
126
126
  import { LiveUpdate } from '@capawesome/capacitor-live-update';
127
127
 
128
+ const deleteBundle = async () => {
129
+ await LiveUpdate.deleteBundle({ bundleId: 'my-bundle' });
130
+ };
131
+
128
132
  const downloadBundle = async () => {
129
- // Download a bundle from a URL
130
- await LiveUpdate.downloadBundle({
131
- url: 'https://example.com/1.0.0.zip',
132
- bundleId: '1.0.0',
133
- });
134
- // Set the downloaded bundle as the next bundle to use
135
- await LiveUpdate.setBundle({ bundleId: '1.0.0' });
136
- // Reload the app to apply the new bundle
137
- await LiveUpdate.reload();
133
+ await LiveUpdate.downloadBundle({ url: 'https://example.com/1.0.0.zip', bundleId: '1.0.0' });
134
+ };
135
+
136
+ const getBundle = async () => {
137
+ const result = await LiveUpdate.getBundle();
138
+ return result.bundleId;
139
+ };
140
+
141
+ const getBundles = async () => {
142
+ const result = await LiveUpdate.getBundles();
143
+ return result.bundleIds;
144
+ };
145
+
146
+ const getChannel = async () => {
147
+ const result = await LiveUpdate.getChannel();
148
+ return result.channel;
149
+ };
150
+
151
+ const getCustomId = async () => {
152
+ const result = await LiveUpdate.getCustomId();
153
+ return result.customId;
154
+ };
155
+
156
+ const getDeviceId = async () => {
157
+ const result = await LiveUpdate.getDeviceId();
158
+ return result.deviceId;
159
+ };
160
+
161
+ const getVersionCode = async () => {
162
+ const result = await LiveUpdate.getVersionCode();
163
+ return result.versionCode;
164
+ };
165
+
166
+ const getVersionName = async () => {
167
+ const result = await LiveUpdate.getVersionName();
168
+ return result.versionName;
169
+ };
170
+
171
+ const ready = async () => {
172
+ await LiveUpdate.ready();
173
+ };
174
+
175
+ const reload = async () => {
176
+ await LiveUpdate.reload();
177
+ };
178
+
179
+ const reset = async () => {
180
+ await LiveUpdate.reset();
181
+ };
182
+
183
+ const setBundle = async () => {
184
+ await LiveUpdate.setBundle({ bundleId: '1.0.0' });
185
+ };
186
+
187
+ const setChannel = async () => {
188
+ await LiveUpdate.setChannel({ channel: 'beta' });
189
+ };
190
+
191
+ const setCustomId = async () => {
192
+ await LiveUpdate.setCustomId({ customId: 'my-custom-id' });
138
193
  };
139
194
 
140
195
  const sync = async () => {
141
- // Automatically download and set the latest bundle for the app
142
- const result = await LiveUpdate.sync();
143
- if (result.nextBundleId) {
144
- // Reload the app to apply the new bundle
145
- await LiveUpdate.reload();
146
- }
196
+ const result = await LiveUpdate.sync();
197
+ return result.nextBundleId;
147
198
  };
148
199
  ```
149
200
 
@@ -185,6 +185,7 @@ public class LiveUpdate {
185
185
  }
186
186
 
187
187
  setNextBundle(bundleId);
188
+ callback.success();
188
189
  }
189
190
 
190
191
  public void setChannel(@NonNull SetChannelOptions options, @NonNull EmptyCallback callback) {
@@ -265,6 +266,9 @@ public class LiveUpdate {
265
266
  throw new Exception(LiveUpdatePlugin.ERROR_BUNDLE_INDEX_HTML_MISSING);
266
267
  }
267
268
 
269
+ // Create the bundles directory if it does not exist
270
+ createBundlesDirectory();
271
+
268
272
  // Move the bundle directory to the bundles directory
269
273
  File bundleDirectory = buildBundleDirectoryFor(bundleId);
270
274
  indexHtmlFile.getParentFile().renameTo(bundleDirectory);
@@ -288,6 +292,13 @@ public class LiveUpdate {
288
292
  return new File(plugin.getContext().getFilesDir(), bundlesDirectory + "/" + bundle);
289
293
  }
290
294
 
295
+ private void createBundlesDirectory() {
296
+ File bundlesDirectory = buildBundlesDirectory();
297
+ if (!bundlesDirectory.exists()) {
298
+ bundlesDirectory.mkdir();
299
+ }
300
+ }
301
+
291
302
  private void deleteBundle(@NonNull String bundleId) {
292
303
  File bundleDirectory = buildBundleDirectoryFor(bundleId);
293
304
  deleteFileRecursively(bundleDirectory);
@@ -19,7 +19,7 @@ import io.capawesome.capacitorjs.plugins.liveupdate.interfaces.Result;
19
19
  public class LiveUpdatePlugin extends Plugin {
20
20
 
21
21
  public static final String TAG = "LiveUpdate";
22
- public static final String VERSION = "6.0.4";
22
+ public static final String VERSION = "6.0.5";
23
23
  public static final String SHARED_PREFERENCES_NAME = "CapawesomeLiveUpdate"; // DO NOT CHANGE
24
24
  public static final String ERROR_APP_ID_MISSING = "appId must be configured.";
25
25
  public static final String ERROR_BUNDLE_EXISTS = "bundle already exists.";
@@ -8,7 +8,7 @@ import Capacitor
8
8
  @objc(LiveUpdatePlugin)
9
9
  public class LiveUpdatePlugin: CAPPlugin {
10
10
  public static let tag = "LiveUpdate"
11
- public static let version = "6.0.4"
11
+ public static let version = "6.0.5"
12
12
  public static let userDefaultsPrefix = "CapawesomeLiveUpdate" // DO NOT CHANGE
13
13
 
14
14
  private var config: LiveUpdateConfig?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-live-update",
3
- "version": "6.0.4",
3
+ "version": "6.0.5-dev.c56b7a8.1715927657",
4
4
  "description": "Capacitor plugin to update your app remotely in real-time.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -52,8 +52,9 @@
52
52
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
53
53
  "clean": "rimraf ./dist",
54
54
  "watch": "tsc --watch",
55
- "prepublishOnly": "npm run build",
56
- "release": "standard-version"
55
+ "version": "node scripts/sync-plugin-version.mjs",
56
+ "ios:pod:install": "cd ios && pod install --repo-update && cd ..",
57
+ "prepublishOnly": "npm run build"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@capacitor/android": "6.0.0",
@@ -69,7 +70,6 @@
69
70
  "prettier-plugin-java": "1.6.1",
70
71
  "rimraf": "3.0.2",
71
72
  "rollup": "2.77.2",
72
- "standard-version": "9.5.0",
73
73
  "swiftlint": "1.0.1",
74
74
  "typescript": "4.1.5"
75
75
  },