2022-12-31 16:31:05 +01:00
|
|
|
//
|
|
|
|
// https://mczachurski.dev
|
|
|
|
// Copyright © 2022 Marcin Czachurski and the repository contributors.
|
|
|
|
// Licensed under the MIT License.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
2023-02-19 10:32:38 +01:00
|
|
|
import PixelfedKit
|
2022-12-31 16:31:05 +01:00
|
|
|
import OAuthSwift
|
|
|
|
|
2023-01-12 18:34:48 +01:00
|
|
|
class SceneDelegate: NSObject, UISceneDelegate {
|
2022-12-31 16:31:05 +01:00
|
|
|
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
2023-01-29 19:11:44 +01:00
|
|
|
guard let url = URLContexts.first?.url else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if url.host == AppConstants.oauthCallbackPart {
|
|
|
|
OAuthSwift.handle(url: url)
|
2023-03-11 18:30:33 +01:00
|
|
|
} else if url.host == AppConstants.statusCallbackPart {
|
|
|
|
let statusId = url.string.replacingOccurrences(of: "\(AppConstants.statusUri)/", with: "")
|
|
|
|
if statusId.isEmpty == false {
|
|
|
|
ApplicationState.shared.showStatusId = statusId
|
|
|
|
}
|
2023-01-29 19:11:44 +01:00
|
|
|
}
|
2022-12-31 16:31:05 +01:00
|
|
|
}
|
|
|
|
}
|