@simplysm/capacitor-plugin-auto-update 14.0.22 → 14.0.24
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/package.json +6 -6
- package/README.md +0 -165
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/capacitor-plugin-auto-update",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.24",
|
|
4
4
|
"description": "심플리즘 패키지 - Capacitor 자동 업데이트 플러그인",
|
|
5
5
|
"author": "심플리즘",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"semver": "^7.7.4",
|
|
22
|
-
"@simplysm/
|
|
23
|
-
"@simplysm/
|
|
24
|
-
"@simplysm/
|
|
25
|
-
"@simplysm/
|
|
26
|
-
"@simplysm/
|
|
22
|
+
"@simplysm/service-client": "14.0.24",
|
|
23
|
+
"@simplysm/capacitor-plugin-file-system": "14.0.24",
|
|
24
|
+
"@simplysm/core-browser": "14.0.24",
|
|
25
|
+
"@simplysm/core-common": "14.0.24",
|
|
26
|
+
"@simplysm/service-common": "14.0.24"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@capacitor/core": "^7.6.1",
|
package/README.md
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# @simplysm/capacitor-plugin-auto-update
|
|
2
|
-
|
|
3
|
-
Capacitor plugin for automatic APK updates on Android. Provides APK installation with permission management and automatic update flows via a remote server or external storage.
|
|
4
|
-
|
|
5
|
-
- **Android**: Launches APK install intents, manages `REQUEST_INSTALL_PACKAGES` permission
|
|
6
|
-
- **Browser**: Displays notification messages and returns normally (for development)
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm install @simplysm/capacitor-plugin-auto-update
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## API Overview
|
|
15
|
-
|
|
16
|
-
### Interfaces
|
|
17
|
-
|
|
18
|
-
| API | Type | Description |
|
|
19
|
-
|-----|------|-------------|
|
|
20
|
-
| `VersionInfo` | Interface | App version information |
|
|
21
|
-
| `ApkInstallerPlugin` | Interface | Native plugin interface for APK installation |
|
|
22
|
-
|
|
23
|
-
### Classes
|
|
24
|
-
|
|
25
|
-
| API | Type | Description |
|
|
26
|
-
|-----|------|-------------|
|
|
27
|
-
| `ApkInstaller` | Class | Static API for APK installation, permission management, and version info |
|
|
28
|
-
| `AutoUpdate` | Class | Static API for downloading and installing APK updates from a server or external storage |
|
|
29
|
-
|
|
30
|
-
## `VersionInfo`
|
|
31
|
-
|
|
32
|
-
Holds application version information.
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
interface VersionInfo {
|
|
36
|
-
versionName: string;
|
|
37
|
-
versionCode: string;
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
| Field | Type | Description |
|
|
42
|
-
|-------|------|-------------|
|
|
43
|
-
| `versionName` | `string` | Human-readable version name (e.g. `"1.2.3"`) |
|
|
44
|
-
| `versionCode` | `string` | Numeric version code used by the Android system |
|
|
45
|
-
|
|
46
|
-
## `ApkInstallerPlugin`
|
|
47
|
-
|
|
48
|
-
Native plugin interface for APK installation. Use the `ApkInstaller` class for a simplified API.
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
interface ApkInstallerPlugin {
|
|
52
|
-
install(options: { uri: string }): Promise<void>;
|
|
53
|
-
checkPermissions(): Promise<{ granted: boolean; manifest: boolean }>;
|
|
54
|
-
requestPermissions(): Promise<void>;
|
|
55
|
-
getVersionInfo(): Promise<VersionInfo>;
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
| Method | Signature | Description |
|
|
60
|
-
|--------|-----------|-------------|
|
|
61
|
-
| `install` | `(options: { uri: string }) => Promise<void>` | Install APK from the given `content://` URI |
|
|
62
|
-
| `checkPermissions` | `() => Promise<{ granted: boolean; manifest: boolean }>` | Check whether install permissions are granted and declared in manifest |
|
|
63
|
-
| `requestPermissions` | `() => Promise<void>` | Request the `REQUEST_INSTALL_PACKAGES` permission |
|
|
64
|
-
| `getVersionInfo` | `() => Promise<VersionInfo>` | Retrieve current app version info |
|
|
65
|
-
|
|
66
|
-
## `ApkInstaller`
|
|
67
|
-
|
|
68
|
-
Abstract class with static methods for APK installation and permission management. On Android it runs the APK install intent and manages the `REQUEST_INSTALL_PACKAGES` permission. On the browser it shows a notification and returns normally.
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
abstract class ApkInstaller {
|
|
72
|
-
static async checkPermissions(): Promise<{ granted: boolean; manifest: boolean }>;
|
|
73
|
-
static async requestPermissions(): Promise<void>;
|
|
74
|
-
static async install(apkUri: string): Promise<void>;
|
|
75
|
-
static async getVersionInfo(): Promise<VersionInfo>;
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
| Method | Signature | Description |
|
|
80
|
-
|--------|-----------|-------------|
|
|
81
|
-
| `checkPermissions` | `static async checkPermissions(): Promise<{ granted: boolean; manifest: boolean }>` | Check whether install permission is granted and declared in manifest |
|
|
82
|
-
| `requestPermissions` | `static async requestPermissions(): Promise<void>` | Request `REQUEST_INSTALL_PACKAGES` permission (navigates to settings screen) |
|
|
83
|
-
| `install` | `static async install(apkUri: string): Promise<void>` | Install an APK from a `content://` URI (FileProvider URI) |
|
|
84
|
-
| `getVersionInfo` | `static async getVersionInfo(): Promise<VersionInfo>` | Get the current app version name and version code |
|
|
85
|
-
|
|
86
|
-
## `AutoUpdate`
|
|
87
|
-
|
|
88
|
-
Abstract class with static methods for orchestrating the full automatic update flow. Handles permission checks, version comparison, APK download, and installation.
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
abstract class AutoUpdate {
|
|
92
|
-
static async run(opt: {
|
|
93
|
-
log: (messageHtml: string) => void;
|
|
94
|
-
serviceClient: ServiceClient;
|
|
95
|
-
}): Promise<void>;
|
|
96
|
-
|
|
97
|
-
static async runByExternalStorage(opt: {
|
|
98
|
-
log: (messageHtml: string) => void;
|
|
99
|
-
dirPath: string;
|
|
100
|
-
}): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
| Method | Signature | Description |
|
|
105
|
-
|--------|-----------|-------------|
|
|
106
|
-
| `run` | `static async run(opt: { log: (messageHtml: string) => void; serviceClient: ServiceClient }): Promise<void>` | Download the latest APK from a remote server via `ServiceClient` and install it. Progress is reported through the `log` callback as HTML strings. |
|
|
107
|
-
| `runByExternalStorage` | `static async runByExternalStorage(opt: { log: (messageHtml: string) => void; dirPath: string }): Promise<void>` | Find the latest versioned APK file from an external storage directory and install it. Scans `dirPath` for files named `{semver}.apk`. |
|
|
108
|
-
|
|
109
|
-
### Parameters for `run`
|
|
110
|
-
|
|
111
|
-
| Field | Type | Description |
|
|
112
|
-
|-------|------|-------------|
|
|
113
|
-
| `log` | `(messageHtml: string) => void` | Callback to display progress/status HTML messages |
|
|
114
|
-
| `serviceClient` | `ServiceClient` | `@simplysm/service-client` instance for server communication |
|
|
115
|
-
|
|
116
|
-
### Parameters for `runByExternalStorage`
|
|
117
|
-
|
|
118
|
-
| Field | Type | Description |
|
|
119
|
-
|-------|------|-------------|
|
|
120
|
-
| `log` | `(messageHtml: string) => void` | Callback to display progress/status HTML messages |
|
|
121
|
-
| `dirPath` | `string` | Relative path within external storage containing versioned APK files |
|
|
122
|
-
|
|
123
|
-
## Usage Examples
|
|
124
|
-
|
|
125
|
-
### Check permissions and install an APK
|
|
126
|
-
|
|
127
|
-
```typescript
|
|
128
|
-
import { ApkInstaller } from "@simplysm/capacitor-plugin-auto-update";
|
|
129
|
-
|
|
130
|
-
const perms = await ApkInstaller.checkPermissions();
|
|
131
|
-
if (!perms.manifest) {
|
|
132
|
-
throw new Error("REQUEST_INSTALL_PACKAGES not declared in AndroidManifest.xml");
|
|
133
|
-
}
|
|
134
|
-
if (!perms.granted) {
|
|
135
|
-
await ApkInstaller.requestPermissions();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
await ApkInstaller.install("content://com.example.provider/apk/update.apk");
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Auto-update from a remote server
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
import { AutoUpdate } from "@simplysm/capacitor-plugin-auto-update";
|
|
145
|
-
|
|
146
|
-
await AutoUpdate.run({
|
|
147
|
-
log: (messageHtml) => {
|
|
148
|
-
document.getElementById("status")!.innerHTML = messageHtml;
|
|
149
|
-
},
|
|
150
|
-
serviceClient: myServiceClient,
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Auto-update from external storage
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
import { AutoUpdate } from "@simplysm/capacitor-plugin-auto-update";
|
|
158
|
-
|
|
159
|
-
await AutoUpdate.runByExternalStorage({
|
|
160
|
-
log: (messageHtml) => {
|
|
161
|
-
document.getElementById("status")!.innerHTML = messageHtml;
|
|
162
|
-
},
|
|
163
|
-
dirPath: "MyApp/updates",
|
|
164
|
-
});
|
|
165
|
-
```
|