tauri-plugin-live-activity 1.2.1 → 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
@@ -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
@@ -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 });
@@ -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.1",
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",