handle incoming url for appclip
This commit is contained in:
+7
-2
@@ -22,8 +22,6 @@ const DARK_SPLASH_CONFIG_ANDROID = {
|
|||||||
resizeMode: 'cover',
|
resizeMode: 'cover',
|
||||||
}
|
}
|
||||||
|
|
||||||
const ASSOCIATED_DOMAINS = ['applinks:bsky.app', 'applinks:staging.bsky.app']
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
/**
|
/**
|
||||||
* App version number. Should be incremented as part of a release cycle.
|
* App version number. Should be incremented as part of a release cycle.
|
||||||
@@ -41,6 +39,13 @@ module.exports = function (config) {
|
|||||||
const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight'
|
const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight'
|
||||||
const IS_PRODUCTION = process.env.EXPO_PUBLIC_ENV === 'production'
|
const IS_PRODUCTION = process.env.EXPO_PUBLIC_ENV === 'production'
|
||||||
|
|
||||||
|
const ASSOCIATED_DOMAINS = [
|
||||||
|
'applinks:bsky.app',
|
||||||
|
'applinks:staging.bsky.app',
|
||||||
|
// When testing local services, enter an ngrok (et al) domain here. It must use a standard HTTP/HTTPS port.
|
||||||
|
...(IS_DEV ? ['applinks:dc19-24-237-65-73.ngrok-free.app'] : []),
|
||||||
|
]
|
||||||
|
|
||||||
const UPDATES_CHANNEL = IS_TESTFLIGHT
|
const UPDATES_CHANNEL = IS_TESTFLIGHT
|
||||||
? 'testflight'
|
? 'testflight'
|
||||||
: IS_PRODUCTION
|
: IS_PRODUCTION
|
||||||
|
|||||||
@@ -1,17 +1,32 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
// https://dc19-24-237-65-73.ngrok-free.app/start/haileyok.com/3kuw7byr7gd2x
|
||||||
|
|
||||||
@main
|
@main
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
var controller: ViewController?
|
||||||
|
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
self.window = UIWindow()
|
self.window = UIWindow()
|
||||||
|
|
||||||
let controller = ViewController()
|
self.controller = ViewController()
|
||||||
|
|
||||||
self.window?.rootViewController = controller
|
self.window?.rootViewController = self.controller
|
||||||
self.window?.makeKeyAndVisible()
|
self.window?.makeKeyAndVisible()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
||||||
|
self.controller?.handleURL(url: url)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
|
||||||
|
if let incomingURL = userActivity.webpageURL {
|
||||||
|
self.controller?.handleURL(url: incomingURL)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,15 @@ class ViewController: UIViewController {
|
|||||||
webView.contentMode = .scaleToFill
|
webView.contentMode = .scaleToFill
|
||||||
|
|
||||||
self.view.addSubview(webView)
|
self.view.addSubview(webView)
|
||||||
|
|
||||||
if let url = URL(string: "http://localhost:19006/start/haileyok.com/3kuw7byr7gd2x?clip=true") {
|
self.webView = webView
|
||||||
webView.load(URLRequest(url: url))
|
}
|
||||||
|
|
||||||
|
func handleURL(url: URL) {
|
||||||
|
let urlString = "\(url.absoluteString)?clip=true"
|
||||||
|
|
||||||
|
if let url = URL(string: urlString) {
|
||||||
|
self.webView?.load(URLRequest(url: url))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user