@capawesome/capacitor-live-update 5.0.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/CapawesomeCapacitorLiveUpdate.podspec +20 -0
- package/LICENSE +21 -0
- package/README.md +509 -0
- package/android/build.gradle +62 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +613 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateConfig.java +55 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +437 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePreferences.java +86 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/DeleteBundleOptions.java +18 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/DownloadBundleOptions.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetBundleOptions.java +18 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetChannelOptions.java +18 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetCustomIdOptions.java +18 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBundleResult.java +24 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBundlesResult.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetChannelResult.java +21 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetCustomIdResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetDeviceIdResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetVersionCodeResult.java +21 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetVersionNameResult.java +21 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/SyncResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/interfaces/EmptyCallback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/interfaces/NonEmptyCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +785 -0
- package/dist/esm/definitions.d.ts +356 -0
- package/dist/esm/definitions.js +3 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +21 -0
- package/dist/esm/web.js +55 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +71 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +74 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Classes/CustomError.swift +38 -0
- package/ios/Plugin/Classes/Options/DeleteBundleOptions.swift +14 -0
- package/ios/Plugin/Classes/Options/DownloadBundleOptions.swift +20 -0
- package/ios/Plugin/Classes/Options/SetBundleOptions.swift +14 -0
- package/ios/Plugin/Classes/Options/SetChannelOptions.swift +14 -0
- package/ios/Plugin/Classes/Options/SetCustomIdOptions.swift +14 -0
- package/ios/Plugin/Classes/Results/GetBundleResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetBundlesResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetChannelResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetCustomIdResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetDeviceIdResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetVersionCodeResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetVersionNameResult.swift +16 -0
- package/ios/Plugin/Classes/Results/SyncResult.swift +16 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/LiveUpdate.swift +512 -0
- package/ios/Plugin/LiveUpdateConfig.swift +7 -0
- package/ios/Plugin/LiveUpdatePlugin.h +10 -0
- package/ios/Plugin/LiveUpdatePlugin.m +23 -0
- package/ios/Plugin/LiveUpdatePlugin.swift +247 -0
- package/ios/Plugin/LiveUpdatePreferences.swift +60 -0
- package/ios/Plugin/Protocols/Api/GetLatestBundleResponse.swift +4 -0
- package/ios/Plugin/Protocols/Result.swift +6 -0
- package/package.json +92 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapawesomeCapacitorLiveUpdate'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '13.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.dependency 'Alamofire', '~> 5.9.0'
|
|
17
|
+
s.dependency 'SSZipArchive', '~> 2.2'
|
|
18
|
+
s.swift_version = '5.1'
|
|
19
|
+
s.static_framework = true
|
|
20
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Robin Genz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
# @capawesome/capacitor-live-update
|
|
2
|
+
|
|
3
|
+
Capacitor plugin to update your app remotely in realtime.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @capawesome/capacitor-live-update
|
|
9
|
+
npx cap sync
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
<docgen-config>
|
|
15
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Description | Default | Since |
|
|
18
|
+
| ----------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
|
|
19
|
+
| **`appId`** | <code>string</code> | The app ID is used to identify the app when using [Capawesome Cloud](https://capawesome.io/cloud). | | 5.0.0 |
|
|
20
|
+
| **`autoDeleteBundles`** | <code>boolean</code> | Whether or not to automatically delete unused bundles. When enabled, the plugin will automatically delete unused bundles after calling `ready()`. | <code>false</code> | 5.0.0 |
|
|
21
|
+
| **`enabled`** | <code>boolean</code> | Whether or not the plugin is enabled. | <code>true</code> | 5.0.0 |
|
|
22
|
+
| **`readyTimeout`** | <code>number</code> | The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle. | <code>10000</code> | 5.0.0 |
|
|
23
|
+
| **`resetOnUpdate`** | <code>boolean</code> | Whether or not the app should be reset to the default bundle during an update. | <code>true</code> | 5.0.0 |
|
|
24
|
+
|
|
25
|
+
### Examples
|
|
26
|
+
|
|
27
|
+
In `capacitor.config.json`:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"plugins": {
|
|
32
|
+
"LiveUpdate": {
|
|
33
|
+
"appId": '4100e356-e851-47fe-9d3c-b411eb325a99',
|
|
34
|
+
"autoDeleteBundles": undefined,
|
|
35
|
+
"enabled": undefined,
|
|
36
|
+
"readyTimeout": undefined,
|
|
37
|
+
"resetOnUpdate": undefined
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
In `capacitor.config.ts`:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
/// <reference types="@capacitor/live-update" />
|
|
47
|
+
|
|
48
|
+
import { CapacitorConfig } from '@capacitor/cli';
|
|
49
|
+
|
|
50
|
+
const config: CapacitorConfig = {
|
|
51
|
+
plugins: {
|
|
52
|
+
LiveUpdate: {
|
|
53
|
+
appId: '4100e356-e851-47fe-9d3c-b411eb325a99',
|
|
54
|
+
autoDeleteBundles: undefined,
|
|
55
|
+
enabled: undefined,
|
|
56
|
+
readyTimeout: undefined,
|
|
57
|
+
resetOnUpdate: undefined,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default config;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
</docgen-config>
|
|
66
|
+
|
|
67
|
+
## Demo
|
|
68
|
+
|
|
69
|
+
A working example can be found here: [robingenz/capacitor-plugin-demo](https://github.com/robingenz/capacitor-plugin-demo)
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { LiveUpdate } from '@capawesome/capacitor-live-update';
|
|
75
|
+
|
|
76
|
+
const downloadBundle = async () => {
|
|
77
|
+
// Download a bundle from a URL
|
|
78
|
+
await LiveUpdate.downloadBundle({
|
|
79
|
+
url: 'https://example.com/1.0.0.zip',
|
|
80
|
+
bundleId: '1.0.0',
|
|
81
|
+
});
|
|
82
|
+
// Set the downloaded bundle as the next bundle to use
|
|
83
|
+
await LiveUpdate.setBundle({ bundleId: '1.0.0' });
|
|
84
|
+
// Reload the app to apply the new bundle
|
|
85
|
+
await LiveUpdate.reload();
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const sync = async () => {
|
|
89
|
+
// Automatically download and set the latest bundle for the app
|
|
90
|
+
const result = await LiveUpdate.sync();
|
|
91
|
+
if (result.nextBundleId) {
|
|
92
|
+
// Reload the app to apply the new bundle
|
|
93
|
+
await LiveUpdate.reload();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## API
|
|
99
|
+
|
|
100
|
+
<docgen-index>
|
|
101
|
+
|
|
102
|
+
* [`deleteBundle(...)`](#deletebundle)
|
|
103
|
+
* [`downloadBundle(...)`](#downloadbundle)
|
|
104
|
+
* [`getBundle()`](#getbundle)
|
|
105
|
+
* [`getBundles()`](#getbundles)
|
|
106
|
+
* [`getChannel()`](#getchannel)
|
|
107
|
+
* [`getCustomId()`](#getcustomid)
|
|
108
|
+
* [`getDeviceId()`](#getdeviceid)
|
|
109
|
+
* [`getVersionCode()`](#getversioncode)
|
|
110
|
+
* [`getVersionName()`](#getversionname)
|
|
111
|
+
* [`ready()`](#ready)
|
|
112
|
+
* [`reload()`](#reload)
|
|
113
|
+
* [`reset()`](#reset)
|
|
114
|
+
* [`setBundle(...)`](#setbundle)
|
|
115
|
+
* [`setChannel(...)`](#setchannel)
|
|
116
|
+
* [`setCustomId(...)`](#setcustomid)
|
|
117
|
+
* [`sync()`](#sync)
|
|
118
|
+
* [Interfaces](#interfaces)
|
|
119
|
+
|
|
120
|
+
</docgen-index>
|
|
121
|
+
|
|
122
|
+
<docgen-api>
|
|
123
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
124
|
+
|
|
125
|
+
### deleteBundle(...)
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
deleteBundle(options: DeleteBundleOptions) => Promise<void>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Delete a bundle from the app.
|
|
132
|
+
|
|
133
|
+
Only available on Android and iOS.
|
|
134
|
+
|
|
135
|
+
| Param | Type |
|
|
136
|
+
| ------------- | ------------------------------------------------------------------- |
|
|
137
|
+
| **`options`** | <code><a href="#deletebundleoptions">DeleteBundleOptions</a></code> |
|
|
138
|
+
|
|
139
|
+
**Since:** 5.0.0
|
|
140
|
+
|
|
141
|
+
--------------------
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### downloadBundle(...)
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
downloadBundle(options: DownloadBundleOptions) => Promise<void>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Download a bundle.
|
|
151
|
+
|
|
152
|
+
Only available on Android and iOS.
|
|
153
|
+
|
|
154
|
+
| Param | Type |
|
|
155
|
+
| ------------- | ----------------------------------------------------------------------- |
|
|
156
|
+
| **`options`** | <code><a href="#downloadbundleoptions">DownloadBundleOptions</a></code> |
|
|
157
|
+
|
|
158
|
+
**Since:** 5.0.0
|
|
159
|
+
|
|
160
|
+
--------------------
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
### getBundle()
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
getBundle() => Promise<GetBundleResult>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Get the active bundle identifier.
|
|
170
|
+
|
|
171
|
+
Only available on Android and iOS.
|
|
172
|
+
|
|
173
|
+
**Returns:** <code>Promise<<a href="#getbundleresult">GetBundleResult</a>></code>
|
|
174
|
+
|
|
175
|
+
**Since:** 5.0.0
|
|
176
|
+
|
|
177
|
+
--------------------
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### getBundles()
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
getBundles() => Promise<GetBundlesResult>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Get all available bundle identifiers.
|
|
187
|
+
|
|
188
|
+
Only available on Android and iOS.
|
|
189
|
+
|
|
190
|
+
**Returns:** <code>Promise<<a href="#getbundlesresult">GetBundlesResult</a>></code>
|
|
191
|
+
|
|
192
|
+
**Since:** 5.0.0
|
|
193
|
+
|
|
194
|
+
--------------------
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
### getChannel()
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
getChannel() => Promise<GetChannelResult>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Get the channel of the app.
|
|
204
|
+
|
|
205
|
+
Only available on Android and iOS.
|
|
206
|
+
|
|
207
|
+
**Returns:** <code>Promise<<a href="#getchannelresult">GetChannelResult</a>></code>
|
|
208
|
+
|
|
209
|
+
**Since:** 5.0.0
|
|
210
|
+
|
|
211
|
+
--------------------
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### getCustomId()
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
getCustomId() => Promise<GetCustomIdResult>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Get the custom identifier of the app.
|
|
221
|
+
|
|
222
|
+
Only available on Android and iOS.
|
|
223
|
+
|
|
224
|
+
**Returns:** <code>Promise<<a href="#getcustomidresult">GetCustomIdResult</a>></code>
|
|
225
|
+
|
|
226
|
+
**Since:** 5.0.0
|
|
227
|
+
|
|
228
|
+
--------------------
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
### getDeviceId()
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
getDeviceId() => Promise<GetDeviceIdResult>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Get the device identifier of the app.
|
|
238
|
+
|
|
239
|
+
Only available on Android and iOS.
|
|
240
|
+
|
|
241
|
+
**Returns:** <code>Promise<<a href="#getdeviceidresult">GetDeviceIdResult</a>></code>
|
|
242
|
+
|
|
243
|
+
**Since:** 5.0.0
|
|
244
|
+
|
|
245
|
+
--------------------
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
### getVersionCode()
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
getVersionCode() => Promise<GetVersionCodeResult>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Get the version code of the app.
|
|
255
|
+
|
|
256
|
+
Only available on Android and iOS.
|
|
257
|
+
|
|
258
|
+
**Returns:** <code>Promise<<a href="#getversioncoderesult">GetVersionCodeResult</a>></code>
|
|
259
|
+
|
|
260
|
+
**Since:** 5.0.0
|
|
261
|
+
|
|
262
|
+
--------------------
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
### getVersionName()
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
getVersionName() => Promise<GetVersionNameResult>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Get the version name of the app.
|
|
272
|
+
|
|
273
|
+
Only available on Android and iOS.
|
|
274
|
+
|
|
275
|
+
**Returns:** <code>Promise<<a href="#getversionnameresult">GetVersionNameResult</a>></code>
|
|
276
|
+
|
|
277
|
+
**Since:** 5.0.0
|
|
278
|
+
|
|
279
|
+
--------------------
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
### ready()
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
ready() => Promise<void>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Notify the plugin that the app is ready to use and no rollback is needed.
|
|
289
|
+
|
|
290
|
+
Only available on Android and iOS.
|
|
291
|
+
|
|
292
|
+
**Since:** 5.0.0
|
|
293
|
+
|
|
294
|
+
--------------------
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
### reload()
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
reload() => Promise<void>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Reload the app to apply the new bundle.
|
|
304
|
+
|
|
305
|
+
Only available on Android and iOS.
|
|
306
|
+
|
|
307
|
+
**Since:** 5.0.0
|
|
308
|
+
|
|
309
|
+
--------------------
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
### reset()
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
reset() => Promise<void>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Reset the app to the default bundle.
|
|
319
|
+
|
|
320
|
+
Call `reload()` or restart the app to apply the changes.
|
|
321
|
+
|
|
322
|
+
Only available on Android and iOS.
|
|
323
|
+
|
|
324
|
+
**Since:** 5.0.0
|
|
325
|
+
|
|
326
|
+
--------------------
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
### setBundle(...)
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
setBundle(options: SetBundleOptions) => Promise<void>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Set the next bundle to use for the app.
|
|
336
|
+
|
|
337
|
+
Call `reload()` or restart the app to apply the changes.
|
|
338
|
+
|
|
339
|
+
Only available on Android and iOS.
|
|
340
|
+
|
|
341
|
+
| Param | Type |
|
|
342
|
+
| ------------- | ------------------------------------------------------------- |
|
|
343
|
+
| **`options`** | <code><a href="#setbundleoptions">SetBundleOptions</a></code> |
|
|
344
|
+
|
|
345
|
+
**Since:** 5.0.0
|
|
346
|
+
|
|
347
|
+
--------------------
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
### setChannel(...)
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
setChannel(options: SetChannelOptions) => Promise<void>
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Set the channel of the app.
|
|
357
|
+
|
|
358
|
+
Only available on Android and iOS.
|
|
359
|
+
|
|
360
|
+
| Param | Type |
|
|
361
|
+
| ------------- | --------------------------------------------------------------- |
|
|
362
|
+
| **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> |
|
|
363
|
+
|
|
364
|
+
**Since:** 5.0.0
|
|
365
|
+
|
|
366
|
+
--------------------
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
### setCustomId(...)
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
setCustomId(options: SetCustomIdOptions) => Promise<void>
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Set the custom identifier of the app.
|
|
376
|
+
|
|
377
|
+
Only available on Android and iOS.
|
|
378
|
+
|
|
379
|
+
| Param | Type |
|
|
380
|
+
| ------------- | ----------------------------------------------------------------- |
|
|
381
|
+
| **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> |
|
|
382
|
+
|
|
383
|
+
**Since:** 5.0.0
|
|
384
|
+
|
|
385
|
+
--------------------
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
### sync()
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
sync() => Promise<SyncResult>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).
|
|
395
|
+
|
|
396
|
+
Call `reload()` or restart the app to apply the changes.
|
|
397
|
+
|
|
398
|
+
Only available on Android and iOS.
|
|
399
|
+
|
|
400
|
+
**Returns:** <code>Promise<<a href="#syncresult">SyncResult</a>></code>
|
|
401
|
+
|
|
402
|
+
**Since:** 5.0.0
|
|
403
|
+
|
|
404
|
+
--------------------
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
### Interfaces
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
#### DeleteBundleOptions
|
|
411
|
+
|
|
412
|
+
| Prop | Type | Description | Since |
|
|
413
|
+
| -------------- | ------------------- | ---------------------------------------------- | ----- |
|
|
414
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle to delete. | 5.0.0 |
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
#### DownloadBundleOptions
|
|
418
|
+
|
|
419
|
+
| Prop | Type | Description | Since |
|
|
420
|
+
| -------------- | ------------------- | --------------------------------------------------------------------------------------------------------- | ----- |
|
|
421
|
+
| **`url`** | <code>string</code> | The URL of the bundle to download. The bundle must be a ZIP file containing at least a `index.html` file. | 5.0.0 |
|
|
422
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle. | 5.0.0 |
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
#### GetBundleResult
|
|
426
|
+
|
|
427
|
+
| Prop | Type | Description | Since |
|
|
428
|
+
| -------------- | --------------------------- | ---------------------------------------------------------------------------------------- | ----- |
|
|
429
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the active bundle. If `null`, the default bundle is being used. | 5.0.0 |
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
#### GetBundlesResult
|
|
433
|
+
|
|
434
|
+
| Prop | Type | Description | Since |
|
|
435
|
+
| --------------- | --------------------- | -------------------------------------------------------- | ----- |
|
|
436
|
+
| **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all available bundles. | 5.0.0 |
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
#### GetChannelResult
|
|
440
|
+
|
|
441
|
+
| Prop | Type | Description | Since |
|
|
442
|
+
| ------------- | --------------------------- | ------------------------------------------------------------------------ | ----- |
|
|
443
|
+
| **`channel`** | <code>string \| null</code> | The channel of the app. If `null`, the app is using the default channel. | 5.0.0 |
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
#### GetCustomIdResult
|
|
447
|
+
|
|
448
|
+
| Prop | Type | Description | Since |
|
|
449
|
+
| -------------- | --------------------------- | ------------------------------------------------------------------------- | ----- |
|
|
450
|
+
| **`customId`** | <code>string \| null</code> | The custom identifier of the app. If `null`, no custom identifier is set. | 5.0.0 |
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
#### GetDeviceIdResult
|
|
454
|
+
|
|
455
|
+
| Prop | Type | Description | Since |
|
|
456
|
+
| -------------- | ------------------- | ------------------------------------ | ----- |
|
|
457
|
+
| **`deviceId`** | <code>string</code> | The unique identifier of the device. | 5.0.0 |
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
#### GetVersionCodeResult
|
|
461
|
+
|
|
462
|
+
| Prop | Type | Description | Since |
|
|
463
|
+
| ----------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
464
|
+
| **`versionCode`** | <code>string</code> | The version code of the app. On **Android**, this is the `versionCode` from the `android/app/build.gradle` file. On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file. | 5.0.0 |
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
#### GetVersionNameResult
|
|
468
|
+
|
|
469
|
+
| Prop | Type | Description | Since |
|
|
470
|
+
| ----------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
471
|
+
| **`versionName`** | <code>string</code> | The version name of the app. On **Android**, this is the `versionName` from the `android/app/build.gradle` file. On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file. | 5.0.0 |
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
#### SetBundleOptions
|
|
475
|
+
|
|
476
|
+
| Prop | Type | Description | Since |
|
|
477
|
+
| -------------- | ------------------- | ------------------------------------------- | ----- |
|
|
478
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle to use. | 5.0.0 |
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
#### SetChannelOptions
|
|
482
|
+
|
|
483
|
+
| Prop | Type | Description | Since |
|
|
484
|
+
| ------------- | --------------------------- | --------------------------------------------------------- | ----- |
|
|
485
|
+
| **`channel`** | <code>string \| null</code> | The channel of the app. Set `null` to remove the channel. | 5.0.0 |
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
#### SetCustomIdOptions
|
|
489
|
+
|
|
490
|
+
| Prop | Type | Description | Since |
|
|
491
|
+
| -------------- | --------------------------- | ----------------------------------------------------------------------------- | ----- |
|
|
492
|
+
| **`customId`** | <code>string \| null</code> | The custom identifier of the app. Set `null` to remove the custom identifier. | 5.0.0 |
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
#### SyncResult
|
|
496
|
+
|
|
497
|
+
| Prop | Type | Description | Since |
|
|
498
|
+
| ------------------ | --------------------------- | ---------------------------------------------------------------------------------------------------------- | ----- |
|
|
499
|
+
| **`nextBundleId`** | <code>string \| null</code> | The identifier of the next bundle to use. If `null`, the app is up-to-date and no new bundle is available. | 5.0.0 |
|
|
500
|
+
|
|
501
|
+
</docgen-api>
|
|
502
|
+
|
|
503
|
+
## Changelog
|
|
504
|
+
|
|
505
|
+
See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/live-update/CHANGELOG.md).
|
|
506
|
+
|
|
507
|
+
## License
|
|
508
|
+
|
|
509
|
+
See [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/live-update/LICENSE).
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
6
|
+
okhttp3Version = project.hasProperty('okhttp3Version') ? rootProject.ext.okhttp3Version : '4.12.0'
|
|
7
|
+
zip4jVersion = project.hasProperty('zip4jVersion') ? rootProject.ext.zip4jVersion : '2.11.5'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
buildscript {
|
|
11
|
+
repositories {
|
|
12
|
+
google()
|
|
13
|
+
mavenCentral()
|
|
14
|
+
}
|
|
15
|
+
dependencies {
|
|
16
|
+
classpath 'com.android.tools.build:gradle:8.0.0'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
apply plugin: 'com.android.library'
|
|
21
|
+
|
|
22
|
+
android {
|
|
23
|
+
namespace "io.capawesome.capacitorjs.plugins.liveupdate"
|
|
24
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
25
|
+
defaultConfig {
|
|
26
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
27
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
28
|
+
versionCode 1
|
|
29
|
+
versionName "1.0"
|
|
30
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
31
|
+
}
|
|
32
|
+
buildTypes {
|
|
33
|
+
release {
|
|
34
|
+
minifyEnabled false
|
|
35
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
lintOptions {
|
|
39
|
+
abortOnError false
|
|
40
|
+
}
|
|
41
|
+
compileOptions {
|
|
42
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
43
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
repositories {
|
|
48
|
+
google()
|
|
49
|
+
mavenCentral()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
dependencies {
|
|
54
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
55
|
+
implementation project(':capacitor-android')
|
|
56
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
57
|
+
implementation "net.lingala.zip4j:zip4j:$zip4jVersion"
|
|
58
|
+
implementation "com.squareup.okhttp3:okhttp:$okhttp3Version"
|
|
59
|
+
testImplementation "junit:junit:$junitVersion"
|
|
60
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
61
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
62
|
+
}
|