Skip to content
Draft
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
3 changes: 3 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wc" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>

<!-- To disable the activity lifecycle breadcrumbs integration -->
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<resources>
<string name="app_name">Edge</string>
<string name="shortcut_contact_support">Contact Support</string>
</resources>
11 changes: 11 additions & 0 deletions android/app/src/main/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="contact_support"
android:icon="@mipmap/ic_launcher"
android:shortLabel="@string/shortcut_contact_support">
<intent
android:action="android.intent.action.VIEW"
android:data="edge://scene/webView?title=Contact%20Support&amp;uri=https%3A%2F%2Fsupport.edge.app%2Fhc%2Fen-us%2Frequests%2Fnew" />
</shortcut>
</shortcuts>
24 changes: 24 additions & 0 deletions ios/edge/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import UserNotifications
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var securityView: UIView?
private var pendingShortcutItem: UIApplicationShortcutItem?

var reactNativeDelegate: ReactNativeDelegate?
var reactNativeFactory: RCTReactNativeFactory?
Expand Down Expand Up @@ -49,6 +50,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
if let shortcutItem = launchOptions?[.shortcutItem] as? UIApplicationShortcutItem {
pendingShortcutItem = shortcutItem
}

// Initialize SDK's:
initializeSentry()
FirebaseApp.configure()
Expand All @@ -72,9 +77,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
launchOptions: launchOptions
)

if let shortcutItem = pendingShortcutItem {
_ = handleShortcutItem(shortcutItem)
pendingShortcutItem = nil
}

return true
}

func application(
_ application: UIApplication,
performActionFor shortcutItem: UIApplicationShortcutItem,
completionHandler: @escaping (Bool) -> Void
) {
let handled = handleShortcutItem(shortcutItem)
completionHandler(handled)
}

private func handleShortcutItem(_ shortcutItem: UIApplicationShortcutItem) -> Bool {
guard let url = URL(string: shortcutItem.type) else { return false }
return RCTLinkingManager.application(UIApplication.shared, open: url, options: [:])
}

/**
* Periodic background fetch logic.
* Edge addition.
Expand Down
9 changes: 9 additions & 0 deletions ios/edge/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
</array>
<key>CFBundleVersion</key>
<string>99999999</string>
<key>UIApplicationShortcutItems</key>
<array>
<dict>
<key>UIApplicationShortcutItemTitle</key>
<string>Contact Support</string>
<key>UIApplicationShortcutItemType</key>
<string>edge://scene/webView?title=Contact%20Support&amp;uri=https%3A%2F%2Fsupport.edge.app%2Fhc%2Fen-us%2Frequests%2Fnew</string>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
Expand Down
Loading