tauri-plugin-live-activity 0.15.1 → 0.16.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 +18 -7
- package/README.md +20 -9
- package/dist-js/index.d.ts +20 -5
- package/dist-js/index.js +25 -4
- package/dist-js/react/session.d.ts +5 -1
- package/dist-js/types.d.ts +73 -3
- package/package.json +2 -1
package/README.ko.md
CHANGED
|
@@ -264,7 +264,7 @@ await onAction(({ actionId, tap }) => {
|
|
|
264
264
|
iOS에서는 `getCapabilities().ios`가 아이폰이 실행하는 기능(`pushToStart`, `pushChannels`, `transient`,
|
|
265
265
|
`scheduledStart`, `smallFamily`)을 알려 주므로 요청을 시도해 보지 않아도 됩니다.
|
|
266
266
|
|
|
267
|
-
Android에서는 시작에 `android: { visibility, publicVersion, placement, wearOngoingActivity, localOnly, targets }`를 줍니다:
|
|
267
|
+
Android에서는 시작에 `android: { visibility, publicVersion, placement, wearOngoingActivity, localOnly, watchMirror, targets }`를 줍니다:
|
|
268
268
|
|
|
269
269
|
```ts
|
|
270
270
|
android: {
|
|
@@ -272,6 +272,7 @@ android: {
|
|
|
272
272
|
placement: 'foreground', // 앱의 포그라운드 서비스가 쥐는 알림(`foregroundPlacement`)
|
|
273
273
|
wearOngoingActivity: false, // 워치 화면에서 뺌(Wear OS 3~6, Tauri 앱은 워치에서 돌지 않음)
|
|
274
274
|
localOnly: true, // 페어링된 워치로 넘기지 말라고 Android에 요청(`localOnly`)
|
|
275
|
+
// 또는 watchMirror: true, // 대신 페어링된 워치에 미러링, localOnly와 함께는 안 됨(`watchMirror`)
|
|
275
276
|
// 버튼 `record`의 탭이 화면 없이 앱의 서비스를 바로 실행(`actionTargets`).
|
|
276
277
|
targets: { record: { kind: 'foregroundService', component: 'com.example.RecorderService', action: 'com.example.RECORD' } },
|
|
277
278
|
}
|
|
@@ -325,18 +326,26 @@ iOS에서는 페어링된 Apple Watch(iOS 18)와 CarPlay(iOS 26)가 아일랜드
|
|
|
325
326
|
익스텐션이 그 패밀리를 그리도록 해 두면(`setup --small-family`) `small`이 거기에 자기 트리를 줍니다. 노드는
|
|
326
327
|
12개까지이고 버튼·링크·토글은 넣을 수 없습니다: `small: hstack([symbol('pawprint.fill'), bound('eta')])`.
|
|
327
328
|
Android에서는 폰의 ongoing 알림이 페어링된 워치로 전달되지 않고 Live Update만 일부 워치에 전달됩니다.
|
|
328
|
-
`android: { localOnly: true }`는 그것도 하지 말라고 Android에 요청합니다.
|
|
329
|
+
`android: { localOnly: true }`는 그것도 하지 말라고 Android에 요청합니다. `android: { watchMirror: true }`는 진행 중이
|
|
330
|
+
아닌 두 번째 알림으로 모든 스냅샷을 워치에 미러링합니다. Android Auto에는 이를 보여 줄 자리가 없습니다. Android는 `small`을 `degradedFeatures`에 적습니다. [더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#a-watch-and-a-car)
|
|
329
331
|
|
|
330
332
|
잠금 화면의 카드에는 여백이 없고, 더 좁은 레이아웃은 가운데에 놓입니다. 루트에 padding을 주고, 가장자리에 붙일
|
|
331
333
|
노드에는 `frame: { maxWidth: 'infinity', alignment: 'leading' }`인 스타일을 줍니다.
|
|
332
334
|
[더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#placement-on-the-lock-screen)
|
|
333
335
|
|
|
334
|
-
## 푸시
|
|
336
|
+
## 푸시
|
|
335
337
|
|
|
336
|
-
서버가 APNs로 액티비티를 갱신하고 끝내고 시작합니다. `push: 'token'`(iOS 18에서는 `{ channel }`도)으로
|
|
338
|
+
iOS에서는 서버가 APNs로 액티비티를 갱신하고 끝내고 시작합니다. `push: 'token'`(iOS 18에서는 `{ channel }`도)으로
|
|
337
339
|
시작하면 액티비티의 토큰이 `onPushToken`으로, 앱의 push-to-start 토큰(iOS 17.2, 플러그인 설정의
|
|
338
340
|
`pushToStart`)이 `onPushToStartToken`으로, 푸시가 전달한 내용이 `onUpdated`로 옵니다. 페이지가 구독할 때
|
|
339
|
-
플러그인이 이미 쥐고 있던 토큰은 바로 옵니다.
|
|
341
|
+
플러그인이 이미 쥐고 있던 토큰은 바로 옵니다. `pushTarget(event)`는 토큰 이벤트를 서버가 액티비티 키 옆에 둘 JSON으로
|
|
342
|
+
만들고, 서버는 그곳으로 liveactivity의 `push::Message`를 보냅니다
|
|
343
|
+
([서버 푸시](https://github.com/1eedaegon/liveactivity-rs/blob/main/docs/server-push.md)).
|
|
344
|
+
|
|
345
|
+
Android에서는 같은 메시지가 FCM 대상(`{ type: 'fcm', token }`, Firebase Messaging의 토큰)으로 가서, 앱이 돌지 않을
|
|
346
|
+
때도 레이아웃 액티비티를 시작하고 갱신하고 끝냅니다. 플러그인을 기능 `android-push`로 빌드하고, 메시징 서비스의
|
|
347
|
+
데이터 메시지를 `LiveUpdatePush.handle(this, message.data)`에 넘기고, 매니페스트에 앱의 라이브러리 이름을 적습니다.
|
|
348
|
+
푸시마다 한 일은 `onPushed`로 옵니다.
|
|
340
349
|
[더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#pushes)
|
|
341
350
|
|
|
342
351
|
## 기본 부품 너머
|
|
@@ -399,7 +408,8 @@ let starts = Arc::new(Starts::default());
|
|
|
399
408
|
- iOS는 각 액티비티의 마지막 값을 앱의 Application Support에 평문으로 둡니다. 플러그인 설정에
|
|
400
409
|
`"receipts": "redacted"`를 주면 가립니다.
|
|
401
410
|
- 버튼 탭은 Rust `on_action` 핸들러를 최대 4초 기다립니다. JavaScript 리스너는 기다리지 않습니다.
|
|
402
|
-
-
|
|
411
|
+
- Android의 푸시에는 플러그인의 기능 `android-push`, 앱의 FCM 메시징 서비스, 레이아웃 액티비티가 필요합니다. 없으면
|
|
412
|
+
앱이 알림을 직접 갱신합니다.
|
|
403
413
|
- Android 15부터 시계가 14일보다 오래된 타이머는 `INVALID_INPUT`으로 거절됩니다. Android는 그런 알림을 보여 주지
|
|
404
414
|
않고 앱에도 알리지 않습니다.
|
|
405
415
|
- `SYSTEM_LIMIT`은 플랫폼의 한도입니다. Android에서는 살아 있는 액티비티 32개, 1,000,000바이트 저장소가 꽉 찬 경우,
|
|
@@ -443,7 +453,8 @@ WidgetKit, Android Glance 위젯을 그립니다. 이 플러그인은 작업 하
|
|
|
443
453
|
Activity와 Android Live Update를 그립니다. 한 앱에서 둘 다 쓸 수 있습니다.
|
|
444
454
|
|
|
445
455
|
**서버가 활동을 갱신할 수 있나요?** iOS에서는 APNs로 됩니다: 푸시 토큰, iOS 17.2부터 push-to-start, iOS 18부터
|
|
446
|
-
broadcast 채널([푸시
|
|
456
|
+
broadcast 채널([푸시](#푸시)). Android에서는 FCM으로 됩니다: 플러그인의 기능 `android-push`와 앱의 메시징
|
|
457
|
+
서비스가 있으면 됩니다.
|
|
447
458
|
|
|
448
459
|
**macOS, Windows, Linux에서도 되나요?** 아니요. 그곳에서는 활동 명령이 `UNSUPPORTED_PLATFORM`을 돌려주고,
|
|
449
460
|
`getCapabilities()`가 그렇다고 알려 줍니다.
|
package/README.md
CHANGED
|
@@ -271,7 +271,7 @@ await onAction(({ actionId, tap }) => {
|
|
|
271
271
|
On iOS `getCapabilities().ios` says what the iPhone runs (`pushToStart`, `pushChannels`, `transient`,
|
|
272
272
|
`scheduledStart`, `smallFamily`), so a request need not be tried to learn it.
|
|
273
273
|
|
|
274
|
-
On Android a start takes `android: { visibility, publicVersion, placement, wearOngoingActivity, localOnly, targets }`:
|
|
274
|
+
On Android a start takes `android: { visibility, publicVersion, placement, wearOngoingActivity, localOnly, watchMirror, targets }`:
|
|
275
275
|
|
|
276
276
|
```ts
|
|
277
277
|
android: {
|
|
@@ -279,6 +279,7 @@ android: {
|
|
|
279
279
|
placement: 'foreground', // the notification that the app's foreground service holds (`foregroundPlacement`)
|
|
280
280
|
wearOngoingActivity: false, // off the face of a watch (Wear OS 3 to 6; a Tauri app does not run there)
|
|
281
281
|
localOnly: true, // ask Android not to bridge it to a paired watch (`localOnly`)
|
|
282
|
+
// or watchMirror: true, // mirror it to a paired watch instead, never beside localOnly (`watchMirror`)
|
|
282
283
|
// The button `record` runs the app's own service at once, with no screen (`actionTargets`).
|
|
283
284
|
targets: { record: { kind: 'foregroundService', component: 'com.example.RecorderService', action: 'com.example.RECORD' } },
|
|
284
285
|
}
|
|
@@ -334,18 +335,26 @@ On iOS a paired Apple Watch (iOS 18) and CarPlay (iOS 26) show the island's comp
|
|
|
334
335
|
tree of their own, at most 12 nodes without buttons, links or toggles, once the widget extension draws that family
|
|
335
336
|
(`setup --small-family`): `small: hstack([symbol('pawprint.fill'), bound('eta')])`. On Android a phone's ongoing
|
|
336
337
|
notification is not bridged to a paired watch, and a Live Update only to some, which `android: { localOnly: true }`
|
|
337
|
-
asks Android not to do;
|
|
338
|
+
asks Android not to do; `android: { watchMirror: true }` mirrors every snapshot to the watch by a second
|
|
339
|
+
notification that is not ongoing. Android Auto has no place for one. Android names `small` in `degradedFeatures`. [More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#a-watch-and-a-car)
|
|
338
340
|
|
|
339
341
|
On the Lock Screen the card has no margin and shows a narrower layout in its middle: give the root a padding, and a
|
|
340
342
|
node that should reach an edge a style with `frame: { maxWidth: 'infinity', alignment: 'leading' }`.
|
|
341
343
|
[More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#placement-on-the-lock-screen)
|
|
342
344
|
|
|
343
|
-
## Pushes
|
|
345
|
+
## Pushes
|
|
344
346
|
|
|
345
|
-
A server updates, ends or starts activities through APNs. Start with `push: 'token'` (or `{ channel }` on
|
|
346
|
-
and the activity's token comes to `onPushToken`; the app's push-to-start token (iOS 17.2, `pushToStart` in
|
|
347
|
-
plugin configuration) to `onPushToStartToken`; content a push delivered to `onUpdated`. Tokens the plugin
|
|
348
|
-
holds when a page subscribes come at once.
|
|
347
|
+
A server updates, ends or starts activities through APNs on iOS. Start with `push: 'token'` (or `{ channel }` on
|
|
348
|
+
iOS 18) and the activity's token comes to `onPushToken`; the app's push-to-start token (iOS 17.2, `pushToStart` in
|
|
349
|
+
the plugin configuration) to `onPushToStartToken`; content a push delivered to `onUpdated`. Tokens the plugin
|
|
350
|
+
already holds when a page subscribes come at once. `pushTarget(event)` makes of a token's event the JSON the server
|
|
351
|
+
keeps beside the activity's key, and the server sends liveactivity's `push::Message` to it
|
|
352
|
+
([server pushes](https://github.com/1eedaegon/liveactivity-rs/blob/main/docs/server-push.md)).
|
|
353
|
+
|
|
354
|
+
On Android the same message goes to an FCM target (`{ type: 'fcm', token }`, the token of Firebase Messaging) and
|
|
355
|
+
starts, updates or ends a layout activity while the app may not run. Build the plugin with its feature
|
|
356
|
+
`android-push`, hand the data messages of your messaging service to `LiveUpdatePush.handle(this, message.data)`,
|
|
357
|
+
and name your library in the manifest; what each push did comes to `onPushed`.
|
|
349
358
|
[More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#pushes)
|
|
350
359
|
|
|
351
360
|
## Beyond the built-in parts
|
|
@@ -409,7 +418,8 @@ let starts = Arc::new(Starts::default());
|
|
|
409
418
|
- iOS keeps each activity's last values in plain text in the app's Application Support, unless the plugin
|
|
410
419
|
configuration sets `"receipts": "redacted"`.
|
|
411
420
|
- A button's tap waits for the Rust `on_action` handlers, at most 4 seconds; JavaScript listeners are not awaited.
|
|
412
|
-
- Pushes
|
|
421
|
+
- Pushes on Android need the plugin's feature `android-push`, the app's own FCM messaging service and a layout
|
|
422
|
+
activity; without them the app updates its notification itself.
|
|
413
423
|
- From Android 15 a timer whose clock is more than 14 days old is refused with `INVALID_INPUT`: Android would show
|
|
414
424
|
nothing of such a notification and tell the app nothing.
|
|
415
425
|
- `SYSTEM_LIMIT` is the platform's limit: on Android 32 live activities, or no room left in the store of 1,000,000
|
|
@@ -454,7 +464,8 @@ WidgetKit and Android Glance widgets that stay on the home screen. This plugin d
|
|
|
454
464
|
Updates, which follow one task while it runs. An app can use both.
|
|
455
465
|
|
|
456
466
|
**Can a server update an activity?** On iOS, through APNs: push tokens, push-to-start from iOS 17.2 and broadcast
|
|
457
|
-
channels from iOS 18 ([Pushes
|
|
467
|
+
channels from iOS 18 ([Pushes](#pushes)). On Android, through FCM, with the plugin's feature `android-push` and the
|
|
468
|
+
app's messaging service.
|
|
458
469
|
|
|
459
470
|
**Does it work on macOS, Windows or Linux?** No. There the activity commands answer `UNSUPPORTED_PLATFORM`, and
|
|
460
471
|
`getCapabilities()` says so.
|
package/dist-js/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type UnlistenFn } from '@tauri-apps/api/event';
|
|
2
|
-
import type { ActionEvent, ActivityRecord, Capabilities, EndInput, LayoutActivityRecord, LayoutEndInput, LayoutStartInput, LayoutUpdateInput, OpenedEvent, PermissionKind, Permissions, PushToStartTokenEvent, PushTokenEvent, PushTokens, HandledEvent, StartInput, StartedEvent, StateEvent, UnknownEvent, UpdateInput, UpdatedEvent } from './types.js';
|
|
2
|
+
import type { ActionEvent, ActivityRecord, Capabilities, EndInput, LayoutActivityRecord, LayoutEndInput, LayoutStartInput, LayoutUpdateInput, OpenedEvent, PermissionKind, Permissions, PushedEvent, PushTarget, PushToStartTokenEvent, PushTokenEvent, PushTokens, HandledEvent, StartInput, StartedEvent, StateEvent, UnknownEvent, UpdateInput, UpdatedEvent } from './types.js';
|
|
3
3
|
export type * from './types.js';
|
|
4
4
|
/** Builders for the nodes of a layout tree. */
|
|
5
5
|
export * as layout from './layout.js';
|
|
@@ -95,14 +95,22 @@ export declare function onPushToken(handler: (event: PushTokenEvent) => void): P
|
|
|
95
95
|
*/
|
|
96
96
|
export declare function onPushToStartToken(handler: (event: PushToStartTokenEvent) => void): Promise<UnlistenFn>;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* activity's
|
|
98
|
+
* Where the server sends pushes for a token's event: `{ type: 'apnsActivity', token }` for an activity's token of
|
|
99
|
+
* `onPushToken`, which takes its updates and its end, and `{ type: 'apnsPushToStart', token }` for the app's token of
|
|
100
|
+
* `onPushToStartToken`, which takes starts. Send it with the activity's key; the liveactivity crate's `push::Target`
|
|
101
|
+
* reads it on the server.
|
|
102
|
+
*/
|
|
103
|
+
export declare function pushTarget(event: PushTokenEvent | PushToStartTokenEvent): PushTarget;
|
|
104
|
+
/**
|
|
105
|
+
* Receive the record of an activity whose content a push changed (iOS, and Android with the plugin's feature
|
|
106
|
+
* `android-push`): content above every revision this app sent or accepted, so the app's own updates do not come this
|
|
107
|
+
* way. Content pushed before the page listened is in the activity's record, as `listLayout` gives it.
|
|
101
108
|
*/
|
|
102
109
|
export declare function onUpdated(handler: (event: UpdatedEvent) => void): Promise<UnlistenFn>;
|
|
103
110
|
/**
|
|
104
111
|
* Receive the record of a layout activity that began while the app ran (iOS): one the app started, or one a push
|
|
105
|
-
* started with the app's push-to-start token.
|
|
112
|
+
* started with the app's push-to-start token. On Android, with the plugin's feature `android-push`, one that a push
|
|
113
|
+
* from the app's server started. An activity that began before the page listened is in `listLayout`.
|
|
106
114
|
*/
|
|
107
115
|
export declare function onStarted(handler: (event: StartedEvent) => void): Promise<UnlistenFn>;
|
|
108
116
|
/**
|
|
@@ -139,6 +147,13 @@ export declare function onPermissions(handler: (permissions: Permissions) => voi
|
|
|
139
147
|
* earlier version. Earlier versions of the plugin dropped such an event.
|
|
140
148
|
*/
|
|
141
149
|
export declare function onUnknown(handler: (event: UnknownEvent) => void): Promise<UnlistenFn>;
|
|
150
|
+
/**
|
|
151
|
+
* Receive what a push from the app's server did on Android, taken or refused: its key, its command, its revision and
|
|
152
|
+
* the code of a refusal. It comes only to an app built with the plugin's feature `android-push`, whose messaging
|
|
153
|
+
* service hands the server's data messages to `LiveUpdatePush.handle`. A start or an update that was taken also comes
|
|
154
|
+
* to `onStarted` or `onUpdated` after it, with the activity's record, when the plugin's store holds the activity.
|
|
155
|
+
*/
|
|
156
|
+
export declare function onPushed(handler: (event: PushedEvent) => void): Promise<UnlistenFn>;
|
|
142
157
|
/**
|
|
143
158
|
* Receive a tap that the target of its action ran, and that the app's own component (a service or a receiver) took
|
|
144
159
|
* with `LiveUpdateActions.take` (Android). The component acted on it, so it is no tap for `onAction`: this says
|
package/dist-js/index.js
CHANGED
|
@@ -154,6 +154,17 @@ export async function onPushToStartToken(handler) {
|
|
|
154
154
|
deliver({ token: held.pushToStart });
|
|
155
155
|
return unlisten;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Where the server sends pushes for a token's event: `{ type: 'apnsActivity', token }` for an activity's token of
|
|
159
|
+
* `onPushToken`, which takes its updates and its end, and `{ type: 'apnsPushToStart', token }` for the app's token of
|
|
160
|
+
* `onPushToStartToken`, which takes starts. Send it with the activity's key; the liveactivity crate's `push::Target`
|
|
161
|
+
* reads it on the server.
|
|
162
|
+
*/
|
|
163
|
+
export function pushTarget(event) {
|
|
164
|
+
return 'activityId' in event
|
|
165
|
+
? { type: 'apnsActivity', token: event.token }
|
|
166
|
+
: { type: 'apnsPushToStart', token: event.token };
|
|
167
|
+
}
|
|
157
168
|
/** What the plugin holds, or the subscription given up and the failure passed on. */
|
|
158
169
|
async function heldTokens(unlisten) {
|
|
159
170
|
try {
|
|
@@ -165,16 +176,17 @@ async function heldTokens(unlisten) {
|
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
178
|
/**
|
|
168
|
-
* Receive the record of an activity whose content a push changed (iOS
|
|
169
|
-
* or accepted, so the app's own updates do not come this
|
|
170
|
-
* activity's record, as `listLayout` gives it.
|
|
179
|
+
* Receive the record of an activity whose content a push changed (iOS, and Android with the plugin's feature
|
|
180
|
+
* `android-push`): content above every revision this app sent or accepted, so the app's own updates do not come this
|
|
181
|
+
* way. Content pushed before the page listened is in the activity's record, as `listLayout` gives it.
|
|
171
182
|
*/
|
|
172
183
|
export function onUpdated(handler) {
|
|
173
184
|
return listen('live-activity://updated', event => handler(event.payload));
|
|
174
185
|
}
|
|
175
186
|
/**
|
|
176
187
|
* Receive the record of a layout activity that began while the app ran (iOS): one the app started, or one a push
|
|
177
|
-
* started with the app's push-to-start token.
|
|
188
|
+
* started with the app's push-to-start token. On Android, with the plugin's feature `android-push`, one that a push
|
|
189
|
+
* from the app's server started. An activity that began before the page listened is in `listLayout`.
|
|
178
190
|
*/
|
|
179
191
|
export function onStarted(handler) {
|
|
180
192
|
return listen('live-activity://started', event => handler(event.payload));
|
|
@@ -312,6 +324,15 @@ export function onPermissions(handler) {
|
|
|
312
324
|
export function onUnknown(handler) {
|
|
313
325
|
return listen('live-activity://unknown', event => handler(event.payload));
|
|
314
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Receive what a push from the app's server did on Android, taken or refused: its key, its command, its revision and
|
|
329
|
+
* the code of a refusal. It comes only to an app built with the plugin's feature `android-push`, whose messaging
|
|
330
|
+
* service hands the server's data messages to `LiveUpdatePush.handle`. A start or an update that was taken also comes
|
|
331
|
+
* to `onStarted` or `onUpdated` after it, with the activity's record, when the plugin's store holds the activity.
|
|
332
|
+
*/
|
|
333
|
+
export function onPushed(handler) {
|
|
334
|
+
return listen('live-activity://pushed', event => handler(event.payload));
|
|
335
|
+
}
|
|
315
336
|
/**
|
|
316
337
|
* Receive a tap that the target of its action ran, and that the app's own component (a service or a receiver) took
|
|
317
338
|
* with `LiveUpdateActions.take` (Android). The component acted on it, so it is no tap for `onAction`: this says
|
|
@@ -16,7 +16,11 @@ export interface SessionOptions {
|
|
|
16
16
|
readonly android?: LayoutAndroidOptions;
|
|
17
17
|
/** Read at start: what only iOS reads, such as a transient activity. */
|
|
18
18
|
readonly ios?: LayoutIosOptions;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Read at start: what the activity asks ActivityKit for, a push token or a channel (iOS). It also makes the hook take
|
|
21
|
+
* pushed content: on Android, where the start ignores the member, give `'token'` to an activity that the app's server
|
|
22
|
+
* pushes to (the plugin's feature `android-push`).
|
|
23
|
+
*/
|
|
20
24
|
readonly push?: LayoutPush;
|
|
21
25
|
/** False ends the activity, and true starts it again. Defaults to true. */
|
|
22
26
|
readonly enabled?: boolean;
|
package/dist-js/types.d.ts
CHANGED
|
@@ -17,7 +17,10 @@ export interface Capabilities {
|
|
|
17
17
|
readonly nativeLiveActivity: FeatureSupport;
|
|
18
18
|
/** Layout activities of request contract v2. */
|
|
19
19
|
readonly layout: FeatureSupport;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Pushes: tokens, channels and push-to-start on iOS; on Android, layout activities by FCM where the app built the
|
|
22
|
+
* plugin's feature `android-push` and the device's liveupdate offers `pushLayer`.
|
|
23
|
+
*/
|
|
21
24
|
readonly push: FeatureSupport;
|
|
22
25
|
readonly maxPayloadBytes: number;
|
|
23
26
|
/**
|
|
@@ -91,6 +94,23 @@ export interface AndroidPresentationSupport {
|
|
|
91
94
|
* nothing.
|
|
92
95
|
*/
|
|
93
96
|
readonly localOnly: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Whether liveupdate's push path is in the app's Android library: a data message from the app's server, handed
|
|
99
|
+
* over by `LiveUpdatePush.handle`, reaches liveupdate while the app does not run (liveupdate 0.10).
|
|
100
|
+
*/
|
|
101
|
+
readonly push: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether that path hands a message's member `liveupdate.layer` to the plugin's layout activities (liveupdate
|
|
104
|
+
* 0.12). The capability `push` is `supported` on Android only where this is true and the app built the plugin with
|
|
105
|
+
* its feature `android-push`.
|
|
106
|
+
*/
|
|
107
|
+
readonly pushLayer: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether an activity can be mirrored to a paired watch (a start's `android.watchMirror`, an Android content's
|
|
110
|
+
* `presentation.watchMirror`). Where it is false such a start or update answers `UNSUPPORTED_FEATURE` and posts
|
|
111
|
+
* nothing.
|
|
112
|
+
*/
|
|
113
|
+
readonly watchMirror: boolean;
|
|
94
114
|
}
|
|
95
115
|
/** What an iPhone runs of the features after the first Live Activities. */
|
|
96
116
|
export interface IosSupport {
|
|
@@ -307,6 +327,13 @@ export interface AndroidPresentation {
|
|
|
307
327
|
* (`localOnly` in the capabilities) answers `UNSUPPORTED_FEATURE` and posts nothing.
|
|
308
328
|
*/
|
|
309
329
|
readonly localOnly?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* `true`: this snapshot is mirrored to a paired watch by a second notification, which is not ongoing, so the
|
|
332
|
+
* watch's bridge takes it; the activity's own notification stays on the phone. Absent, the watch gets no mirror
|
|
333
|
+
* unless the start asks for one (`android.watchMirror`). Not beside `localOnly`: `INVALID_INPUT`. A device that does
|
|
334
|
+
* not offer it (`watchMirror` in the capabilities) answers `UNSUPPORTED_FEATURE` and posts nothing.
|
|
335
|
+
*/
|
|
336
|
+
readonly watchMirror?: boolean;
|
|
310
337
|
}
|
|
311
338
|
export type AndroidStyle = {
|
|
312
339
|
readonly kind: 'standard';
|
|
@@ -595,8 +622,9 @@ type NodeFields = {
|
|
|
595
622
|
/** How the node comes and goes when its `if` or `unless` shows or hides it. Without it the system chooses. */
|
|
596
623
|
readonly transition?: LayoutTransition;
|
|
597
624
|
/**
|
|
598
|
-
* `sensitive` marks what the node and its subtree show as private
|
|
599
|
-
*
|
|
625
|
+
* `sensitive` marks what the node and its subtree show as private, for SwiftUI's `privacySensitive()`. It is no
|
|
626
|
+
* promise that iOS hides it: an iPhone 16 with iOS 27.2.1 showed such a node on its locked Lock Screen. Keep what no
|
|
627
|
+
* one else may see out of an activity.
|
|
600
628
|
*/
|
|
601
629
|
readonly privacy?: 'sensitive';
|
|
602
630
|
} & ({
|
|
@@ -861,6 +889,13 @@ export interface LayoutAndroidOptions {
|
|
|
861
889
|
* capabilities) answers `UNSUPPORTED_FEATURE` and posts nothing; iOS ignores it.
|
|
862
890
|
*/
|
|
863
891
|
readonly localOnly?: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* `true`: every snapshot of the activity is mirrored to a paired watch by a second notification, which is not
|
|
894
|
+
* ongoing, so the watch's bridge takes it, whatever an Android content says. Absent, no mirror unless a content asks
|
|
895
|
+
* for one. Not beside `localOnly`: `INVALID_INPUT`. A device that does not offer it (`watchMirror` in the
|
|
896
|
+
* capabilities) answers `UNSUPPORTED_FEATURE` and posts nothing; iOS ignores it.
|
|
897
|
+
*/
|
|
898
|
+
readonly watchMirror?: boolean;
|
|
864
899
|
/**
|
|
865
900
|
* What runs the tap of a button or a toggle of the lock screen tree, by its `actionId`: a service or a receiver
|
|
866
901
|
* of the app (`actionTargets`). Each key names a control of the tree, else `INVALID_INPUT` on every platform. iOS
|
|
@@ -1048,6 +1083,41 @@ export interface HandledEvent {
|
|
|
1048
1083
|
/** The stored tap's sequence and time. */
|
|
1049
1084
|
readonly tap?: Tap;
|
|
1050
1085
|
}
|
|
1086
|
+
/**
|
|
1087
|
+
* What a push from the app's server did (Android, with the plugin's feature `android-push`): liveupdate's push path
|
|
1088
|
+
* ran it while the app may not have run, and the plugin reports it at its next look. A push is taken or refused as
|
|
1089
|
+
* the call it stands for.
|
|
1090
|
+
*/
|
|
1091
|
+
export interface PushedEvent {
|
|
1092
|
+
/** Handle of the activity the push acted on; absent when it named no live activity. */
|
|
1093
|
+
readonly activityId?: string;
|
|
1094
|
+
/** The key the push named. */
|
|
1095
|
+
readonly activityKey: string;
|
|
1096
|
+
/** What the push asked for. */
|
|
1097
|
+
readonly command: 'start' | 'update' | 'end';
|
|
1098
|
+
/** The revision of the push's snapshot; absent for an end. */
|
|
1099
|
+
readonly revision?: number;
|
|
1100
|
+
/** Why the push was refused, an error code of the contract; absent when it did what it asked. */
|
|
1101
|
+
readonly code?: string;
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Where a server sends pushes: the JSON that the app hands its server beside an activity's key, which the liveactivity
|
|
1105
|
+
* crate's `push::Target` reads on the server. `pushTarget` makes the APNs ones of a token's event; the app makes the
|
|
1106
|
+
* FCM one of the token that Firebase Messaging gives it, and the channel one of a channel its server made.
|
|
1107
|
+
*/
|
|
1108
|
+
export type PushTarget = {
|
|
1109
|
+
readonly type: 'apnsActivity';
|
|
1110
|
+
readonly token: string;
|
|
1111
|
+
} | {
|
|
1112
|
+
readonly type: 'apnsPushToStart';
|
|
1113
|
+
readonly token: string;
|
|
1114
|
+
} | {
|
|
1115
|
+
readonly type: 'apnsChannel';
|
|
1116
|
+
readonly channel: string;
|
|
1117
|
+
} | {
|
|
1118
|
+
readonly type: 'fcm';
|
|
1119
|
+
readonly token: string;
|
|
1120
|
+
};
|
|
1051
1121
|
/**
|
|
1052
1122
|
* Something that Android stored for an activity and this version has no event for (Android): liveupdate read what
|
|
1053
1123
|
* it knows of it, which is the activity. It comes when the stored events are of a later version of the plugin than
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tauri-plugin-live-activity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@tauri-apps/cli": "2.12.4",
|
|
56
56
|
"@tauri-apps/api": "2.12.4",
|
|
57
|
+
"@tauri-apps/plugin-geolocation": "2.5.0",
|
|
57
58
|
"@types/node": "22.20.5",
|
|
58
59
|
"@types/react": "19.3.0",
|
|
59
60
|
"@types/react-dom": "19.3.0",
|