-
Notifications
You must be signed in to change notification settings - Fork 290
feat: add home screen long-press shortcuts via expo-quick-actions #6001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import 'expo-modules-core' | ||
| import 'react-native-gesture-handler' | ||
| import './src/app' | ||
| import './src/perf' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import * as QuickActions from 'expo-quick-actions' | ||
| import { useQuickActionCallback } from 'expo-quick-actions/hooks' | ||
| import * as React from 'react' | ||
| import { Linking, Platform } from 'react-native' | ||
|
|
||
| import { useHandler } from '../../hooks/useHandler' | ||
| import { lstrings } from '../../locales/strings' | ||
| import { showError } from './AirshipInstance' | ||
|
|
||
| const DO_NOT_UNINSTALL_URL = | ||
| 'https://support.edge.app/en/articles/14439418-warning-don-t-uninstall-edge-without-your-login-credentials' | ||
| const CONTACT_SUPPORT_URL = | ||
| 'https://support.edge.app/en/articles/14054649-need-help-reach-out-via-our-chat-bubble?chat=open' | ||
|
|
||
| export const QuickActionsManager: React.FC = () => { | ||
| React.useEffect(() => { | ||
| QuickActions.setItems([ | ||
| { | ||
| id: 'do_not_uninstall', | ||
| title: lstrings.shortcut_do_not_uninstall_title, | ||
| subtitle: lstrings.shortcut_do_not_uninstall_subtitle, | ||
| icon: Platform.select({ | ||
| ios: 'symbol:nosign', | ||
| default: 'prohibit' | ||
| }), | ||
| params: { url: DO_NOT_UNINSTALL_URL } | ||
| }, | ||
| { | ||
| id: 'contact_support', | ||
| title: lstrings.shortcut_contact_support_title, | ||
| subtitle: lstrings.shortcut_contact_support_subtitle, | ||
| icon: Platform.select({ | ||
| ios: 'symbol:message.fill', | ||
| default: 'message' | ||
| }), | ||
| params: { url: CONTACT_SUPPORT_URL } | ||
| } | ||
| ]).catch(showError) | ||
| }, []) | ||
|
|
||
| const handleQuickAction = useHandler((action: QuickActions.Action) => { | ||
| const url = action.params?.url | ||
| if (typeof url === 'string') { | ||
| Linking.openURL(url).catch(showError) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of sending the user to the browser could we launch the app with a deeplink to a special scene? I don't think it's appropriate to put links to our support pages with our branding in the quick actions of our white label apps. If we deeplink into a scene it can remain themed and use strings with the white label name in them |
||
| } | ||
| }) | ||
|
|
||
| useQuickActionCallback(handleQuickAction) | ||
|
|
||
| return null | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2551,6 +2551,12 @@ const strings = { | |
| 'Please ensure all details are correct before making the transfer.', | ||
| // #endregion | ||
|
|
||
| // Home screen long-press shortcuts (expo-quick-actions) | ||
| shortcut_do_not_uninstall_title: '⚠️ Save 2FA First!', | ||
| shortcut_do_not_uninstall_subtitle: 'Login requires 2FA & credentials!', | ||
| shortcut_contact_support_title: 'Contact Support', | ||
| shortcut_contact_support_subtitle: 'Get help from our live support agents', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "live support agents" may not be accurate for white label versions of the app. Should be more generic, something like "Get help from our support team" |
||
|
|
||
| unknown_error_message: 'An unknown error occurred.' | ||
| } as const | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorthand
.catch(showError)loses stack tracesLow Severity
Both
.catch(showError)calls (onQuickActions.setItems(…)andLinking.openURL(url)) use the shorthand form that loses the calling-site stack trace. The project convention (and other service files likeServices.tsxandContactsLoader.ts) consistently use.catch((error: unknown) => showError(error))instead. This violates thepreserve-stack-tracesrule.Additional Locations (1)
src/components/services/QuickActionsManager.tsx#L43-L44Reviewed by Cursor Bugbot for commit 4bec8ad. Configure here.