@capawesome/capacitor-live-update 7.1.0 → 7.1.1
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/CapawesomeCapacitorLiveUpdate.podspec +1 -1
- package/README.md +30 -7
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '14.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'Alamofire', '~> 5.9
|
|
16
|
+
s.dependency 'Alamofire', '~> 5.9'
|
|
17
17
|
s.dependency 'SSZipArchive', '~> 2.2.3'
|
|
18
18
|
s.swift_version = '5.1'
|
|
19
19
|
s.static_framework = true
|
package/README.md
CHANGED
|
@@ -191,7 +191,16 @@ const getVersionName = async () => {
|
|
|
191
191
|
};
|
|
192
192
|
|
|
193
193
|
const ready = async () => {
|
|
194
|
-
await LiveUpdate.ready();
|
|
194
|
+
const result = await LiveUpdate.ready();
|
|
195
|
+
if (result.currentBundleId) {
|
|
196
|
+
console.log(`The app is now using the bundle with the identifier ${result.currentBundleId}.`);
|
|
197
|
+
}
|
|
198
|
+
if (result.previousBundleId) {
|
|
199
|
+
console.log(`The app was using the bundle with the identifier ${result.previousBundleId}.`);
|
|
200
|
+
}
|
|
201
|
+
if (result.rollback) {
|
|
202
|
+
console.log('The app was reset to the default bundle.');
|
|
203
|
+
}
|
|
195
204
|
};
|
|
196
205
|
|
|
197
206
|
const reload = async () => {
|
|
@@ -203,7 +212,7 @@ const reset = async () => {
|
|
|
203
212
|
};
|
|
204
213
|
|
|
205
214
|
const setChannel = async () => {
|
|
206
|
-
await LiveUpdate.setChannel({ channel: '
|
|
215
|
+
await LiveUpdate.setChannel({ channel: 'production-5' });
|
|
207
216
|
};
|
|
208
217
|
|
|
209
218
|
const setCustomId = async () => {
|
|
@@ -211,16 +220,20 @@ const setCustomId = async () => {
|
|
|
211
220
|
};
|
|
212
221
|
|
|
213
222
|
const setNextBundle = async () => {
|
|
214
|
-
await LiveUpdate.setNextBundle({ bundleId: '
|
|
223
|
+
await LiveUpdate.setNextBundle({ bundleId: '7f0b9bf2-dff6-4be2-bcac-b068cc5ea756' });
|
|
215
224
|
};
|
|
216
225
|
|
|
217
226
|
const sync = async () => {
|
|
218
|
-
const result = await LiveUpdate.sync(
|
|
227
|
+
const result = await LiveUpdate.sync({
|
|
228
|
+
channel: 'production-5',
|
|
229
|
+
});
|
|
219
230
|
return result.nextBundleId;
|
|
220
231
|
};
|
|
221
232
|
|
|
222
233
|
const isNewBundleAvailable = async () => {
|
|
223
|
-
const { bundleId: latestBundleId } = await LiveUpdate.fetchLatestBundle(
|
|
234
|
+
const { bundleId: latestBundleId } = await LiveUpdate.fetchLatestBundle({
|
|
235
|
+
channel: 'production-5',
|
|
236
|
+
});
|
|
224
237
|
if (latestBundleId) {
|
|
225
238
|
const { bundleId: currentBundleId } = await LiveUpdate.getCurrentBundle();
|
|
226
239
|
return latestBundleId !== currentBundleId;
|
|
@@ -793,7 +806,7 @@ Listener for the download progress of a bundle.
|
|
|
793
806
|
|
|
794
807
|
## Testing
|
|
795
808
|
|
|
796
|
-
When testing the plugin, you must make sure that you do not use the [Live Reload](https://ionicframework.com/docs/cli/livereload) option, as in this case a development server is used to load the bundle.
|
|
809
|
+
When testing the plugin, you must make sure that you do not use the [Live Reload](https://ionicframework.com/docs/cli/livereload) option, as in this case a development server is used to load the bundle and not the local file system.
|
|
797
810
|
|
|
798
811
|
Therefore, simply start your app without the live reload option, for example with the following command:
|
|
799
812
|
|
|
@@ -801,7 +814,17 @@ Therefore, simply start your app without the live reload option, for example wit
|
|
|
801
814
|
npx ionic cap run android --open
|
|
802
815
|
```
|
|
803
816
|
|
|
804
|
-
If you want to
|
|
817
|
+
If you want to **not** receive live updates to test other parts of your app, you can simply set a non-existent channel, for example:
|
|
818
|
+
|
|
819
|
+
```typescript
|
|
820
|
+
import { LiveUpdate } from '@capawesome/capacitor-live-update';
|
|
821
|
+
|
|
822
|
+
const sync = async () => {
|
|
823
|
+
await LiveUpdate.sync({ channel: 'non-existent-channel' });
|
|
824
|
+
};
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
This way, the app will check for updates, but no updates will be found.
|
|
805
828
|
|
|
806
829
|
## Limitations
|
|
807
830
|
|