tauri-plugin-live-activity 0.13.2 → 0.15.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 +55 -5
- package/README.md +55 -5
- package/cli/setup.mjs +4 -4
- package/dist-js/index.d.ts +13 -0
- package/dist-js/index.js +15 -0
- package/dist-js/jsx/index.js +2 -1
- package/dist-js/layout.js +2 -2
- package/dist-js/types.d.ts +28 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -52,9 +52,10 @@ TypeScript 또는 Rust로 적고, 그리는 일은 플러그인이 [liveactivity
|
|
|
52
52
|
| --- | --- | --- |
|
|
53
53
|
| iPhone | iOS 16.1 | 잠금 화면의 Live Activity, Dynamic Island가 있는 iPhone에서는 Dynamic Island에도. 오래된 표시(stale)와 relevance는 iOS 16.2부터, 버튼·토글·push-to-start는 iOS 17.2부터 |
|
|
54
54
|
| iPad | iPadOS 17 | 잠금 화면의 같은 Live Activity |
|
|
55
|
+
| StandBy | iOS 17 | 옆으로 눕혀 충전하는 iPhone에서 크게 보이는 잠금 화면 카드, `ifFullscreen` 노드가 여기에만 보임 |
|
|
55
56
|
| Apple Watch | iOS 18과 watchOS 11 | 레이아웃의 `small` 영역이 워치의 Smart Stack에 |
|
|
56
57
|
| Android | Android 8.0 (API 26) | 진행률 막대나 타이머, 동작 최대 세 개가 있는 진행 중 알림. 알림 권한은 Android 13 (API 33)부터 묻습니다 |
|
|
57
|
-
| Android Live Updates | Android 16 (API 36) | 시스템과 사용자 설정이 허락하면 승격된 Live Update, 아니면 진행 중
|
|
58
|
+
| Android Live Updates | Android 16 (API 36) | 시스템과 사용자 설정이 허락하면 승격된 Live Update, 아니면 진행 중 알림; `openPromotionSettings()`가 그 설정을 엶 |
|
|
58
59
|
| Samsung Now Bar | Android 17 (API 37), One UI 9 | One UI의 Now Bar가 보여 주는 제목과 본문. Samsung의 허용 목록에 있는 앱만 |
|
|
59
60
|
| macOS, Windows, Linux | 지원 안 함 | 활동이 없고, 활동 명령은 `UNSUPPORTED_PLATFORM`을 돌려줍니다 |
|
|
60
61
|
|
|
@@ -84,7 +85,8 @@ liveactivity liveactivity-rs 브리지: 하나의 요청 계약,
|
|
|
84
85
|
진행 중 알림, Android 16부터 Live Update
|
|
85
86
|
```
|
|
86
87
|
|
|
87
|
-
플러그인 자체의 Swift 코드는 없고, Kotlin은 권한 명령과 liveupdate의 Android 어댑터 호출만 맡습니다.
|
|
88
|
+
플러그인 자체의 Swift 코드는 없고, Kotlin은 권한 명령과 liveupdate의 Android 어댑터 호출만 맡습니다. 플러그인
|
|
89
|
+
아래의 백엔드는 바꾸거나 층으로 감쌀 수 있습니다: [직접 만든 백엔드](#직접-만든-백엔드).
|
|
88
90
|
[iOS 설정](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/ios-integration.md)과
|
|
89
91
|
[Android 설정](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/android-integration.md)이
|
|
90
92
|
`setup`이 각 프로젝트에서 바꾸는 것을 보여 줍니다.
|
|
@@ -262,13 +264,14 @@ await onAction(({ actionId, tap }) => {
|
|
|
262
264
|
iOS에서는 `getCapabilities().ios`가 아이폰이 실행하는 기능(`pushToStart`, `pushChannels`, `transient`,
|
|
263
265
|
`scheduledStart`, `smallFamily`)을 알려 주므로 요청을 시도해 보지 않아도 됩니다.
|
|
264
266
|
|
|
265
|
-
Android에서는 시작에 `android: { visibility, publicVersion, placement, wearOngoingActivity, targets }`를 줍니다:
|
|
267
|
+
Android에서는 시작에 `android: { visibility, publicVersion, placement, wearOngoingActivity, localOnly, targets }`를 줍니다:
|
|
266
268
|
|
|
267
269
|
```ts
|
|
268
270
|
android: {
|
|
269
271
|
visibility: 'public', // 잠긴 기기에 보이는 정도: 'public', 'private', 'secret'
|
|
270
272
|
placement: 'foreground', // 앱의 포그라운드 서비스가 쥐는 알림(`foregroundPlacement`)
|
|
271
273
|
wearOngoingActivity: false, // 워치 화면에서 뺌(Wear OS 3~6, Tauri 앱은 워치에서 돌지 않음)
|
|
274
|
+
localOnly: true, // 페어링된 워치로 넘기지 말라고 Android에 요청(`localOnly`)
|
|
272
275
|
// 버튼 `record`의 탭이 화면 없이 앱의 서비스를 바로 실행(`actionTargets`).
|
|
273
276
|
targets: { record: { kind: 'foregroundService', component: 'com.example.RecorderService', action: 'com.example.RECORD' } },
|
|
274
277
|
}
|
|
@@ -321,8 +324,8 @@ keyline: '#A3D9C2', // 아일랜드 테두리 색
|
|
|
321
324
|
iOS에서는 페어링된 Apple Watch(iOS 18)와 CarPlay(iOS 26)가 아일랜드의 compact 부분을 보여 줍니다. 위젯
|
|
322
325
|
익스텐션이 그 패밀리를 그리도록 해 두면(`setup --small-family`) `small`이 거기에 자기 트리를 줍니다. 노드는
|
|
323
326
|
12개까지이고 버튼·링크·토글은 넣을 수 없습니다: `small: hstack([symbol('pawprint.fill'), bound('eta')])`.
|
|
324
|
-
Android에서는 폰의 ongoing 알림이 페어링된 워치로 전달되지 않고 Live Update만 일부 워치에
|
|
325
|
-
Auto에는 이를 보여 줄 자리가 없습니다. Android는 `small`을 `degradedFeatures`에 적습니다. [더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#a-watch-and-a-car)
|
|
327
|
+
Android에서는 폰의 ongoing 알림이 페어링된 워치로 전달되지 않고 Live Update만 일부 워치에 전달됩니다.
|
|
328
|
+
`android: { localOnly: true }`는 그것도 하지 말라고 Android에 요청합니다. Android Auto에는 이를 보여 줄 자리가 없습니다. Android는 `small`을 `degradedFeatures`에 적습니다. [더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#a-watch-and-a-car)
|
|
326
329
|
|
|
327
330
|
잠금 화면의 카드에는 여백이 없고, 더 좁은 레이아웃은 가운데에 놓입니다. 루트에 padding을 주고, 가장자리에 붙일
|
|
328
331
|
노드에는 `frame: { maxWidth: 'infinity', alignment: 'leading' }`인 스타일을 줍니다.
|
|
@@ -345,6 +348,49 @@ Auto에는 이를 보여 줄 자리가 없습니다. Android는 `small`을 `degr
|
|
|
345
348
|
덮어쓰지 않으며, `custom('ring', { props: { level: bind('done') } })`으로 놓습니다. 그린 PNG는 최대 1 MiB,
|
|
346
349
|
1224 × 480 픽셀입니다. [더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#beyond-the-built-in-parts)
|
|
347
350
|
|
|
351
|
+
## 직접 만든 백엔드
|
|
352
|
+
|
|
353
|
+
`init()`은 `Builder::new().build()`이고, 플랫폼 백엔드 위에서 돕니다: iOS는 ActivityKit, Android는 liveupdate.
|
|
354
|
+
`Builder::layer`는 그 위에 층을 씌웁니다. Android가 레이아웃에서 빼는 것을 그리는 렌더러, 로그, 시험용 대역 같은
|
|
355
|
+
것입니다. `BackendLayer`는 바꾸는 호출만 덮어쓰고, 나머지 호출은 그대로 아래 백엔드로 갑니다. 그래서 메서드를
|
|
356
|
+
빠뜨려도 기능이 꺼지지 않습니다. 탭을 지켜보는 층은 `attach`가 넘기는 `BackendContext`를 감쌉니다.
|
|
357
|
+
|
|
358
|
+
`Builder::backend`는 플랫폼 백엔드 자리에 직접 만든 백엔드를 넣습니다(예를 들어 데스크톱). 층은 그 위에 씌워집니다.
|
|
359
|
+
이때 플랫폼 백엔드는 만들어지지 않습니다. 다만 Android에서는 정확한 알람 설정을 열기 위해 계속 만들어집니다. iOS에서는
|
|
360
|
+
플러그인이 kit을 만들지 않으므로, 설정의 `receipts`와 `pushToStart`는 직접 만든 백엔드가 지켜야 합니다. 직접 만든
|
|
361
|
+
백엔드는 liveactivity-rs 브리지의 인터페이스인 `LiveActivityBackend`를 구현하고, 탭을 비롯한 이벤트를 `attach`에서
|
|
362
|
+
받은 컨텍스트로 보냅니다. 플러그인은 `sync_events`를 부르지 않습니다. liveactivity의 `testkit` 기능(`conformance`)으로
|
|
363
|
+
백엔드가 계약을 지키는지 확인할 수 있습니다. 어느 쪽이든 Tauri 쪽인 명령, 이벤트, `live-activity:` 권한은 플러그인이
|
|
364
|
+
계속 맡습니다.
|
|
365
|
+
|
|
366
|
+
```rust
|
|
367
|
+
use std::sync::Arc;
|
|
368
|
+
use std::sync::atomic::{AtomicUsize, Ordering};
|
|
369
|
+
use tauri_plugin_live_activity::{
|
|
370
|
+
BackendFuture, BackendLayer, Builder, LayoutActivityRecord, LayoutStartInput, LiveActivityBackend,
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
/// 시작하는 레이아웃 활동을 셉니다. 나머지 호출은 그대로 넘어갑니다.
|
|
374
|
+
#[derive(Default)]
|
|
375
|
+
struct Starts(AtomicUsize);
|
|
376
|
+
|
|
377
|
+
impl BackendLayer for Starts {
|
|
378
|
+
fn start_layout<'a>(
|
|
379
|
+
&'a self,
|
|
380
|
+
input: LayoutStartInput,
|
|
381
|
+
next: &'a dyn LiveActivityBackend,
|
|
382
|
+
) -> BackendFuture<'a, LayoutActivityRecord> {
|
|
383
|
+
self.0.fetch_add(1, Ordering::Relaxed);
|
|
384
|
+
next.start_layout(input)
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// 앱의 빌더에서 `.plugin(tauri_plugin_live_activity::init())` 대신 씁니다. 수는 핸들로 읽습니다:
|
|
389
|
+
// `starts.0.load(Ordering::Relaxed)`.
|
|
390
|
+
let starts = Arc::new(Starts::default());
|
|
391
|
+
// .plugin(Builder::new().layer(starts.clone()).build())
|
|
392
|
+
```
|
|
393
|
+
|
|
348
394
|
## 제약
|
|
349
395
|
|
|
350
396
|
- iOS: iOS 16.1의 iPhone 또는 iPadOS 17의 iPad, 버튼과 토글은 iOS 17.2부터. iOS 16.1에는 stale 날짜와 relevance 점수가
|
|
@@ -388,6 +434,10 @@ Live Update를 요청하고, 그 밖에는 Android 8.0 (API 26)부터 같은 요
|
|
|
388
434
|
**liveactivity-rs가 뭔가요?** 이 플러그인이 올라선 Rust 브리지, `liveactivity` 크레이트입니다. 요청 계약과 수명
|
|
389
435
|
주기를 맡고, iOS는 activitykit-rs, Android는 liveupdate-rs 위에서 돌립니다([동작 구조](#동작-구조)).
|
|
390
436
|
|
|
437
|
+
**백엔드를 바꾸거나 덧붙일 수 있나요?** 네. `Builder::layer`는 플랫폼 백엔드 위에 렌더러, 로그, 시험용 대역 같은
|
|
438
|
+
층을 씌우고, `Builder::backend`는 그 자리에 직접 만든 백엔드를 넣습니다. 둘 다 liveactivity-rs 브리지의
|
|
439
|
+
`LiveActivityBackend` 인터페이스를 씁니다([직접 만든 백엔드](#직접-만든-백엔드)).
|
|
440
|
+
|
|
391
441
|
**홈 화면 위젯 플러그인과 무엇이 다른가요?** tauri-plugin-widgets 같은 위젯 플러그인은 홈 화면에 계속 머무는
|
|
392
442
|
WidgetKit, Android Glance 위젯을 그립니다. 이 플러그인은 작업 하나가 진행되는 동안 그 작업을 따라가는 Live
|
|
393
443
|
Activity와 Android Live Update를 그립니다. 한 앱에서 둘 다 쓸 수 있습니다.
|
package/README.md
CHANGED
|
@@ -52,9 +52,10 @@ In short: iOS 16.1+ and Android 8+, and no activities on desktop.
|
|
|
52
52
|
| --- | --- | --- |
|
|
53
53
|
| iPhone | iOS 16.1 | Live Activities on the Lock Screen and, on iPhones that have one, in the Dynamic Island. Stale dates and relevance from iOS 16.2; buttons, toggles and push-to-start from iOS 17.2 |
|
|
54
54
|
| iPad | iPadOS 17 | The same Live Activities on the Lock Screen |
|
|
55
|
+
| StandBy | iOS 17 | The Lock Screen card scaled up on an iPhone that charges on its side, where nodes with `ifFullscreen` show |
|
|
55
56
|
| Apple Watch | iOS 18 with watchOS 11 | A layout's `small` region in the watch's Smart Stack |
|
|
56
57
|
| Android | Android 8.0 (API 26) | An ongoing notification with a progress bar or a timer and up to three actions; the notification permission is asked from Android 13 (API 33) |
|
|
57
|
-
| Android Live Updates | Android 16 (API 36) | A promoted Live Update where the system and the person's settings allow one, the ongoing notification otherwise |
|
|
58
|
+
| Android Live Updates | Android 16 (API 36) | A promoted Live Update where the system and the person's settings allow one, the ongoing notification otherwise; `openPromotionSettings()` opens that setting |
|
|
58
59
|
| Samsung Now Bar | Android 17 (API 37), One UI 9 | The title and body that One UI's Now Bar shows, for apps on Samsung's allow list |
|
|
59
60
|
| macOS, Windows, Linux | not supported | No activities: the activity commands answer `UNSUPPORTED_PLATFORM` |
|
|
60
61
|
|
|
@@ -85,7 +86,7 @@ liveactivity the liveactivity-rs bridge: one request contract,
|
|
|
85
86
|
```
|
|
86
87
|
|
|
87
88
|
The plugin has no Swift of its own; its Kotlin answers the permission commands and carries liveupdate's Android
|
|
88
|
-
adapter. [iOS setup](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/ios-integration.md) and
|
|
89
|
+
adapter. The backend under the plugin can be replaced, or wrapped in layers: see [Your own backend](#your-own-backend). [iOS setup](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/ios-integration.md) and
|
|
89
90
|
[Android setup](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/android-integration.md) show
|
|
90
91
|
what `setup` changes in each project.
|
|
91
92
|
|
|
@@ -270,13 +271,14 @@ await onAction(({ actionId, tap }) => {
|
|
|
270
271
|
On iOS `getCapabilities().ios` says what the iPhone runs (`pushToStart`, `pushChannels`, `transient`,
|
|
271
272
|
`scheduledStart`, `smallFamily`), so a request need not be tried to learn it.
|
|
272
273
|
|
|
273
|
-
On Android a start takes `android: { visibility, publicVersion, placement, wearOngoingActivity, targets }`:
|
|
274
|
+
On Android a start takes `android: { visibility, publicVersion, placement, wearOngoingActivity, localOnly, targets }`:
|
|
274
275
|
|
|
275
276
|
```ts
|
|
276
277
|
android: {
|
|
277
278
|
visibility: 'public', // what a locked device shows: 'public', 'private' or 'secret'
|
|
278
279
|
placement: 'foreground', // the notification that the app's foreground service holds (`foregroundPlacement`)
|
|
279
280
|
wearOngoingActivity: false, // off the face of a watch (Wear OS 3 to 6; a Tauri app does not run there)
|
|
281
|
+
localOnly: true, // ask Android not to bridge it to a paired watch (`localOnly`)
|
|
280
282
|
// The button `record` runs the app's own service at once, with no screen (`actionTargets`).
|
|
281
283
|
targets: { record: { kind: 'foregroundService', component: 'com.example.RecorderService', action: 'com.example.RECORD' } },
|
|
282
284
|
}
|
|
@@ -331,8 +333,8 @@ keyline: '#A3D9C2', // the island's edge color
|
|
|
331
333
|
On iOS a paired Apple Watch (iOS 18) and CarPlay (iOS 26) show the island's compact parts. `small` gives them a
|
|
332
334
|
tree of their own, at most 12 nodes without buttons, links or toggles, once the widget extension draws that family
|
|
333
335
|
(`setup --small-family`): `small: hstack([symbol('pawprint.fill'), bound('eta')])`. On Android a phone's ongoing
|
|
334
|
-
notification is not bridged to a paired watch, and a Live Update only to some
|
|
335
|
-
Android names `small` in `degradedFeatures`. [More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#a-watch-and-a-car)
|
|
336
|
+
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; 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)
|
|
336
338
|
|
|
337
339
|
On the Lock Screen the card has no margin and shows a narrower layout in its middle: give the root a padding, and a
|
|
338
340
|
node that should reach an edge a style with `frame: { maxWidth: 'infinity', alignment: 'leading' }`.
|
|
@@ -355,6 +357,50 @@ A view of your own is SwiftUI in `gen/apple/LiveActivityWidget/LiveActivityCusto
|
|
|
355
357
|
creates once and never overwrites, placed with `custom('ring', { props: { level: bind('done') } })`. A drawn PNG is
|
|
356
358
|
at most 1 MiB and 1224 × 480 pixels. [More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#beyond-the-built-in-parts)
|
|
357
359
|
|
|
360
|
+
## Your own backend
|
|
361
|
+
|
|
362
|
+
`init()` is `Builder::new().build()`, on the platform's backend: ActivityKit on iOS and liveupdate on Android.
|
|
363
|
+
`Builder::layer` puts a layer over it, such as a renderer of what Android leaves out of a layout, a log or a stand-in
|
|
364
|
+
for tests. A `BackendLayer` overrides the calls it changes, and every other call goes to the backend under it, so a
|
|
365
|
+
layer never turns a feature off by leaving a method out; one that watches the taps wraps the `BackendContext` that
|
|
366
|
+
`attach` passes on.
|
|
367
|
+
|
|
368
|
+
`Builder::backend` puts a backend of your own in the platform's place, for example on desktop, and the layers go over
|
|
369
|
+
it. The platform's backend is then not built, except on Android, where it still opens the setting for exact alarms;
|
|
370
|
+
on iOS the plugin then builds no kit, so the configuration's `receipts` and `pushToStart` are your backend's to keep.
|
|
371
|
+
Your backend implements `LiveActivityBackend`, the interface of the liveactivity-rs bridge, and sends its events,
|
|
372
|
+
taps among them, through the context it gets in `attach`; the plugin calls no `sync_events`. liveactivity's `testkit`
|
|
373
|
+
feature checks a backend against the contract (`conformance`). The plugin keeps its Tauri side around either: the
|
|
374
|
+
commands, the events and the `live-activity:` permissions.
|
|
375
|
+
|
|
376
|
+
```rust
|
|
377
|
+
use std::sync::Arc;
|
|
378
|
+
use std::sync::atomic::{AtomicUsize, Ordering};
|
|
379
|
+
use tauri_plugin_live_activity::{
|
|
380
|
+
BackendFuture, BackendLayer, Builder, LayoutActivityRecord, LayoutStartInput, LiveActivityBackend,
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
/// Counts the layout activities that start; every other call goes on unchanged.
|
|
384
|
+
#[derive(Default)]
|
|
385
|
+
struct Starts(AtomicUsize);
|
|
386
|
+
|
|
387
|
+
impl BackendLayer for Starts {
|
|
388
|
+
fn start_layout<'a>(
|
|
389
|
+
&'a self,
|
|
390
|
+
input: LayoutStartInput,
|
|
391
|
+
next: &'a dyn LiveActivityBackend,
|
|
392
|
+
) -> BackendFuture<'a, LayoutActivityRecord> {
|
|
393
|
+
self.0.fetch_add(1, Ordering::Relaxed);
|
|
394
|
+
next.start_layout(input)
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// In the builder of the app, in place of `.plugin(tauri_plugin_live_activity::init())`, with a handle to read the
|
|
399
|
+
// count by, `starts.0.load(Ordering::Relaxed)`:
|
|
400
|
+
let starts = Arc::new(Starts::default());
|
|
401
|
+
// .plugin(Builder::new().layer(starts.clone()).build())
|
|
402
|
+
```
|
|
403
|
+
|
|
358
404
|
## Limits
|
|
359
405
|
|
|
360
406
|
- iOS: an iPhone with iOS 16.1 or an iPad with iPadOS 17; buttons and toggles need iOS 17.2. iOS 16.1 has no stale date and no
|
|
@@ -399,6 +445,10 @@ plugin and its crates. A view of your own can still be SwiftUI ([Beyond the buil
|
|
|
399
445
|
**What is liveactivity-rs?** The Rust bridge this plugin is built on, the `liveactivity` crate. It owns the request
|
|
400
446
|
contract and the lifecycle, and runs iOS on activitykit-rs and Android on liveupdate-rs ([How it works](#how-it-works)).
|
|
401
447
|
|
|
448
|
+
**Can I replace the backend, or add to it?** Yes. `Builder::layer` puts a layer over the platform's backend, such as
|
|
449
|
+
a renderer, a log or a stand-in for tests, and `Builder::backend` puts a backend of your own in its place. Both use
|
|
450
|
+
the liveactivity-rs bridge's `LiveActivityBackend` interface ([Your own backend](#your-own-backend)).
|
|
451
|
+
|
|
402
452
|
**How is it different from a home-screen widget plugin?** Widget plugins such as tauri-plugin-widgets draw
|
|
403
453
|
WidgetKit and Android Glance widgets that stay on the home screen. This plugin draws Live Activities and Android Live
|
|
404
454
|
Updates, which follow one task while it runs. An app can use both.
|
package/cli/setup.mjs
CHANGED
|
@@ -11,13 +11,13 @@ export const CRATE = 'tauri-plugin-live-activity';
|
|
|
11
11
|
/** The crate whose Swift package the widget extension and the app target link. */
|
|
12
12
|
export const ACTIVITYKIT = 'activitykit';
|
|
13
13
|
/**
|
|
14
|
-
* `default` reads; the others allow the commands that change activities, and the
|
|
15
|
-
* Android's dialog,
|
|
14
|
+
* `default` reads; the others allow the commands that change activities, and the three that ask the person: with
|
|
15
|
+
* Android's dialog, in its setting for exact alarms, and in its screen of Live Updates.
|
|
16
16
|
*/
|
|
17
17
|
export const PERMISSIONS = [
|
|
18
18
|
'live-activity:default',
|
|
19
|
-
...['request-permissions', 'open-exact-alarm-settings', 'start', 'update', 'end', 'start-layout',
|
|
20
|
-
'write-image']
|
|
19
|
+
...['request-permissions', 'open-exact-alarm-settings', 'open-promotion-settings', 'start', 'update', 'end', 'start-layout',
|
|
20
|
+
'update-layout', 'end-layout', 'write-image']
|
|
21
21
|
.map(command => `live-activity:allow-${command}`),
|
|
22
22
|
];
|
|
23
23
|
// The plugin's Android library needs API 26: Tauri's Jackson runtime fails below it.
|
package/dist-js/index.d.ts
CHANGED
|
@@ -27,6 +27,19 @@ export declare function requestPermissions(kind: PermissionKind): Promise<Permis
|
|
|
27
27
|
* promise alone. The command needs its own grant, `live-activity:allow-open-exact-alarm-settings`.
|
|
28
28
|
*/
|
|
29
29
|
export declare function openExactAlarmSettings(): Promise<Capabilities>;
|
|
30
|
+
/**
|
|
31
|
+
* Ask Android for the screen where the person allows or stops the app's Live Updates (Android 16 and later), or for
|
|
32
|
+
* the app's notification settings before that: for an app whose `checkPermissions()` reads
|
|
33
|
+
* `promotion: 'settingsRequired'`, Android having no dialog for them. That state is also a channel that the person
|
|
34
|
+
* set to Minimized, which is changed in the app's notification settings.
|
|
35
|
+
* Android starts it only while the app is in the foreground and drops it otherwise without a word, so call it from
|
|
36
|
+
* a person's tap. It resolves once Android was asked, not when the screen shows, and does not wait for the person:
|
|
37
|
+
* read `checkPermissions()` again when the page is back in view.
|
|
38
|
+
*
|
|
39
|
+
* It rejects with `UNSUPPORTED_FEATURE` on iOS and on a device without such a screen, and with
|
|
40
|
+
* `UNSUPPORTED_PLATFORM` on desktop. The command needs its own grant, `live-activity:allow-open-promotion-settings`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function openPromotionSettings(): Promise<void>;
|
|
30
43
|
/** Start an activity; repeated identical starts for an active key are idempotent. */
|
|
31
44
|
export declare function start(input: StartInput): Promise<ActivityRecord>;
|
|
32
45
|
/** Replace the entire snapshot with a newer revision. */
|
package/dist-js/index.js
CHANGED
|
@@ -34,6 +34,21 @@ export function requestPermissions(kind) {
|
|
|
34
34
|
export function openExactAlarmSettings() {
|
|
35
35
|
return invoke('plugin:live-activity|open_exact_alarm_settings', {});
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Ask Android for the screen where the person allows or stops the app's Live Updates (Android 16 and later), or for
|
|
39
|
+
* the app's notification settings before that: for an app whose `checkPermissions()` reads
|
|
40
|
+
* `promotion: 'settingsRequired'`, Android having no dialog for them. That state is also a channel that the person
|
|
41
|
+
* set to Minimized, which is changed in the app's notification settings.
|
|
42
|
+
* Android starts it only while the app is in the foreground and drops it otherwise without a word, so call it from
|
|
43
|
+
* a person's tap. It resolves once Android was asked, not when the screen shows, and does not wait for the person:
|
|
44
|
+
* read `checkPermissions()` again when the page is back in view.
|
|
45
|
+
*
|
|
46
|
+
* It rejects with `UNSUPPORTED_FEATURE` on iOS and on a device without such a screen, and with
|
|
47
|
+
* `UNSUPPORTED_PLATFORM` on desktop. The command needs its own grant, `live-activity:allow-open-promotion-settings`.
|
|
48
|
+
*/
|
|
49
|
+
export function openPromotionSettings() {
|
|
50
|
+
return invoke('plugin:live-activity|open_promotion_settings', {});
|
|
51
|
+
}
|
|
37
52
|
/** Start an activity; repeated identical starts for an active key are idempotent. */
|
|
38
53
|
export function start(input) {
|
|
39
54
|
return invoke('plugin:live-activity|start', { input });
|
package/dist-js/jsx/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Layout components for TSX. Each returns the plain node object of its `layout` builder; nothing here
|
|
2
2
|
// imports Tauri or React, so a server can build the same layout. Every component takes the members any node
|
|
3
|
-
// may carry as props: `style`, `if` or `unless`, `ifStale`, `accessibility`, `transition` and
|
|
3
|
+
// may carry as props: `style`, `if` or `unless`, `ifStale`, `ifFullscreen`, `accessibility`, `transition` and
|
|
4
|
+
// `privacy`.
|
|
4
5
|
import { bound, button, custom, divider, gauge, hstack, image, link, path, progress, spacer, symbol, text, timerText, toggle, vstack, zstack, } from '../layout.js';
|
|
5
6
|
export { bind } from '../layout.js';
|
|
6
7
|
/** Children from top to bottom. */
|
package/dist-js/layout.js
CHANGED
|
@@ -3,8 +3,8 @@ function given(options) {
|
|
|
3
3
|
return Object.fromEntries(Object.entries(options ?? {}).filter(([, value]) => value !== undefined));
|
|
4
4
|
}
|
|
5
5
|
// The builders return plain node objects. They do not validate: the plugin checks the whole request. The options
|
|
6
|
-
// of every builder take the members any node may carry: `style`, `if` or `unless`, `ifStale`, `
|
|
7
|
-
// `transition` and `privacy`.
|
|
6
|
+
// of every builder take the members any node may carry: `style`, `if` or `unless`, `ifStale`, `ifFullscreen`,
|
|
7
|
+
// `accessibility`, `transition` and `privacy`.
|
|
8
8
|
/** Children from top to bottom. */
|
|
9
9
|
export function vstack(children, options) {
|
|
10
10
|
return { type: 'vstack', children, ...given(options) };
|
package/dist-js/types.d.ts
CHANGED
|
@@ -85,6 +85,12 @@ export interface AndroidPresentationSupport {
|
|
|
85
85
|
* `UNSUPPORTED_FEATURE` and posts nothing.
|
|
86
86
|
*/
|
|
87
87
|
readonly actionTargets: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether an activity can ask to stay off a paired watch (a start's `android.localOnly`, an Android content's
|
|
90
|
+
* `presentation.localOnly`). Where it is false such a start or update answers `UNSUPPORTED_FEATURE` and posts
|
|
91
|
+
* nothing.
|
|
92
|
+
*/
|
|
93
|
+
readonly localOnly: boolean;
|
|
88
94
|
}
|
|
89
95
|
/** What an iPhone runs of the features after the first Live Activities. */
|
|
90
96
|
export interface IosSupport {
|
|
@@ -294,6 +300,13 @@ export interface AndroidPresentation {
|
|
|
294
300
|
* A phone carries none, whatever this says.
|
|
295
301
|
*/
|
|
296
302
|
readonly wearOngoingActivity?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* `true`: this snapshot's notification asks Android not to bridge it to a paired watch (`setLocalOnly`). A copy
|
|
305
|
+
* that a watch got of an earlier snapshot stays there, so set it from the start (`android.localOnly`). Absent,
|
|
306
|
+
* it may be sent to the watch unless the start keeps the activity off it. A device that does not offer it
|
|
307
|
+
* (`localOnly` in the capabilities) answers `UNSUPPORTED_FEATURE` and posts nothing.
|
|
308
|
+
*/
|
|
309
|
+
readonly localOnly?: boolean;
|
|
297
310
|
}
|
|
298
311
|
export type AndroidStyle = {
|
|
299
312
|
readonly kind: 'standard';
|
|
@@ -568,6 +581,15 @@ type NodeFields = {
|
|
|
568
581
|
* Android draws the layout as it is while fresh and names `layout.ifStale` in `degradedFeatures`.
|
|
569
582
|
*/
|
|
570
583
|
readonly ifStale?: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* `true`: the node and its subtree are drawn only while the Lock Screen presentation fills the screen, in StandBy
|
|
586
|
+
* on an iPhone that charges on its side (iOS 17); `false`: only while it does not. Beside the other conditions the
|
|
587
|
+
* node is drawn while all hold. The island's parts and the small family are never full screen, and neither is an
|
|
588
|
+
* Android notification: Android leaves out a node of `true` and draws one of `false`, and names nothing. The widget
|
|
589
|
+
* extension needs activitykit 0.9.0, which `setup` points it at: one built with an earlier activitykit draws such a
|
|
590
|
+
* node always.
|
|
591
|
+
*/
|
|
592
|
+
readonly ifFullscreen?: boolean;
|
|
571
593
|
/** What assistive technologies read of the node. */
|
|
572
594
|
readonly accessibility?: LayoutAccessibility;
|
|
573
595
|
/** How the node comes and goes when its `if` or `unless` shows or hides it. Without it the system chooses. */
|
|
@@ -833,6 +855,12 @@ export interface LayoutAndroidOptions {
|
|
|
833
855
|
* platform.
|
|
834
856
|
*/
|
|
835
857
|
readonly wearOngoingActivity?: boolean;
|
|
858
|
+
/**
|
|
859
|
+
* `true`: every snapshot of the activity asks Android not to bridge it to a paired watch (`setLocalOnly`),
|
|
860
|
+
* whatever an Android content says. Absent, it may be sent to the watch. A device that does not offer it (`localOnly` in the
|
|
861
|
+
* capabilities) answers `UNSUPPORTED_FEATURE` and posts nothing; iOS ignores it.
|
|
862
|
+
*/
|
|
863
|
+
readonly localOnly?: boolean;
|
|
836
864
|
/**
|
|
837
865
|
* What runs the tap of a button or a toggle of the lock screen tree, by its `actionId`: a service or a receiver
|
|
838
866
|
* of the app (`actionTargets`). Each key names a control of the tree, else `INVALID_INPUT` on every platform. iOS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tauri-plugin-live-activity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|