tauri-plugin-live-activity 0.3.0 → 0.5.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/README.ko.md +69 -8
- package/README.md +70 -9
- package/cli/ios.mjs +65 -46
- package/cli/migration.mjs +55 -0
- package/cli/report.mjs +2 -2
- package/cli/setup.mjs +18 -7
- package/cli/steps.mjs +1 -1
- package/cli/templates/LiveActivityCustomViews.swift +25 -0
- package/cli/xcodegen.mjs +28 -20
- package/dist-js/index.d.ts +9 -5
- package/dist-js/index.js +7 -3
- package/dist-js/jsx/index.d.ts +59 -0
- package/dist-js/jsx/index.js +101 -0
- package/dist-js/jsx/jsx-dev-runtime.d.ts +4 -0
- package/dist-js/jsx/jsx-dev-runtime.js +6 -0
- package/dist-js/jsx/jsx-runtime.d.ts +16 -0
- package/dist-js/jsx/jsx-runtime.js +9 -0
- package/dist-js/react/index.d.ts +12 -0
- package/dist-js/react/index.js +42 -0
- package/dist-js/react/session.d.ts +68 -0
- package/dist-js/react/session.js +138 -0
- package/dist-js/types.d.ts +16 -3
- package/package.json +17 -4
package/dist-js/types.d.ts
CHANGED
|
@@ -81,7 +81,8 @@ export interface EndInput {
|
|
|
81
81
|
/** Unsupported policies fail explicitly instead of being silently ignored. */
|
|
82
82
|
readonly policy: EndPolicy;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
/** `pending`: scheduled and not started yet (iOS 26). */
|
|
85
|
+
export type ActivityState = 'pending' | 'active' | 'stale' | 'ended' | 'dismissed' | 'unknown';
|
|
85
86
|
export type PromotionState = 'promoted' | 'notPromoted' | 'unknown' | 'notApplicable';
|
|
86
87
|
export interface ActivityRecord {
|
|
87
88
|
/** Opaque handle for this generation; a later start receives a new handle. */
|
|
@@ -99,7 +100,7 @@ export interface ActivityRecord {
|
|
|
99
100
|
readonly promotionRequested: boolean;
|
|
100
101
|
readonly promotionState: PromotionState;
|
|
101
102
|
}
|
|
102
|
-
export type ErrorCode = 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_FEATURE' | 'PERMISSION_DENIED' | 'CONFIGURATION_REQUIRED' | 'INVALID_INPUT' | 'PAYLOAD_TOO_LARGE' | 'NOT_FOUND' | 'STALE_REVISION' | 'CONFLICT' | 'SYSTEM_LIMIT' | 'NATIVE_ERROR';
|
|
103
|
+
export type ErrorCode = 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_FEATURE' | 'PERMISSION_DENIED' | 'NOT_FOREGROUND' | 'CONFIGURATION_REQUIRED' | 'INVALID_INPUT' | 'PAYLOAD_TOO_LARGE' | 'NOT_FOUND' | 'STALE_REVISION' | 'CONFLICT' | 'SYSTEM_LIMIT' | 'NATIVE_ERROR';
|
|
103
104
|
/** Native plugin rejections are structured objects, not JavaScript Error instances. */
|
|
104
105
|
export interface LiveActivityError {
|
|
105
106
|
readonly code: ErrorCode;
|
|
@@ -112,12 +113,17 @@ export interface LayoutValues {
|
|
|
112
113
|
readonly [key: string]: LayoutValue;
|
|
113
114
|
}
|
|
114
115
|
export interface LayoutSnapshot {
|
|
115
|
-
/** Nonnegative JavaScript safe integer; strictly increases when the values change. */
|
|
116
|
+
/** Nonnegative JavaScript safe integer; strictly increases when the values change. Sent as given. */
|
|
116
117
|
readonly revision: number;
|
|
117
118
|
/** The complete map. An update keeps the keys and the value types accepted at start. */
|
|
118
119
|
readonly values: LayoutValues;
|
|
119
120
|
/** UTC Unix epoch milliseconds. */
|
|
120
121
|
readonly staleAt?: number;
|
|
122
|
+
/**
|
|
123
|
+
* When the content was made, UTC Unix epoch milliseconds. ActivityKit (iOS 17.2) drops content older than what it
|
|
124
|
+
* shows; without it iOS takes the time the content is sent. Android keeps it in the record.
|
|
125
|
+
*/
|
|
126
|
+
readonly timestamp?: number;
|
|
121
127
|
}
|
|
122
128
|
type ColorName = 'primary' | 'secondary' | 'accent' | 'red' | 'orange' | 'yellow' | 'green' | 'mint' | 'teal' | 'cyan' | 'blue' | 'indigo' | 'purple' | 'pink' | 'brown' | 'white' | 'black' | 'gray' | 'clear';
|
|
123
129
|
/** `#RRGGBB` or `#RRGGBBAA`. */
|
|
@@ -383,6 +389,13 @@ export interface LayoutUpdateInput {
|
|
|
383
389
|
/** Complete replacement snapshot, not a partial update. */
|
|
384
390
|
readonly snapshot: LayoutSnapshot;
|
|
385
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* The end of a layout activity. With `snapshot` it ends with that final content, checked as an update; without one it
|
|
394
|
+
* ends with the last accepted values.
|
|
395
|
+
*/
|
|
396
|
+
export interface LayoutEndInput extends EndInput {
|
|
397
|
+
readonly snapshot?: LayoutSnapshot;
|
|
398
|
+
}
|
|
386
399
|
/** The record does not repeat the layout. */
|
|
387
400
|
export interface LayoutActivityRecord {
|
|
388
401
|
/** Opaque handle for this generation; contract v1 commands do not see it. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tauri-plugin-live-activity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Tauri 2 plugin for iOS Live Activities (ActivityKit and Dynamic Island) and Android Live Updates with ongoing notification fallback",
|
|
5
5
|
"author": "1eedaegon",
|
|
6
6
|
"type": "module",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"main": "./dist-js/index.js",
|
|
18
18
|
"exports": {
|
|
19
19
|
".": { "types": "./dist-js/index.d.ts", "import": "./dist-js/index.js" },
|
|
20
|
+
"./jsx": { "types": "./dist-js/jsx/index.d.ts", "import": "./dist-js/jsx/index.js" },
|
|
21
|
+
"./jsx/jsx-runtime": { "types": "./dist-js/jsx/jsx-runtime.d.ts", "import": "./dist-js/jsx/jsx-runtime.js" },
|
|
22
|
+
"./jsx/jsx-dev-runtime": { "types": "./dist-js/jsx/jsx-dev-runtime.d.ts", "import": "./dist-js/jsx/jsx-dev-runtime.js" },
|
|
23
|
+
"./react": { "types": "./dist-js/react/index.d.ts", "import": "./dist-js/react/index.js" },
|
|
20
24
|
"./package.json": "./package.json"
|
|
21
25
|
},
|
|
22
26
|
"bin": { "tauri-plugin-live-activity": "cli/bin.mjs" },
|
|
@@ -28,9 +32,11 @@
|
|
|
28
32
|
"scripts": {
|
|
29
33
|
"build": "tsc -p tsconfig.json",
|
|
30
34
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p examples/demo/tsconfig.json",
|
|
31
|
-
"test": "npm run build && npm run test:contracts && npm run test:api && npm run test:demo && npm run test:setup",
|
|
32
|
-
"test:contracts": "node --test --experimental-test-coverage \"--test-coverage-include=tools/validate-request.mjs\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 tests/requests.test.mjs tests/layout-requests.test.mjs",
|
|
35
|
+
"test": "npm run build && npm run test:contracts && npm run test:api && npm run test:jsx && npm run test:react && npm run test:demo && npm run test:setup",
|
|
36
|
+
"test:contracts": "node --test --experimental-test-coverage \"--test-coverage-include=tools/validate-request.mjs\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 tests/requests.test.mjs tests/layout-requests.test.mjs tests/contract-sync.test.mjs tests/android-liveupdate.test.mjs tests/ci.test.mjs tests/ci-cache.test.mjs tests/spec-coverage.test.mjs",
|
|
33
37
|
"test:api": "node --test --experimental-test-coverage \"--test-coverage-include=dist-js/*.js\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 tests/api.test.mjs",
|
|
38
|
+
"test:jsx": "node --experimental-strip-types --test --experimental-test-coverage \"--test-coverage-include=dist-js/jsx/*.js\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 tests/jsx.test.mjs",
|
|
39
|
+
"test:react": "node --test --experimental-test-coverage \"--test-coverage-include=dist-js/react/*.js\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 tests/react.test.mjs",
|
|
34
40
|
"test:demo": "node --experimental-strip-types --test --experimental-test-coverage \"--test-coverage-include=examples/demo/src/*.ts\" \"--test-coverage-exclude=examples/demo/tests/**\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 examples/demo/tests/self-test.test.mjs examples/demo/tests/ui-state.test.mjs examples/demo/tests/layouts.test.mjs examples/demo/tests/setup.test.mjs",
|
|
35
41
|
"test:setup": "node --test --experimental-test-coverage \"--test-coverage-include=cli/*.mjs\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 tests/setup.test.mjs",
|
|
36
42
|
"build:demo": "npm run build && node examples/demo/build.mjs",
|
|
@@ -38,13 +44,20 @@
|
|
|
38
44
|
"pack:check": "npm pack --dry-run"
|
|
39
45
|
},
|
|
40
46
|
"peerDependencies": {
|
|
41
|
-
"@tauri-apps/api": "^2.12.4"
|
|
47
|
+
"@tauri-apps/api": "^2.12.4",
|
|
48
|
+
"react": ">=18"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"react": { "optional": true }
|
|
42
52
|
},
|
|
43
53
|
"devDependencies": {
|
|
44
54
|
"@tauri-apps/cli": "2.12.4",
|
|
45
55
|
"@tauri-apps/api": "2.12.4",
|
|
56
|
+
"@types/react": "19.3.0",
|
|
46
57
|
"ajv": "8.20.0",
|
|
47
58
|
"esbuild": "0.28.2",
|
|
59
|
+
"react": "19.3.1",
|
|
60
|
+
"react-test-renderer": "19.3.1",
|
|
48
61
|
"typescript": "7.0.2"
|
|
49
62
|
}
|
|
50
63
|
}
|