Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased (develop)

- added: Home screen long-press shortcuts for "⚠️ Save 2FA First!" warning and "Contact Support".
- added: Show swap KYC/terms modal for NExchange
- added: Nym mixnet warning in Stake, Unstake, and Claim Rewards scenes
- changed: Migrate Thorchain Savers and Thorchain Yield endpoints off NineRealms to gateway.liquify.com.
Expand Down
11 changes: 9 additions & 2 deletions android/app/src/main/java/co/edgesecure/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import com.zoontek.rnbootsplash.RNBootSplash
import expo.modules.ReactActivityDelegateWrapper

class MainActivity : ReactActivity() {
/**
Expand All @@ -18,10 +19,16 @@ class MainActivity : ReactActivity() {

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled].
* The Expo wrapper forwards activity lifecycle events (onCreate intent capture, onNewIntent)
* to expo modules; expo-quick-actions needs it to deliver shortcut taps on cold start.
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
ReactActivityDelegateWrapper(
this,
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
)

// Edge addition
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
11 changes: 11 additions & 0 deletions android/app/src/main/res/drawable/message.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Home screen quick action icon, referenced by name from QuickActionsManager.tsx -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF616161"
android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
</vector>
11 changes: 11 additions & 0 deletions android/app/src/main/res/drawable/prohibit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Home screen quick action icon, referenced by name from QuickActionsManager.tsx -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF616161"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM4,12c0,-4.42 3.58,-8 8,-8 1.85,0 3.55,0.63 4.9,1.69L5.69,16.9C4.63,15.55 4,13.85 4,12zM12,20c-1.85,0 -3.55,-0.63 -4.9,-1.69L18.31,7.1C19.37,8.45 20,10.15 20,12c0,4.42 -3.58,8 -8,8z"/>
</vector>
6 changes: 6 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// This side-effect import must come before expo-quick-actions is evaluated:
// expo-quick-actions reads globalThis.expo.modules.ExpoQuickActions at module
// evaluation time, and that global is installed lazily by expo-modules-core.
// Without it, every expo-quick-actions call (including setItems) silently
// no-ops and the home screen shortcuts never appear.
import 'expo-modules-core'
import 'react-native-gesture-handler'
import './src/app'
import './src/perf'
Expand Down
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ExpoQuickActions (5.0.0):
- ExpoModulesCore
- fast_float (6.1.4)
- FBLazyVector (0.79.2)
- Firebase/CoreOnly (10.29.0):
Expand Down Expand Up @@ -2889,6 +2891,7 @@ DEPENDENCIES:
- ExpoFont (from `../node_modules/expo-font/ios`)
- ExpoKeepAwake (from `../node_modules/expo-keep-awake/ios`)
- ExpoModulesCore (from `../node_modules/expo-modules-core`)
- ExpoQuickActions (from `../node_modules/expo-quick-actions/ios`)
- fast_float (from `../node_modules/react-native/third-party-podspecs/fast_float.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
Expand Down Expand Up @@ -3089,6 +3092,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-keep-awake/ios"
ExpoModulesCore:
:path: "../node_modules/expo-modules-core"
ExpoQuickActions:
:path: "../node_modules/expo-quick-actions/ios"
fast_float:
:podspec: "../node_modules/react-native/third-party-podspecs/fast_float.podspec"
FBLazyVector:
Expand Down Expand Up @@ -3347,6 +3352,7 @@ SPEC CHECKSUMS:
ExpoFont: cf508bc2e6b70871e05386d71cab927c8524cc8e
ExpoKeepAwake: bf0811570c8da182bfb879169437d4de298376e7
ExpoModulesCore: 471ae18809dc8a5c9a623193a317eef6048a4f8a
ExpoQuickActions: fdbda7f5874aed3dd2b1d891ec00ab3300dc7541
fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6
FBLazyVector: 84b955f7b4da8b895faf5946f73748267347c975
Firebase: cec914dab6fd7b1bd8ab56ea07ce4e03dd251c2d
Expand Down
24 changes: 24 additions & 0 deletions ios/edge/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ExpoQuickActions
import Firebase
import FirebaseMessaging
import RNBootSplash
Expand Down Expand Up @@ -56,6 +57,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Client-side background fetch interval:
application.setMinimumBackgroundFetchInterval(60 * 60 * 12)

// Capture a home-screen quick action on a cold launch so
// expo-quick-actions can report it as the initial action once JS loads.
// This delegate is not an ExpoAppDelegate, so the library's own
// subscriber never runs. Edge addition.
if let shortcutItem = launchOptions?[.shortcutItem] as? UIApplicationShortcutItem {
ExpoQuickActions.initialAction = shortcutItem
}

// React Native template code:
let delegate = ReactNativeDelegate()
let factory = RCTReactNativeFactory(delegate: delegate)
Expand All @@ -75,6 +84,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}

/**
* Handles home-screen quick action taps while the app is running.
* Mirrors ExpoQuickActionsAppDelegate, which never runs because this
* delegate is not an ExpoAppDelegate. Edge addition.
*/
func application(
_ application: UIApplication,
performActionFor shortcutItem: UIApplicationShortcutItem,
completionHandler: @escaping (Bool) -> Void
) {
NotificationCenter.default.post(
name: Notification.Name("onQuickAction"), object: shortcutItem)
completionHandler(true)
}

/**
* Periodic background fetch logic.
* Edge addition.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"edge-login-ui-rn": "^3.35.5",
"ethers": "^5.7.2",
"expo": "^53.0.0",
"expo-quick-actions": "^5.0.0",
"jsrsasign": "^11.1.0",
"marked": "^15.0.9",
"p-debounce": "^4.0.0",
Expand Down
13 changes: 13 additions & 0 deletions patches/expo-quick-actions+5.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/expo-quick-actions/ios/ExpoQuickActionsModule.swift b/node_modules/expo-quick-actions/ios/ExpoQuickActionsModule.swift
index 252da49..12a29e4 100644
--- a/node_modules/expo-quick-actions/ios/ExpoQuickActionsModule.swift
+++ b/node_modules/expo-quick-actions/ios/ExpoQuickActionsModule.swift
@@ -71,7 +71,7 @@ func toActionObject(item: UIApplicationShortcutItem?) -> ActionObject? {
)
}

-var initialAction: UIApplicationShortcutItem?
+public var initialAction: UIApplicationShortcutItem?

public class ExpoQuickActionsModule: Module {

2 changes: 2 additions & 0 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SafeAreaProvider } from 'react-native-safe-area-context'
import { useHandler } from '../hooks/useHandler'
import { CrashScene } from './scenes/CrashScene'
import { EdgeCoreManager } from './services/EdgeCoreManager'
import { QuickActionsManager } from './services/QuickActionsManager'
import { StatusBarManager } from './services/StatusBarManager'
import { ThemeProvider } from './services/ThemeContext'

Expand Down Expand Up @@ -38,6 +39,7 @@ const MainApp: React.FC = () => {
fallback={<CrashScene />}
>
<StatusBarManager />
<QuickActionsManager />
<EdgeCoreManager />
</ErrorBoundary>
</GestureHandlerRootView>
Expand Down
61 changes: 61 additions & 0 deletions src/components/services/QuickActionsManager.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import * as QuickActions from 'expo-quick-actions'
import { useQuickActionCallback } from 'expo-quick-actions/hooks'
import type * as React from 'react'
import { Linking, Platform } from 'react-native'

import { useAsyncEffect } from '../../hooks/useAsyncEffect'
import { useHandler } from '../../hooks/useHandler'
import { lstrings } from '../../locales/strings'
import { config } from '../../theme/appConfig'
import { showError } from './AirshipInstance'

export const QuickActionsManager: React.FC = () => {
useAsyncEffect(
async () => {
const { quickActions } = config
if (quickActions == null) return
try {
await 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: quickActions.uninstallWarningUrl }
},
{
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: quickActions.contactSupportUrl }
}
])
} catch (error: unknown) {
showError(error)
}
},
[],
'QuickActionsManager'
)

const handleQuickAction = useHandler(async (action: QuickActions.Action) => {
const url = action.params?.url
if (typeof url !== 'string') return
try {
await Linking.openURL(url)
} catch (error: unknown) {
showError(error)
}
})

useQuickActionCallback(handleQuickAction)

return null
}
6 changes: 6 additions & 0 deletions src/locales/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 support team',

unknown_error_message: 'An unknown error occurred.'
} as const

Expand Down
4 changes: 4 additions & 0 deletions src/locales/strings/enUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -1990,5 +1990,9 @@
"ramp_account_number_label": "Account Number",
"ramp_routing_number_label": "Routing Number",
"ramp_bank_routing_warning": "Please ensure all details are correct before making the transfer.",
"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 support team",
"unknown_error_message": "An unknown error occurred."
}
8 changes: 7 additions & 1 deletion src/theme/edgeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@ export const edgeConfig: AppConfig = {
supportSite: 'https://help.edge.app/support/tickets/new',
termsOfServiceSite: 'https://edge.app/tos/',
website: 'https://edge.app',
supportChatSite: 'https://support.edge.app/hc/en-us?chat=open'
supportChatSite: 'https://support.edge.app/hc/en-us?chat=open',
quickActions: {
uninstallWarningUrl:
'https://support.edge.app/en/articles/14439418-warning-don-t-uninstall-edge-without-your-login-credentials',
contactSupportUrl:
'https://support.edge.app/en/articles/14054649-need-help-reach-out-via-our-chat-bubble?chat=open'
}
}
8 changes: 8 additions & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ export interface AppConfig {
* Support article for pending transactions "Learn more" link.
*/
pendingTxLearnMoreUrl?: string
/**
* Home screen long-press quick action shortcuts.
* Omit to disable the shortcuts for a build.
*/
quickActions?: {
uninstallWarningUrl: string
contactSupportUrl: string
}
extraTab?: {
webviewUrl: string
tabType: 'edgeProvider' | 'webview'
Expand Down
Loading