@simplysm/capacitor-plugin-auto-update 13.0.97 → 13.0.99

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.
Files changed (2) hide show
  1. package/README.md +94 -0
  2. package/package.json +6 -6
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # @simplysm/capacitor-plugin-auto-update
2
+
3
+ Simplysm Package - Capacitor Auto Update Plugin. Provides APK installation and OTA auto-update functionality for Android Capacitor apps.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @simplysm/capacitor-plugin-auto-update
9
+ ```
10
+
11
+ ## API Overview
12
+
13
+ ### APK Installer
14
+
15
+ | API | Type | Description |
16
+ |-----|------|-------------|
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 |
20
+
21
+ ### Auto Update
22
+
23
+ | API | Type | Description |
24
+ |-----|------|-------------|
25
+ | `AutoUpdate` | class | OTA auto-update manager (static methods) |
26
+
27
+ ---
28
+
29
+ ### `VersionInfo`
30
+
31
+ | Field | Type | Description |
32
+ |-------|------|-------------|
33
+ | `versionName` | `string` | App version name (e.g., `"1.0.0"`) |
34
+ | `versionCode` | `string` | App version code |
35
+
36
+ ### `ApkInstallerPlugin`
37
+
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 |
44
+
45
+ ### `ApkInstaller`
46
+
47
+ Abstract class with static methods. Android executes APK install intent; browser shows alert and returns normally.
48
+
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 |
55
+
56
+ ### `AutoUpdate`
57
+
58
+ Abstract class with static methods for OTA update management.
59
+
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 |
64
+
65
+ ## Usage Examples
66
+
67
+ ### Check and install APK
68
+
69
+ ```typescript
70
+ import { ApkInstaller } from "@simplysm/capacitor-plugin-auto-update";
71
+
72
+ // Check permissions
73
+ const perms = await ApkInstaller.checkPermissions();
74
+ if (!perms.granted) {
75
+ await ApkInstaller.requestPermissions();
76
+ }
77
+
78
+ // Install APK
79
+ await ApkInstaller.install("content://com.example.fileprovider/apk/update.apk");
80
+
81
+ // Get version info
82
+ const version = await ApkInstaller.getVersionInfo();
83
+ ```
84
+
85
+ ### Run OTA auto-update
86
+
87
+ ```typescript
88
+ import { AutoUpdate } from "@simplysm/capacitor-plugin-auto-update";
89
+
90
+ await AutoUpdate.run({
91
+ log: (messageHtml) => { /* display status */ },
92
+ serviceClient: myServiceClient,
93
+ });
94
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/capacitor-plugin-auto-update",
3
- "version": "13.0.97",
3
+ "version": "13.0.99",
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.97",
23
- "@simplysm/core-browser": "13.0.97",
24
- "@simplysm/core-common": "13.0.97",
25
- "@simplysm/service-client": "13.0.97",
26
- "@simplysm/service-common": "13.0.97"
22
+ "@simplysm/capacitor-plugin-file-system": "13.0.99",
23
+ "@simplysm/service-common": "13.0.99",
24
+ "@simplysm/core-browser": "13.0.99",
25
+ "@simplysm/service-client": "13.0.99",
26
+ "@simplysm/core-common": "13.0.99"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@capacitor/core": "^7.6.0",