tauri-plugin-live-activity 0.8.0 → 0.10.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/README.ko.md +7 -2
- package/README.md +8 -2
- package/cli/ios.mjs +15 -6
- package/cli/main.mjs +4 -2
- package/cli/setup.mjs +10 -5
- package/cli/xcodegen.mjs +11 -1
- package/dist-js/index.d.ts +18 -0
- package/dist-js/index.js +20 -0
- package/dist-js/types.d.ts +15 -2
- package/package.json +3 -3
package/README.ko.md
CHANGED
|
@@ -149,7 +149,7 @@ fn deliver<R: Runtime>(app: &AppHandle<R>) -> Result<()> {
|
|
|
149
149
|
fallback: Fallback::Notification,
|
|
150
150
|
layout: Layout {
|
|
151
151
|
lock_screen: Element::Text { value: None, bind: Some("status".into()) }.into(),
|
|
152
|
-
island: None, background: None, keyline: None, url: None,
|
|
152
|
+
island: None, background: None, keyline: None, url: None, small: None,
|
|
153
153
|
},
|
|
154
154
|
styles: None,
|
|
155
155
|
snapshot: snapshot(0, "On time"),
|
|
@@ -198,7 +198,7 @@ await updateLayout({ id: snack.id, snapshot: { revision: 1, values: { title: 'Mo
|
|
|
198
198
|
await endLayout({ id: snack.id, policy: { kind: 'immediate' } });
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
시작 요청에 `scheduled: { at, alert }`를 주면 나중에 시작하고(iOS 26과 Android), `ios: { transient: true }`이면 일시적 액티비티가 됩니다(iOS 18). 레이아웃은 시작한 모습 그대로이고, 갱신마다 모든 값을 더 높은 revision으로 다시 보냅니다. 탭은
|
|
201
|
+
시작 요청에 `scheduled: { at, alert }`를 주면 나중에 시작하고(iOS 26과 Android. Android에서는 사용자가 정확한 알람을 허용해야 제시간에 시작하며, `openExactAlarmSettings()`가 그 설정 화면을 엽니다), `ios: { transient: true }`이면 일시적 액티비티가 됩니다(iOS 18). 레이아웃은 시작한 모습 그대로이고, 갱신마다 모든 값을 더 높은 revision으로 다시 보냅니다. 탭은
|
|
202
202
|
`onAction`으로, 푸시 토큰과 푸시된 내용은 `onPushToken`, `onPushToStartToken`, `onUpdated`로, 앱이 호출하지 않은
|
|
203
203
|
액티비티의 변화는 `onState`, `onStarted`, `onOpened`(Android: 액티비티의 알림으로 앱을 연 일. 앱을 실행시킨 열림도 페이지가 구독할 때까지 보관됩니다), `onPermissions`로 옵니다.
|
|
204
204
|
|
|
@@ -242,6 +242,11 @@ island: {
|
|
|
242
242
|
keyline: '#A3D9C2', // 아일랜드 테두리 색
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
+
페어링된 Apple Watch(iOS 18)와 CarPlay(iOS 26)는 아일랜드의 compact 부분을 보여 줍니다. 위젯 익스텐션이 그
|
|
246
|
+
패밀리를 그리도록 해 두면(`setup --small-family`) `small`이 거기에 자기 트리를 줍니다. 노드는 12개까지이고
|
|
247
|
+
버튼·링크·토글은 넣을 수 없습니다: `small: hstack([symbol('pawprint.fill'), bound('eta')])`. Android는 이를
|
|
248
|
+
`degradedFeatures`에 적습니다. [더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#apple-watch-and-carplay)
|
|
249
|
+
|
|
245
250
|
## 푸시 (iOS)
|
|
246
251
|
|
|
247
252
|
서버가 APNs로 액티비티를 갱신하고 끝내고 시작합니다. `push: 'token'`(iOS 18에서는 `{ channel }`도)으로
|
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ fn deliver<R: Runtime>(app: &AppHandle<R>) -> Result<()> {
|
|
|
150
150
|
fallback: Fallback::Notification,
|
|
151
151
|
layout: Layout {
|
|
152
152
|
lock_screen: Element::Text { value: None, bind: Some("status".into()) }.into(),
|
|
153
|
-
island: None, background: None, keyline: None, url: None,
|
|
153
|
+
island: None, background: None, keyline: None, url: None, small: None,
|
|
154
154
|
},
|
|
155
155
|
styles: None,
|
|
156
156
|
snapshot: snapshot(0, "On time"),
|
|
@@ -199,7 +199,8 @@ await updateLayout({ id: snack.id, snapshot: { revision: 1, values: { title: 'Mo
|
|
|
199
199
|
await endLayout({ id: snack.id, policy: { kind: 'immediate' } });
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
A start may also carry `scheduled: { at, alert }` to begin later (iOS 26 and Android
|
|
202
|
+
A start may also carry `scheduled: { at, alert }` to begin later (iOS 26 and Android; on Android it is on the minute once the
|
|
203
|
+
person allows exact alarms, where `openExactAlarmSettings()` takes them), and `ios: { transient: true }` for a transient
|
|
203
204
|
activity (iOS 18). The layout stays as it started; each update sends every value again, with a higher revision. Taps come to
|
|
204
205
|
`onAction`, push tokens and pushed content to `onPushToken`, `onPushToStartToken` and `onUpdated`, and what happens
|
|
205
206
|
to an activity outside the app's calls to `onState`, `onStarted`, `onOpened` (Android: the person opened the app from an
|
|
@@ -246,6 +247,11 @@ island: {
|
|
|
246
247
|
keyline: '#A3D9C2', // the island's edge color
|
|
247
248
|
```
|
|
248
249
|
|
|
250
|
+
A paired Apple Watch (iOS 18) and CarPlay (iOS 26) show the island's compact parts. `small` gives them a tree of
|
|
251
|
+
their own, at most 12 nodes without buttons, links or toggles, once the widget extension draws that family
|
|
252
|
+
(`setup --small-family`): `small: hstack([symbol('pawprint.fill'), bound('eta')])`. Android names it in
|
|
253
|
+
`degradedFeatures`. [More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#apple-watch-and-carplay)
|
|
254
|
+
|
|
249
255
|
## Pushes (iOS)
|
|
250
256
|
|
|
251
257
|
A server updates, ends or starts activities through APNs. Start with `push: 'token'` (or `{ channel }` on iOS 18)
|
package/cli/ios.mjs
CHANGED
|
@@ -8,7 +8,9 @@ import { OLD_MODULES, RETIRED, released, renameCustomViews } from './migration.m
|
|
|
8
8
|
import { newPlist, setTrueKey } from './plist.mjs';
|
|
9
9
|
import { SetupError, parseJson, readText, step, tail, which, writeFile } from './steps.mjs';
|
|
10
10
|
import { assetSteps, bundledFonts, fontSteps } from './widget-files.mjs';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
SMALL_FAMILY_KEY, SPEC_FILE, WIDGET, addInclude, appGroupOf, drawsSmallFamily, readProject, widgetSpec, writtenBySetup,
|
|
13
|
+
} from './xcodegen.mjs';
|
|
12
14
|
|
|
13
15
|
/** The widget bundle: activitykit's template, under the name 0.2 and 0.3 gave the plugin's. */
|
|
14
16
|
const WIDGET_FILE = 'LiveActivityWidget.swift';
|
|
@@ -32,9 +34,9 @@ export function iosSteps(context) {
|
|
|
32
34
|
const plist = infoPlistStep(context);
|
|
33
35
|
if (project.widget) {
|
|
34
36
|
const detail = `already has a widget extension, ${project.widget}; add the plugin's widget to it by hand (docs/ios-integration.md)`;
|
|
35
|
-
const { files, appGroup } = context;
|
|
36
|
-
const given = [files.fonts.length && '--font', files.assets.length && '--asset', appGroup && '--app-group'].filter(Boolean);
|
|
37
|
-
const left = given.length === 0 ? [] : [step('todo', show(specPath), `${given.join(', ')} not applied: that widget is yours to give fonts, images
|
|
37
|
+
const { files, appGroup, smallFamily } = context;
|
|
38
|
+
const given = [files.fonts.length && '--font', files.assets.length && '--asset', appGroup && '--app-group', smallFamily && '--small-family'].filter(Boolean);
|
|
39
|
+
const left = given.length === 0 ? [] : [step('todo', show(specPath), `${given.join(', ')} not applied: that widget is yours to give fonts, images, an App Group and the small family (docs/ios-integration.md)`)];
|
|
38
40
|
return [plist, step('skipped', show(specPath), detail), ...left];
|
|
39
41
|
}
|
|
40
42
|
if (!project.appTarget) {
|
|
@@ -43,12 +45,14 @@ export function iosSteps(context) {
|
|
|
43
45
|
}
|
|
44
46
|
const widget = join(apple, WIDGET);
|
|
45
47
|
const appGroup = appGroupFor(context, apple, project);
|
|
48
|
+
// A spec that setup wrote with the small family keeps it on later runs, as it keeps its App Group.
|
|
49
|
+
const smallFamily = context.smallFamily || drawsSmallFamily(readText(join(apple, SPEC_FILE)));
|
|
46
50
|
const include = includeStep(context, specPath, yaml);
|
|
47
51
|
// XcodeGen lists the files of a folder when it generates, so a new or removed widget file also needs a run.
|
|
48
52
|
const projectSteps = [
|
|
49
53
|
widgetStep(context, widget), ...retiredSteps(context, widget, readText(join(apple, SPEC_FILE))), customViewsStep(context, widget),
|
|
50
54
|
...fontSteps(context, widget), ...assetSteps(context, widget),
|
|
51
|
-
specStep(context, apple, project, { fonts: bundledFonts(context, widget), appGroup }), include,
|
|
55
|
+
specStep(context, apple, project, { fonts: bundledFonts(context, widget), appGroup, smallFamily }), include,
|
|
52
56
|
];
|
|
53
57
|
return [plist, ...projectSteps, xcodegenStep(context, apple, specPath, projectSteps, include)];
|
|
54
58
|
}
|
|
@@ -133,11 +137,12 @@ function retiredSteps({ show }, widget, spec) {
|
|
|
133
137
|
});
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
function specStep({ plugin, activitykit, config, srcTauri, show }, apple, project, { fonts, appGroup }) {
|
|
140
|
+
function specStep({ plugin, activitykit, config, srcTauri, show }, apple, project, { fonts, appGroup, smallFamily }) {
|
|
137
141
|
const path = join(apple, SPEC_FILE);
|
|
138
142
|
const wanted = widgetSpec({
|
|
139
143
|
fonts,
|
|
140
144
|
appGroup,
|
|
145
|
+
smallFamily,
|
|
141
146
|
// XcodeGen writes the entitlements file from the spec, so the App Group goes into the spec, at the app's path.
|
|
142
147
|
appEntitlements: project.entitlements ?? `${project.appTarget}/${project.appTarget}.entitlements`,
|
|
143
148
|
pluginVersion: plugin.version,
|
|
@@ -153,6 +158,10 @@ function specStep({ plugin, activitykit, config, srcTauri, show }, apple, projec
|
|
|
153
158
|
}
|
|
154
159
|
if (current === wanted) return step('unchanged', show(path));
|
|
155
160
|
if (!writtenBySetup(current)) {
|
|
161
|
+
// The spec is the app's now: the key that --small-family asks for goes in by hand, as the rest of it did.
|
|
162
|
+
if (smallFamily && !drawsSmallFamily(current)) {
|
|
163
|
+
return step('todo', show(path), `it was changed by hand, so --small-family was not applied: add \`${SMALL_FAMILY_KEY}: true\` to the info properties of ${WIDGET}, or delete the file and run setup again`);
|
|
164
|
+
}
|
|
156
165
|
return step('kept', show(path), 'it was changed by hand; delete it and run setup again to have it written anew');
|
|
157
166
|
}
|
|
158
167
|
return step('updated', show(path), 'for the current plugin, activitykit and app version', writeFile(path, wanted));
|
package/cli/main.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { formatReport } from './report.mjs';
|
|
3
3
|
import { SetupError, setup } from './setup.mjs';
|
|
4
4
|
|
|
5
|
-
const USAGE = `Usage: npx tauri-plugin-live-activity setup [--dry-run] [--ios-only] [--font <file>]... [--asset <file>]... [--app-group[=<id>]]
|
|
5
|
+
const USAGE = `Usage: npx tauri-plugin-live-activity setup [--dry-run] [--ios-only] [--font <file>]... [--asset <file>]... [--app-group[=<id>]] [--small-family]
|
|
6
6
|
|
|
7
7
|
Run it in the folder of a Tauri 2 app after \`cargo add\` and \`npm i\`. It grants the plugin's
|
|
8
8
|
permissions, sets the Android minimum to API 26 and, on a Mac, adds the Live Activity widget
|
|
@@ -16,9 +16,11 @@ ever made from scratch.
|
|
|
16
16
|
name@2x.png and name@3x.png are scales of the asset name
|
|
17
17
|
--app-group[=<id>] give the app and the widget extension an App Group, group.<app identifier> unless
|
|
18
18
|
named, so writeImage can share images; later runs keep it
|
|
19
|
+
--small-family draw a layout's small region on a paired Apple Watch and in CarPlay, and there the
|
|
20
|
+
compact parts of a layout without one; later runs keep it
|
|
19
21
|
`;
|
|
20
22
|
|
|
21
|
-
const FLAGS = { '--dry-run': 'dryRun', '--ios-only': 'iosOnly' };
|
|
23
|
+
const FLAGS = { '--dry-run': 'dryRun', '--ios-only': 'iosOnly', '--small-family': 'smallFamily' };
|
|
22
24
|
const FILES = { '--font': 'fonts', '--asset': 'assets' };
|
|
23
25
|
const HELP = new Set(['help', '--help', '-h']);
|
|
24
26
|
|
package/cli/setup.mjs
CHANGED
|
@@ -12,10 +12,14 @@ export { SetupError } from './steps.mjs';
|
|
|
12
12
|
export const CRATE = 'tauri-plugin-live-activity';
|
|
13
13
|
/** The crate whose Swift package the widget extension and the app target link. */
|
|
14
14
|
export const ACTIVITYKIT = 'activitykit';
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* `default` reads; the others allow the commands that change activities, and the two that ask the person: with
|
|
17
|
+
* Android's dialog, and in its setting for exact alarms.
|
|
18
|
+
*/
|
|
16
19
|
export const PERMISSIONS = [
|
|
17
20
|
'live-activity:default',
|
|
18
|
-
...['request-permissions', 'start', 'update', 'end', 'start-layout', 'update-layout', 'end-layout',
|
|
21
|
+
...['request-permissions', 'open-exact-alarm-settings', 'start', 'update', 'end', 'start-layout', 'update-layout', 'end-layout',
|
|
22
|
+
'write-image']
|
|
19
23
|
.map(command => `live-activity:allow-${command}`),
|
|
20
24
|
];
|
|
21
25
|
// The plugin's Android library needs API 26: Tauri's Jackson runtime fails below it.
|
|
@@ -25,16 +29,17 @@ const NPM_VERSION = JSON.parse(readFileSync(new URL('../package.json', import.me
|
|
|
25
29
|
/**
|
|
26
30
|
* Sets up the app in `cwd` (its folder or its src-tauri folder) and returns the steps with their
|
|
27
31
|
* status, and notes for the person who runs it. `fonts` and `assets` are files for the widget
|
|
28
|
-
* extension; `appGroup` is true or the name of an App Group
|
|
32
|
+
* extension; `appGroup` is true or the name of an App Group; with `smallFamily` the widget draws a layout's small
|
|
33
|
+
* region. Throws SetupError when it cannot start.
|
|
29
34
|
*/
|
|
30
35
|
export function setup({
|
|
31
36
|
cwd = process.cwd(), env = process.env, dryRun = false, iosOnly = false, platform = process.platform,
|
|
32
|
-
fonts = [], assets = [], appGroup = undefined,
|
|
37
|
+
fonts = [], assets = [], appGroup = undefined, smallFamily = false,
|
|
33
38
|
} = {}) {
|
|
34
39
|
const files = widgetFiles(cwd, { fonts, assets });
|
|
35
40
|
const app = findApp(cwd);
|
|
36
41
|
const { plugin, activitykit } = findCrates(app, env);
|
|
37
|
-
const context = { ...app, plugin, activitykit, env, platform, files, appGroup, show: path => display(cwd, path) };
|
|
42
|
+
const context = { ...app, plugin, activitykit, env, platform, files, appGroup, smallFamily, show: path => display(cwd, path) };
|
|
38
43
|
const planned = [...(iosOnly ? [] : [capabilitiesStep(context), ...androidSteps(context)]), ...iosSteps(context)];
|
|
39
44
|
const steps = dryRun ? planned : planned.map(apply);
|
|
40
45
|
return { dryRun, version: plugin.version, steps: steps.map(({ effect, ...rest }) => rest), notes: notes(context) };
|
package/cli/xcodegen.mjs
CHANGED
|
@@ -10,6 +10,8 @@ export const WIDGET_ENTITLEMENTS = `${WIDGET}.entitlements`;
|
|
|
10
10
|
export const APP_GROUP_KEY = 'ActivityKitAppGroup';
|
|
11
11
|
/** The key of 0.2 and 0.3, which a spec they wrote may hold. */
|
|
12
12
|
const OLD_APP_GROUP_KEY = 'TauriLiveActivityAppGroup';
|
|
13
|
+
/** The Info.plist key of the extension with which activitykit's widget draws the small family. */
|
|
14
|
+
export const SMALL_FAMILY_KEY = 'ActivityKitSmallFamily';
|
|
13
15
|
/**
|
|
14
16
|
* The files of the widget folder that the app target compiles too. The custom views file is Swift, so the app target
|
|
15
17
|
* compiles Swift, which Xcode needs to take the App Intents metadata of the linked ActivityKitIntent product.
|
|
@@ -87,6 +89,11 @@ export function appGroupOf(spec = '') {
|
|
|
87
89
|
return value && JSON.parse(value);
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
/** Whether a spec that setup wrote has the widget draw the small family, so that a later run keeps that. */
|
|
93
|
+
export function drawsSmallFamily(spec = '') {
|
|
94
|
+
return new RegExp(`^\\s+${SMALL_FAMILY_KEY}: true$`, 'm').test(spec);
|
|
95
|
+
}
|
|
96
|
+
|
|
90
97
|
/**
|
|
91
98
|
* Adds `file` to the spec's `include` list. Status: `added` (with the new `text`), `present`, or
|
|
92
99
|
* `unsupported` when the list has a form this does not edit.
|
|
@@ -122,10 +129,12 @@ const quoted = value => JSON.stringify(String(value));
|
|
|
122
129
|
* The included spec: activitykit's Swift package, the widget extension target, and in the app target the extension,
|
|
123
130
|
* the button intent and the custom views. `fonts` go to the extension's UIAppFonts. An `appGroup` goes to the
|
|
124
131
|
* entitlements of both targets, the app's at `appEntitlements`, and to the extension's Info.plist, where activitykit
|
|
125
|
-
* and the widget read it.
|
|
132
|
+
* and the widget read it. With `smallFamily` the extension's Info.plist says that the widget draws the small family,
|
|
133
|
+
* for a paired Apple Watch and CarPlay. XcodeGen merges the app target's part into the target of project.yml.
|
|
126
134
|
*/
|
|
127
135
|
export function widgetSpec({
|
|
128
136
|
pluginVersion, packagePath, appTarget, bundleId, appVersion, buildVersion, teamGroup, fonts = [], appGroup, appEntitlements,
|
|
137
|
+
smallFamily = false,
|
|
129
138
|
}) {
|
|
130
139
|
const versions = appVersion === undefined ? [] : [
|
|
131
140
|
` CFBundleShortVersionString: ${quoted(appVersion)}`,
|
|
@@ -172,6 +181,7 @@ export function widgetSpec({
|
|
|
172
181
|
' NSExtensionPointIdentifier: com.apple.widgetkit-extension',
|
|
173
182
|
' # A start answers CONFIGURATION_REQUIRED without an extension that declares this.',
|
|
174
183
|
' ActivityKitLayout: 2',
|
|
184
|
+
...(smallFamily ? [` ${SMALL_FAMILY_KEY}: true`] : []),
|
|
175
185
|
...fontList,
|
|
176
186
|
...group,
|
|
177
187
|
...entitlements(WIDGET_ENTITLEMENTS),
|
package/dist-js/index.d.ts
CHANGED
|
@@ -9,6 +9,24 @@ export declare function getCapabilities(): Promise<Capabilities>;
|
|
|
9
9
|
export declare function checkPermissions(): Promise<Permissions>;
|
|
10
10
|
/** Request an OS permission where supported; settings-only controls report that state. */
|
|
11
11
|
export declare function requestPermissions(kind: PermissionKind): Promise<Permissions>;
|
|
12
|
+
/**
|
|
13
|
+
* Open Android's setting where the person allows the app exact alarms ("Alarms & reminders"), which a scheduled
|
|
14
|
+
* start needs to begin at its time, and resolve when they are back, with the capabilities as they are then:
|
|
15
|
+
* `androidPresentation.exactStart` says whether they allowed it. Call it when `exactStart` is false and the app
|
|
16
|
+
* schedules starts; where exact alarms are allowed already, or need no permission (before Android 12), it resolves
|
|
17
|
+
* at once and opens nothing.
|
|
18
|
+
*
|
|
19
|
+
* Android shows the setting only for an app whose own manifest declares `SCHEDULE_EXACT_ALARM`: where exact
|
|
20
|
+
* alarms are not allowed and the declaration is missing, the call rejects with `CONFIGURATION_REQUIRED`. It
|
|
21
|
+
* rejects with `NOT_FOREGROUND` while the app is not on screen, with `UNSUPPORTED_FEATURE` on a device without
|
|
22
|
+
* the setting and on iOS, which starts a scheduled activity itself, and with `UNSUPPORTED_PLATFORM` on desktop.
|
|
23
|
+
* A call that comes while the setting is open resolves with the first.
|
|
24
|
+
*
|
|
25
|
+
* The page may be gone when the person is back: Android may have closed it meanwhile, and it stops the app when
|
|
26
|
+
* the person takes the permission away. Read `getCapabilities()` when the page loads rather than rely on this
|
|
27
|
+
* promise alone. The command needs its own grant, `live-activity:allow-open-exact-alarm-settings`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function openExactAlarmSettings(): Promise<Capabilities>;
|
|
12
30
|
/** Start an activity; repeated identical starts for an active key are idempotent. */
|
|
13
31
|
export declare function start(input: StartInput): Promise<ActivityRecord>;
|
|
14
32
|
/** Replace the entire snapshot with a newer revision. */
|
package/dist-js/index.js
CHANGED
|
@@ -14,6 +14,26 @@ export function checkPermissions() {
|
|
|
14
14
|
export function requestPermissions(kind) {
|
|
15
15
|
return invoke('plugin:live-activity|request_permissions', { kind });
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Open Android's setting where the person allows the app exact alarms ("Alarms & reminders"), which a scheduled
|
|
19
|
+
* start needs to begin at its time, and resolve when they are back, with the capabilities as they are then:
|
|
20
|
+
* `androidPresentation.exactStart` says whether they allowed it. Call it when `exactStart` is false and the app
|
|
21
|
+
* schedules starts; where exact alarms are allowed already, or need no permission (before Android 12), it resolves
|
|
22
|
+
* at once and opens nothing.
|
|
23
|
+
*
|
|
24
|
+
* Android shows the setting only for an app whose own manifest declares `SCHEDULE_EXACT_ALARM`: where exact
|
|
25
|
+
* alarms are not allowed and the declaration is missing, the call rejects with `CONFIGURATION_REQUIRED`. It
|
|
26
|
+
* rejects with `NOT_FOREGROUND` while the app is not on screen, with `UNSUPPORTED_FEATURE` on a device without
|
|
27
|
+
* the setting and on iOS, which starts a scheduled activity itself, and with `UNSUPPORTED_PLATFORM` on desktop.
|
|
28
|
+
* A call that comes while the setting is open resolves with the first.
|
|
29
|
+
*
|
|
30
|
+
* The page may be gone when the person is back: Android may have closed it meanwhile, and it stops the app when
|
|
31
|
+
* the person takes the permission away. Read `getCapabilities()` when the page loads rather than rely on this
|
|
32
|
+
* promise alone. The command needs its own grant, `live-activity:allow-open-exact-alarm-settings`.
|
|
33
|
+
*/
|
|
34
|
+
export function openExactAlarmSettings() {
|
|
35
|
+
return invoke('plugin:live-activity|open_exact_alarm_settings', {});
|
|
36
|
+
}
|
|
17
37
|
/** Start an activity; repeated identical starts for an active key are idempotent. */
|
|
18
38
|
export function start(input) {
|
|
19
39
|
return invoke('plugin:live-activity|start', { input });
|
package/dist-js/types.d.ts
CHANGED
|
@@ -62,7 +62,11 @@ export interface AndroidPresentationSupport {
|
|
|
62
62
|
readonly branding: boolean;
|
|
63
63
|
/** A start with `scheduled`, which Android begins at its time, also while the app does not run; `UNSUPPORTED_FEATURE` without it. */
|
|
64
64
|
readonly scheduledStart: boolean;
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Whether a scheduled start begins at its time: the app may set exact alarms. Without it Android chooses the
|
|
67
|
+
* moment: up to ten minutes late while the device is awake, an hour while it dozes. `openExactAlarmSettings()`
|
|
68
|
+
* takes the person to the setting that allows it.
|
|
69
|
+
*/
|
|
66
70
|
readonly exactStart: boolean;
|
|
67
71
|
}
|
|
68
72
|
export interface Permissions {
|
|
@@ -739,6 +743,14 @@ export interface Layout {
|
|
|
739
743
|
* app without a URL. On Android, where the device offers `links`, it is what a tap on the notification opens.
|
|
740
744
|
*/
|
|
741
745
|
readonly url?: LayoutBindable<string>;
|
|
746
|
+
/**
|
|
747
|
+
* What the activity shows in the Smart Stack of a paired Apple Watch (iOS 18) and in CarPlay (iOS 26): at most 12
|
|
748
|
+
* nodes and no button, link or toggle. iOS draws it when the widget extension's Info.plist sets
|
|
749
|
+
* `ActivityKitSmallFamily` to true (`setup --small-family`); without the key the system shows the compact parts of
|
|
750
|
+
* the island there, and the record names `layout.small` in `degradedFeatures`. So does Android, where a watch and a
|
|
751
|
+
* car show the notification.
|
|
752
|
+
*/
|
|
753
|
+
readonly small?: LayoutNode;
|
|
742
754
|
}
|
|
743
755
|
/** What only Android reads of a start. */
|
|
744
756
|
export interface LayoutAndroidOptions {
|
|
@@ -782,7 +794,8 @@ export interface LayoutIosOptions {
|
|
|
782
794
|
* A start at a later time instead of now: iOS 26, and Android where `getCapabilities().androidPresentation.scheduledStart`
|
|
783
795
|
* is true. Until then the record is `pending`: the activity holds its key, it can be ended, and an update is
|
|
784
796
|
* `CONFLICT`, since it begins with the content of its start. `onState` reports `active` when it begins. On Android
|
|
785
|
-
* it begins at its time with the permission for exact alarms (`exactStart`) and
|
|
797
|
+
* it begins at its time with the permission for exact alarms (`exactStart`) and late without, by minutes;
|
|
798
|
+
* `openExactAlarmSettings()` takes the person to the setting that allows it. It is
|
|
786
799
|
* `UNSUPPORTED_FEATURE`, and nothing is kept, before iOS 26, with the foreground placement on Android, and where
|
|
787
800
|
* `scheduledStart` is false.
|
|
788
801
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tauri-plugin-live-activity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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",
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
"build": "tsc -p tsconfig.json",
|
|
34
34
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p examples/demo/tsconfig.json",
|
|
35
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/
|
|
36
|
+
"test:contracts": "node --test --experimental-test-coverage \"--test-coverage-include=tools/activitykit.mjs\" \"--test-coverage-include=tools/sync-liveupdate.mjs\" --test-coverage-lines=80 --test-coverage-branches=80 --test-coverage-functions=80 tests/contract-files.test.mjs tests/typescript-requests.test.mjs tests/android-liveupdate.test.mjs tests/android-contents.test.mjs tests/ci.test.mjs tests/ci-cache.test.mjs tests/spec-coverage.test.mjs",
|
|
37
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 tests/api-reload.test.mjs",
|
|
38
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
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",
|
|
40
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",
|
|
41
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",
|
|
42
|
+
"write:requests": "npm run build && node --experimental-strip-types --test --test-update-snapshots tests/jsx.test.mjs tests/react.test.mjs examples/demo/tests/layouts.test.mjs examples/demo/tests/self-test.test.mjs examples/demo/tests/ui-state.test.mjs",
|
|
42
43
|
"build:demo": "npm run build && node examples/demo/build.mjs",
|
|
43
44
|
"prepack": "npm run build",
|
|
44
45
|
"pack:check": "npm pack --dry-run"
|
|
@@ -54,7 +55,6 @@
|
|
|
54
55
|
"@tauri-apps/cli": "2.12.4",
|
|
55
56
|
"@tauri-apps/api": "2.12.4",
|
|
56
57
|
"@types/react": "19.3.0",
|
|
57
|
-
"ajv": "8.20.0",
|
|
58
58
|
"esbuild": "0.28.2",
|
|
59
59
|
"react": "19.3.1",
|
|
60
60
|
"react-test-renderer": "19.3.1",
|