tauri-plugin-live-activity 1.2.0 → 1.3.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 CHANGED
@@ -52,7 +52,7 @@ 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
+ | StandBy | iOS 17 | 옆으로 눕혀 충전하는 iPhone에서 크게 보이는 잠금 화면 카드, iOS 18부터 `ifFullscreen` 노드가 여기에만 보임 |
56
56
  | Apple Watch | iOS 18과 watchOS 11 | 레이아웃의 `small` 영역이 워치의 Smart Stack에 |
57
57
  | Android | Android 8.0 (API 26) | 진행률 막대나 타이머, 동작 최대 세 개가 있는 진행 중 알림. 알림 권한은 Android 13 (API 33)부터 묻습니다 |
58
58
  | Android Live Updates | Android 16 (API 36) | 시스템과 사용자 설정이 허락하면 승격된 Live Update, 아니면 진행 중 알림; `openPromotionSettings()`가 그 설정을 엶 |
@@ -341,6 +341,11 @@ Android에서는 폰의 ongoing 알림이 페어링된 워치로 전달되지
341
341
  노드에는 `frame: { maxWidth: 'infinity', alignment: 'leading' }`인 스타일을 줍니다.
342
342
  [더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#placement-on-the-lock-screen)
343
343
 
344
+ `replaceLayout`은 실행 중인 활동에 다른 레이아웃을 그 레이아웃의 값과 함께 줍니다. 배달이 도착했을 때의 카드가
345
+ 그 예이고, 그 뒤의 업데이트는 새 레이아웃의 값을 보냅니다. iOS에서는 `setup`을 다시 실행한 뒤 위젯 확장을 다시
346
+ 빌드해야 하고, Android에서 알림 스타일이 바뀌는 교체에는 `androidPresentation.styleChange`가 필요합니다.
347
+ [더 보기](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#another-layout-while-it-runs)
348
+
344
349
  ## 푸시
345
350
 
346
351
  iOS에서는 서버가 APNs로 액티비티를 갱신하고 끝내고 시작합니다. `push: 'token'`(iOS 18에서는 `{ channel }`도)으로
package/README.md CHANGED
@@ -52,7 +52,7 @@ 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
+ | StandBy | iOS 17 | The Lock Screen card scaled up on an iPhone that charges on its side; from iOS 18 nodes with `ifFullscreen` show there |
56
56
  | Apple Watch | iOS 18 with watchOS 11 | A layout's `small` region in the watch's Smart Stack |
57
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) |
58
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 |
@@ -352,6 +352,11 @@ On the Lock Screen the card has no margin and shows a narrower layout in its mid
352
352
  node that should reach an edge a style with `frame: { maxWidth: 'infinity', alignment: 'leading' }`.
353
353
  [More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#placement-on-the-lock-screen)
354
354
 
355
+ `replaceLayout` gives a running activity another layout with the values of that layout, such as the card of a
356
+ delivery that has arrived; updates after it send values of the new layout. On iOS the widget extension has to be built
357
+ again after `setup`, and on Android a change of notification style needs `androidPresentation.styleChange`.
358
+ [More](https://github.com/1eedaegon/tauri-plugin-live-activity/blob/main/docs/usage.md#another-layout-while-it-runs)
359
+
355
360
  ## Pushes
356
361
 
357
362
  A server updates, ends or starts activities through APNs on iOS. Start with `push: 'token'` (or `{ channel }` on
package/cli/setup.mjs CHANGED
@@ -17,7 +17,7 @@ export const ACTIVITYKIT = 'activitykit';
17
17
  export const PERMISSIONS = [
18
18
  'live-activity:default',
19
19
  ...['request-permissions', 'open-exact-alarm-settings', 'open-promotion-settings', 'start', 'update', 'end', 'start-layout',
20
- 'update-layout', 'end-layout', 'write-image']
20
+ 'update-layout', 'replace-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.
@@ -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, PushedEvent, PushTarget, PushToStartTokenEvent, PushTokenEvent, PushTokens, HandledEvent, StartInput, StartedEvent, StateEvent, UnknownEvent, UpdateInput, UpdatedEvent } from './types.js';
2
+ import type { ActionEvent, ActivityRecord, Capabilities, EndInput, LayoutActivityRecord, LayoutEndInput, LayoutStartInput, LayoutReplaceInput, 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';
@@ -50,8 +50,14 @@ export declare function end(input: EndInput): Promise<ActivityRecord>;
50
50
  export declare function list(): Promise<readonly ActivityRecord[]>;
51
51
  /** Start a layout activity (contract v2); repeated identical starts for an active key are idempotent. */
52
52
  export declare function startLayout(input: LayoutStartInput): Promise<LayoutActivityRecord>;
53
- /** Replace every value with a newer revision; the layout stays as started. */
53
+ /** Replace every value with a newer revision; the layout stays as it is. */
54
54
  export declare function updateLayout(input: LayoutUpdateInput): Promise<LayoutActivityRecord>;
55
+ /**
56
+ * Replace the layout of a running layout activity, with its styles and values, at a newer revision. Later updates
57
+ * keep the keys and types of these values. On Android a layout that takes another notification style needs
58
+ * `androidPresentation.styleChange`; on iOS the widget extension needs activitykit 1.1.0 (run setup again).
59
+ */
60
+ export declare function replaceLayout(input: LayoutReplaceInput): Promise<LayoutActivityRecord>;
55
61
  /** End this layout generation, with final content when `snapshot` is given. A late update cannot revive it. */
56
62
  export declare function endLayout(input: LayoutEndInput): Promise<LayoutActivityRecord>;
57
63
  /** Reconcile plugin-owned layout records with the OS; `list` reports contract v1 activities. */
package/dist-js/index.js CHANGED
@@ -69,10 +69,18 @@ export function list() {
69
69
  export function startLayout(input) {
70
70
  return invoke('plugin:live-activity|start_layout', { input });
71
71
  }
72
- /** Replace every value with a newer revision; the layout stays as started. */
72
+ /** Replace every value with a newer revision; the layout stays as it is. */
73
73
  export function updateLayout(input) {
74
74
  return invoke('plugin:live-activity|update_layout', { input });
75
75
  }
76
+ /**
77
+ * Replace the layout of a running layout activity, with its styles and values, at a newer revision. Later updates
78
+ * keep the keys and types of these values. On Android a layout that takes another notification style needs
79
+ * `androidPresentation.styleChange`; on iOS the widget extension needs activitykit 1.1.0 (run setup again).
80
+ */
81
+ export function replaceLayout(input) {
82
+ return invoke('plugin:live-activity|replace_layout', { input });
83
+ }
76
84
  /** End this layout generation, with final content when `snapshot` is given. A late update cannot revive it. */
77
85
  export function endLayout(input) {
78
86
  return invoke('plugin:live-activity|end_layout', { input });
@@ -610,11 +610,11 @@ type NodeFields = {
610
610
  readonly ifStale?: boolean;
611
611
  /**
612
612
  * `true`: the node and its subtree are drawn only while the Lock Screen presentation fills the screen, in StandBy
613
- * on an iPhone that charges on its side (iOS 17); `false`: only while it does not. Beside the other conditions the
614
- * node is drawn while all hold. The island's parts and the small family are never full screen, and neither is an
615
- * Android notification: Android leaves out a node of `true` and draws one of `false`, and names nothing. The widget
616
- * extension needs activitykit 0.9.0, which `setup` points it at: one built with an earlier activitykit draws such a
617
- * node always.
613
+ * on an iPhone that charges on its side (iOS 18; on iOS 17 the card there is drawn as on the Lock Screen); `false`:
614
+ * only while it does not. Beside the other conditions the node is drawn while all hold. The island's parts and the
615
+ * small family are never full screen, and neither is an Android notification: Android leaves out a node of `true`
616
+ * and draws one of `false`, and names nothing. The widget extension needs activitykit 0.9.0, and 1.0.4 on iOS 17,
617
+ * which `setup` points it at: one built with an activitykit before 0.9.0 draws such a node always.
618
618
  */
619
619
  readonly ifFullscreen?: boolean;
620
620
  /** What assistive technologies read of the node. */
@@ -945,7 +945,7 @@ export interface LayoutStartInput {
945
945
  readonly schemaVersion: 2;
946
946
  /** Explicitly permits or forbids selection of the notification fallback. */
947
947
  readonly fallback: Fallback;
948
- /** Fixed for this generation; updates replace the values only. */
948
+ /** Updates replace the values only; `replaceLayout` replaces the layout too. */
949
949
  readonly layout: Layout;
950
950
  /** Between 1 and 24 styles by token; a token follows the rule for value keys. */
951
951
  readonly styles?: {
@@ -968,6 +968,21 @@ export interface LayoutUpdateInput {
968
968
  /** An alert that comes with the update; without it the update is silent. */
969
969
  readonly alert?: LayoutAlert;
970
970
  }
971
+ /**
972
+ * Another layout for a running layout activity, with its styles and values, at a revision above the last one. The
973
+ * activity keeps its key, id and fallback; later updates keep the keys and types of these values.
974
+ */
975
+ export interface LayoutReplaceInput {
976
+ readonly id: string;
977
+ readonly layout: Layout;
978
+ /** Styles by token in place of the ones the activity shows; without it the activity shows none. */
979
+ readonly styles?: {
980
+ readonly [token: string]: LayoutStyle;
981
+ };
982
+ readonly snapshot: LayoutSnapshot;
983
+ /** An alert that comes with the replace; without it the replace is silent. */
984
+ readonly alert?: LayoutAlert;
985
+ }
971
986
  /**
972
987
  * The end of a layout activity. With `snapshot` it ends with that final content, checked as an update; without one it
973
988
  * ends with the last accepted values.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-plugin-live-activity",
3
- "version": "1.2.0",
3
+ "version": "1.3.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",