expo-invoke 1.0.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/MIGRATION.md +125 -0
- package/README.md +942 -0
- package/SECURITY.md +35 -0
- package/android/build.gradle +42 -0
- package/android/src/main/java/expo/modules/invoke/AppActionsHandler.kt +74 -0
- package/android/src/main/java/expo/modules/invoke/ExpoInvokeModule.kt +135 -0
- package/android/src/main/java/expo/modules/invoke/QuickTileService.kt +63 -0
- package/android/src/main/java/expo/modules/invoke/ShortcutsHelper.kt +72 -0
- package/build/cli/commands/generate.d.ts +1 -0
- package/build/cli/commands/generate.js +119 -0
- package/build/cli/commands/generate.js.map +1 -0
- package/build/cli/commands/test.d.ts +1 -0
- package/build/cli/commands/test.js +53 -0
- package/build/cli/commands/test.js.map +1 -0
- package/build/cli/commands/validate.d.ts +1 -0
- package/build/cli/commands/validate.js +116 -0
- package/build/cli/commands/validate.js.map +1 -0
- package/build/cli/index.d.ts +2 -0
- package/build/cli/index.js +37 -0
- package/build/cli/index.js.map +1 -0
- package/build/plugin/android/withAndroidInvoke.d.ts +8 -0
- package/build/plugin/android/withAndroidInvoke.js +106 -0
- package/build/plugin/android/withAndroidInvoke.js.map +1 -0
- package/build/plugin/codegen/generateActionsXml.d.ts +2 -0
- package/build/plugin/codegen/generateActionsXml.js +69 -0
- package/build/plugin/codegen/generateActionsXml.js.map +1 -0
- package/build/plugin/codegen/generateShortcutsXml.d.ts +2 -0
- package/build/plugin/codegen/generateShortcutsXml.js +45 -0
- package/build/plugin/codegen/generateShortcutsXml.js.map +1 -0
- package/build/plugin/codegen/generateSwiftIntents.d.ts +2 -0
- package/build/plugin/codegen/generateSwiftIntents.js +129 -0
- package/build/plugin/codegen/generateSwiftIntents.js.map +1 -0
- package/build/plugin/ios/withIOSInvoke.d.ts +9 -0
- package/build/plugin/ios/withIOSInvoke.js +83 -0
- package/build/plugin/ios/withIOSInvoke.js.map +1 -0
- package/build/plugin/src/withInvoke.d.ts +16 -0
- package/build/plugin/src/withInvoke.js +13 -0
- package/build/plugin/src/withInvoke.js.map +1 -0
- package/build/src/components/AddToSiriButton.d.ts +18 -0
- package/build/src/components/AddToSiriButton.d.ts.map +1 -0
- package/build/src/components/AddToSiriButton.js +35 -0
- package/build/src/components/AddToSiriButton.js.map +1 -0
- package/build/src/components/InvokeDebugger.d.ts +12 -0
- package/build/src/components/InvokeDebugger.d.ts.map +1 -0
- package/build/src/components/InvokeDebugger.js +122 -0
- package/build/src/components/InvokeDebugger.js.map +1 -0
- package/build/src/components/ShortcutChip.d.ts +20 -0
- package/build/src/components/ShortcutChip.d.ts.map +1 -0
- package/build/src/components/ShortcutChip.js +44 -0
- package/build/src/components/ShortcutChip.js.map +1 -0
- package/build/src/hooks/useAddToSiri.d.ts +9 -0
- package/build/src/hooks/useAddToSiri.d.ts.map +1 -0
- package/build/src/hooks/useAddToSiri.js +15 -0
- package/build/src/hooks/useAddToSiri.js.map +1 -0
- package/build/src/hooks/useDonation.d.ts +26 -0
- package/build/src/hooks/useDonation.d.ts.map +1 -0
- package/build/src/hooks/useDonation.js +21 -0
- package/build/src/hooks/useDonation.js.map +1 -0
- package/build/src/hooks/useFocusFilter.d.ts +11 -0
- package/build/src/hooks/useFocusFilter.d.ts.map +1 -0
- package/build/src/hooks/useFocusFilter.js +24 -0
- package/build/src/hooks/useFocusFilter.js.map +1 -0
- package/build/src/hooks/useHandoff.d.ts +29 -0
- package/build/src/hooks/useHandoff.d.ts.map +1 -0
- package/build/src/hooks/useHandoff.js +27 -0
- package/build/src/hooks/useHandoff.js.map +1 -0
- package/build/src/hooks/useInvoke.d.ts +43 -0
- package/build/src/hooks/useInvoke.d.ts.map +1 -0
- package/build/src/hooks/useInvoke.js +70 -0
- package/build/src/hooks/useInvoke.js.map +1 -0
- package/build/src/hooks/useInvokeAnalytics.d.ts +23 -0
- package/build/src/hooks/useInvokeAnalytics.d.ts.map +1 -0
- package/build/src/hooks/useInvokeAnalytics.js +27 -0
- package/build/src/hooks/useInvokeAnalytics.js.map +1 -0
- package/build/src/hooks/useInvokeHistory.d.ts +11 -0
- package/build/src/hooks/useInvokeHistory.d.ts.map +1 -0
- package/build/src/hooks/useInvokeHistory.js +26 -0
- package/build/src/hooks/useInvokeHistory.js.map +1 -0
- package/build/src/hooks/useInvokeInit.d.ts +16 -0
- package/build/src/hooks/useInvokeInit.d.ts.map +1 -0
- package/build/src/hooks/useInvokeInit.js +32 -0
- package/build/src/hooks/useInvokeInit.js.map +1 -0
- package/build/src/hooks/useLiveActivityIntent.d.ts +21 -0
- package/build/src/hooks/useLiveActivityIntent.d.ts.map +1 -0
- package/build/src/hooks/useLiveActivityIntent.js +9 -0
- package/build/src/hooks/useLiveActivityIntent.js.map +1 -0
- package/build/src/hooks/useQuickTile.d.ts +23 -0
- package/build/src/hooks/useQuickTile.d.ts.map +1 -0
- package/build/src/hooks/useQuickTile.js +15 -0
- package/build/src/hooks/useQuickTile.js.map +1 -0
- package/build/src/hooks/useShortcuts.d.ts +25 -0
- package/build/src/hooks/useShortcuts.d.ts.map +1 -0
- package/build/src/hooks/useShortcuts.js +23 -0
- package/build/src/hooks/useShortcuts.js.map +1 -0
- package/build/src/hooks/useSpotlight.d.ts +23 -0
- package/build/src/hooks/useSpotlight.d.ts.map +1 -0
- package/build/src/hooks/useSpotlight.js +13 -0
- package/build/src/hooks/useSpotlight.js.map +1 -0
- package/build/src/hooks/useWidgetData.d.ts +20 -0
- package/build/src/hooks/useWidgetData.d.ts.map +1 -0
- package/build/src/hooks/useWidgetData.js +12 -0
- package/build/src/hooks/useWidgetData.js.map +1 -0
- package/build/src/index.d.ts +32 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +27 -0
- package/build/src/index.js.map +1 -0
- package/build/src/module.d.ts +25 -0
- package/build/src/module.d.ts.map +1 -0
- package/build/src/module.js +102 -0
- package/build/src/module.js.map +1 -0
- package/build/src/types/index.d.ts +156 -0
- package/build/src/types/index.d.ts.map +1 -0
- package/build/src/types/index.js +4 -0
- package/build/src/types/index.js.map +1 -0
- package/build/src/utils/actionStore.d.ts +6 -0
- package/build/src/utils/actionStore.d.ts.map +1 -0
- package/build/src/utils/actionStore.js +32 -0
- package/build/src/utils/actionStore.js.map +1 -0
- package/build/src/utils/analytics.d.ts +12 -0
- package/build/src/utils/analytics.d.ts.map +1 -0
- package/build/src/utils/analytics.js +29 -0
- package/build/src/utils/analytics.js.map +1 -0
- package/build/src/utils/testing.d.ts +39 -0
- package/build/src/utils/testing.d.ts.map +1 -0
- package/build/src/utils/testing.js +58 -0
- package/build/src/utils/testing.js.map +1 -0
- package/build/src/utils/validation.d.ts +11 -0
- package/build/src/utils/validation.d.ts.map +1 -0
- package/build/src/utils/validation.js +128 -0
- package/build/src/utils/validation.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/Focus/FocusFilterManager.swift +19 -0
- package/ios/Intents/BaseInvokeIntent.swift +42 -0
- package/ios/Intents/HandoffManager.swift +49 -0
- package/ios/Intents/InvokeActionStore.swift +21 -0
- package/ios/Intents/InvokeParameterTypes.swift +142 -0
- package/ios/LiveActivity/LiveActivityIntentBridge.swift +44 -0
- package/ios/Module/ExpoInvokeModule.swift +170 -0
- package/ios/Notifications/NotificationActionHandler.swift +80 -0
- package/ios/Shortcuts/DonationManager.swift +44 -0
- package/ios/Shortcuts/ShortcutsManager.swift +32 -0
- package/ios/Shortcuts/SpotlightManager.swift +48 -0
- package/ios/Widget/WidgetManager.swift +19 -0
- package/package.json +111 -0
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
## From `expo-errands-assistant`
|
|
4
|
+
|
|
5
|
+
The `expo-errands-assistant` local module was hardcoded for a single Siri action with no parameters, no Android support, and no reusability. `expo-invoke` replaces it entirely.
|
|
6
|
+
|
|
7
|
+
### Step 1 — Replace the import
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
- import { useErrandsAssistant } from '../modules/expo-errands-assistant';
|
|
11
|
+
+ import { useInvokeInit, useInvoke } from 'expo-invoke';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Step 2 — Replace the root-level init
|
|
15
|
+
|
|
16
|
+
```diff
|
|
17
|
+
// app/_layout.tsx
|
|
18
|
+
- useErrandsAssistant(); // old
|
|
19
|
+
+ useInvokeInit(); // new — same cold/warm start behaviour
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Step 3 — Replace the intent listener
|
|
23
|
+
|
|
24
|
+
```diff
|
|
25
|
+
// Before
|
|
26
|
+
- const { action } = useErrandsAssistant();
|
|
27
|
+
- if (action === 'CreateErrand') { router.push('/create'); }
|
|
28
|
+
|
|
29
|
+
// After
|
|
30
|
+
+ const { intent } = useInvoke({ intentId: 'create_errand' });
|
|
31
|
+
+ useEffect(() => { if (intent) router.push('/create'); }, [intent]);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 4 — Move the native intent to app.json
|
|
35
|
+
|
|
36
|
+
Delete the hardcoded Swift intent file. The config plugin generates it:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
// app.json
|
|
40
|
+
{
|
|
41
|
+
"plugins": [["expo-invoke", {
|
|
42
|
+
"intents": [{
|
|
43
|
+
"id": "create_errand",
|
|
44
|
+
"title": "Create an Errand",
|
|
45
|
+
"phrases": ["Create an errand in ${applicationName}"]
|
|
46
|
+
}]
|
|
47
|
+
}]]
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## From `react-native-siri-shortcut`
|
|
54
|
+
|
|
55
|
+
### Install expo-invoke
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx expo install expo-invoke
|
|
59
|
+
npx expo uninstall react-native-siri-shortcut
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Replace donation calls
|
|
63
|
+
|
|
64
|
+
```diff
|
|
65
|
+
- import SiriShortcuts from 'react-native-siri-shortcut';
|
|
66
|
+
- SiriShortcuts.donateShortcut({ identifier: 'create', title: 'Create', userInfo: {} });
|
|
67
|
+
|
|
68
|
+
+ import { useDonation } from 'expo-invoke';
|
|
69
|
+
+ const { donate } = useDonation();
|
|
70
|
+
+ donate({ intentId: 'create_errand', title: 'Create an Errand' });
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Replace the shortcut listener
|
|
74
|
+
|
|
75
|
+
```diff
|
|
76
|
+
- import { ShortcutListener } from 'react-native-siri-shortcut';
|
|
77
|
+
- <ShortcutListener onShortcutReceived={({ identifier }) => { ... }} />
|
|
78
|
+
|
|
79
|
+
+ import { useInvoke } from 'expo-invoke';
|
|
80
|
+
+ const { intent } = useInvoke();
|
|
81
|
+
+ // intent.intentId === 'create_errand' when fired
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## From `expo-siri-shortcut`
|
|
87
|
+
|
|
88
|
+
### Install expo-invoke
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx expo install expo-invoke
|
|
92
|
+
npx expo uninstall expo-siri-shortcut
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Replace the shortcut button
|
|
96
|
+
|
|
97
|
+
```diff
|
|
98
|
+
- import { SiriShortcutButton } from 'expo-siri-shortcut';
|
|
99
|
+
- <SiriShortcutButton shortcut={{ activityType: 'create', title: 'Create' }} />
|
|
100
|
+
|
|
101
|
+
+ import { AddToSiriButton } from 'expo-invoke';
|
|
102
|
+
+ <AddToSiriButton intentId="create_errand" />
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Replace the activity listener
|
|
106
|
+
|
|
107
|
+
The old `expo-siri-shortcut` used `NSUserActivity`. `expo-invoke` uses the modern App Intents API. Replace the app delegate hook with `useInvokeInit()` and receive via `useInvoke()`.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Key Behavioural Differences
|
|
112
|
+
|
|
113
|
+
| Behaviour | Old packages | expo-invoke |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| iOS API | SiriKit (deprecated) | App Intents (iOS 16+) |
|
|
116
|
+
| Android | None | Google App Actions BII |
|
|
117
|
+
| Multi-intent | No | Yes — unlimited |
|
|
118
|
+
| Parameters | None / manual | 8 typed parameter types |
|
|
119
|
+
| Widget bridge | No | Yes — WidgetKit + AppWidgetProvider |
|
|
120
|
+
| Dynamic Island | No | Yes |
|
|
121
|
+
| Cold start TTL | None | 30s default, configurable |
|
|
122
|
+
| Intent deduplication | No | Yes (2s window) |
|
|
123
|
+
| Source attribution | No | 20 surfaces |
|
|
124
|
+
| Testing utilities | No | mockInvoke, simulateColdStart |
|
|
125
|
+
| CLI | No | validate, generate, test |
|