@simplysm/capacitor-plugin-auto-update 13.0.98 → 13.0.100
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 +44 -74
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @simplysm/capacitor-plugin-auto-update
|
|
2
2
|
|
|
3
|
-
Capacitor Auto Update Plugin
|
|
3
|
+
Simplysm Package - Capacitor Auto Update Plugin. Provides APK installation and OTA auto-update functionality for Android Capacitor apps.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,115 +10,85 @@ npm install @simplysm/capacitor-plugin-auto-update
|
|
|
10
10
|
|
|
11
11
|
## API Overview
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### APK Installer
|
|
14
14
|
|
|
15
15
|
| API | Type | Description |
|
|
16
16
|
|-----|------|-------------|
|
|
17
|
-
| `
|
|
17
|
+
| `ApkInstaller` | class | APK installation plugin (static methods) |
|
|
18
|
+
| `ApkInstallerPlugin` | interface | Low-level Capacitor plugin interface for APK installation |
|
|
19
|
+
| `VersionInfo` | interface | App version information |
|
|
18
20
|
|
|
19
|
-
###
|
|
21
|
+
### Auto Update
|
|
20
22
|
|
|
21
23
|
| API | Type | Description |
|
|
22
24
|
|-----|------|-------------|
|
|
23
|
-
| `
|
|
25
|
+
| `AutoUpdate` | class | OTA auto-update manager (static methods) |
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
---
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|-----|------|-------------|
|
|
29
|
-
| `ApkInstaller` | abstract class | APK installation and permission management |
|
|
30
|
-
| `AutoUpdate` | abstract class | OTA update flow (server-based or external storage) |
|
|
29
|
+
### `VersionInfo`
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
| Field | Type | Description |
|
|
32
|
+
|-------|------|-------------|
|
|
33
|
+
| `versionName` | `string` | App version name (e.g., `"1.0.0"`) |
|
|
34
|
+
| `versionCode` | `string` | App version code |
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
interface VersionInfo {
|
|
36
|
-
versionName: string;
|
|
37
|
-
versionCode: string;
|
|
38
|
-
}
|
|
39
|
-
```
|
|
36
|
+
### `ApkInstallerPlugin`
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
| Method | Signature | Description |
|
|
39
|
+
|--------|-----------|-------------|
|
|
40
|
+
| `install` | `(options: { uri: string }) => Promise<void>` | Install APK from URI |
|
|
41
|
+
| `checkPermissions` | `() => Promise<{ granted: boolean; manifest: boolean }>` | Check install permissions |
|
|
42
|
+
| `requestPermissions` | `() => Promise<void>` | Request install permissions |
|
|
43
|
+
| `getVersionInfo` | `() => Promise<VersionInfo>` | Get app version info |
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
interface ApkInstallerPlugin {
|
|
45
|
-
install(options: { uri: string }): Promise<void>;
|
|
46
|
-
checkPermissions(): Promise<{ granted: boolean; manifest: boolean }>;
|
|
47
|
-
requestPermissions(): Promise<void>;
|
|
48
|
-
getVersionInfo(): Promise<VersionInfo>;
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Low-level Capacitor plugin interface. Use `ApkInstaller` static methods instead of calling this directly.
|
|
53
|
-
|
|
54
|
-
## `ApkInstaller`
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
abstract class ApkInstaller {
|
|
58
|
-
static async checkPermissions(): Promise<{ granted: boolean; manifest: boolean }>;
|
|
59
|
-
static async requestPermissions(): Promise<void>;
|
|
60
|
-
static async install(apkUri: string): Promise<void>;
|
|
61
|
-
static async getVersionInfo(): Promise<VersionInfo>;
|
|
62
|
-
}
|
|
63
|
-
```
|
|
45
|
+
### `ApkInstaller`
|
|
64
46
|
|
|
65
|
-
APK
|
|
66
|
-
- Android: Executes APK install intent, manages `REQUEST_INSTALL_PACKAGES` permission.
|
|
67
|
-
- Browser: Shows alert message and returns normally.
|
|
47
|
+
Abstract class with static methods. Android executes APK install intent; browser shows alert and returns normally.
|
|
68
48
|
|
|
69
|
-
|
|
49
|
+
| Method | Signature | Description |
|
|
50
|
+
|--------|-----------|-------------|
|
|
51
|
+
| `checkPermissions` | `() => Promise<{ granted: boolean; manifest: boolean }>` | Check install permission (granted + manifest declared) |
|
|
52
|
+
| `requestPermissions` | `() => Promise<void>` | Request REQUEST_INSTALL_PACKAGES permission (navigates to settings) |
|
|
53
|
+
| `install` | `(apkUri: string) => Promise<void>` | Install APK from a `content://` URI (FileProvider URI) |
|
|
54
|
+
| `getVersionInfo` | `() => Promise<VersionInfo>` | Get app version info |
|
|
70
55
|
|
|
71
|
-
|
|
72
|
-
abstract class AutoUpdate {
|
|
73
|
-
static async run(opt: {
|
|
74
|
-
log: (messageHtml: string) => void;
|
|
75
|
-
serviceClient: ServiceClient;
|
|
76
|
-
}): Promise<void>;
|
|
77
|
-
|
|
78
|
-
static async runByExternalStorage(opt: {
|
|
79
|
-
log: (messageHtml: string) => void;
|
|
80
|
-
dirPath: string;
|
|
81
|
-
}): Promise<void>;
|
|
82
|
-
}
|
|
83
|
-
```
|
|
56
|
+
### `AutoUpdate`
|
|
84
57
|
|
|
85
|
-
|
|
86
|
-
- `runByExternalStorage` -- Finds the latest APK file in an external storage directory and installs it.
|
|
58
|
+
Abstract class with static methods for OTA update management.
|
|
87
59
|
|
|
88
|
-
|
|
60
|
+
| Method | Signature | Description |
|
|
61
|
+
|--------|-----------|-------------|
|
|
62
|
+
| `run` | `(opt: { log: (messageHtml: string) => void; serviceClient: ServiceClient }) => Promise<void>` | Run auto-update via server (checks version, downloads APK, installs) |
|
|
63
|
+
| `runByExternalStorage` | `(opt: { log: (messageHtml: string) => void; dirPath: string }) => Promise<void>` | Run auto-update from external storage directory |
|
|
89
64
|
|
|
90
65
|
## Usage Examples
|
|
91
66
|
|
|
92
|
-
### Check
|
|
67
|
+
### Check and install APK
|
|
93
68
|
|
|
94
69
|
```typescript
|
|
95
70
|
import { ApkInstaller } from "@simplysm/capacitor-plugin-auto-update";
|
|
96
71
|
|
|
72
|
+
// Check permissions
|
|
97
73
|
const perms = await ApkInstaller.checkPermissions();
|
|
98
74
|
if (!perms.granted) {
|
|
99
75
|
await ApkInstaller.requestPermissions();
|
|
100
76
|
}
|
|
101
|
-
await ApkInstaller.install("content://com.example.provider/latest.apk");
|
|
102
|
-
```
|
|
103
77
|
|
|
104
|
-
|
|
78
|
+
// Install APK
|
|
79
|
+
await ApkInstaller.install("content://com.example.fileprovider/apk/update.apk");
|
|
105
80
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
await AutoUpdate.run({
|
|
110
|
-
log: (html) => { document.getElementById("status")!.innerHTML = html; },
|
|
111
|
-
serviceClient: myServiceClient,
|
|
112
|
-
});
|
|
81
|
+
// Get version info
|
|
82
|
+
const version = await ApkInstaller.getVersionInfo();
|
|
113
83
|
```
|
|
114
84
|
|
|
115
|
-
###
|
|
85
|
+
### Run OTA auto-update
|
|
116
86
|
|
|
117
87
|
```typescript
|
|
118
88
|
import { AutoUpdate } from "@simplysm/capacitor-plugin-auto-update";
|
|
119
89
|
|
|
120
|
-
await AutoUpdate.
|
|
121
|
-
log: (
|
|
122
|
-
|
|
90
|
+
await AutoUpdate.run({
|
|
91
|
+
log: (messageHtml) => { /* display status */ },
|
|
92
|
+
serviceClient: myServiceClient,
|
|
123
93
|
});
|
|
124
94
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/capacitor-plugin-auto-update",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.100",
|
|
4
4
|
"description": "Simplysm Package - Capacitor Auto Update Plugin",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"semver": "^7.7.4",
|
|
22
|
-
"@simplysm/capacitor-plugin-file-system": "13.0.
|
|
23
|
-
"@simplysm/
|
|
24
|
-
"@simplysm/
|
|
25
|
-
"@simplysm/core-common": "13.0.
|
|
26
|
-
"@simplysm/service-common": "13.0.
|
|
22
|
+
"@simplysm/capacitor-plugin-file-system": "13.0.100",
|
|
23
|
+
"@simplysm/service-client": "13.0.100",
|
|
24
|
+
"@simplysm/core-browser": "13.0.100",
|
|
25
|
+
"@simplysm/core-common": "13.0.100",
|
|
26
|
+
"@simplysm/service-common": "13.0.100"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@capacitor/core": "^7.6.0",
|