forked from sopt-makers/SOPT-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/sopt-makers#199
- Loading branch information
Showing
10 changed files
with
490 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...OS/Projects/Demo/SOPT-iOS-Demo/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+45.3 KB
...cts/Demo/SOPT-iOS-Demo/Resources/Assets.xcassets/AppIcon.appiconset/appIcon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-117 KB
...ts/Demo/SOPT-iOS-Demo/Resources/Assets.xcassets/AppIcon.appiconset/appstore.png
Binary file not shown.
36 changes: 36 additions & 0 deletions
36
SOPT-iOS/Projects/Demo/SOPT-iOS-Demo/Sources/Application/AppDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// AppDelegate.swift | ||
// ProjectDescriptionHelpers | ||
// | ||
// Created by 양수빈 on 2022/10/01. | ||
// | ||
|
||
import UIKit | ||
|
||
import Core | ||
|
||
@main | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
|
||
return true | ||
} | ||
|
||
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { | ||
return UIInterfaceOrientationMask.portrait | ||
} | ||
|
||
// MARK: UISceneSession Lifecycle | ||
|
||
func application( _ application: UIApplication, | ||
configurationForConnecting connectingSceneSession: UISceneSession, | ||
options: UIScene.ConnectionOptions | ||
) -> UISceneConfiguration { | ||
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | ||
} | ||
|
||
func application( _ application: UIApplication, | ||
didDiscardSceneSessions sceneSessions: Set<UISceneSession> | ||
) {} | ||
} |
96 changes: 96 additions & 0 deletions
96
SOPT-iOS/Projects/Demo/SOPT-iOS-Demo/Sources/Application/SceneDelegate+HandleURL.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// | ||
// SceneDelegate+HandleURL.swift | ||
// SOPT-iOS | ||
// | ||
// Created by Junho Lee on 2023/04/16. | ||
// Copyright © 2023 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
import Core | ||
import AuthFeatureInterface | ||
|
||
// MARK: Handle URLs | ||
|
||
extension SceneDelegate { | ||
func parseContexts(openURLContexts URLContexts: Set<UIOpenURLContext>) { | ||
for context in URLContexts { | ||
print("url: \(context.url.absoluteURL)") | ||
print("scheme: \(String(describing: context.url.scheme))") | ||
print("host: \(String(describing: context.url.host))") | ||
print("path: \(context.url.path)") | ||
print("query: \(String(describing: context.url.query))") | ||
print("components: \(context.url.pathComponents)") | ||
|
||
guard let _url = URLContexts.first?.url, | ||
context.url.host() ?? "" == URLHandler.makers else { | ||
return | ||
} | ||
handleURL(url: _url) | ||
} | ||
} | ||
|
||
private func handleURL(url: URL) { | ||
print("") | ||
print("==============================") | ||
print("URL Handling 시작") | ||
print("==============================") | ||
print("") | ||
|
||
let urlStr = url.absoluteString | ||
let components = URLComponents(string: urlStr) | ||
let schemeData = components?.scheme ?? "" | ||
let parameter = components?.query ?? "" | ||
|
||
print("") | ||
print("==============================") | ||
print("[Scheme 접속 및 파라미터 값 확인]") | ||
print("urlStr : ", urlStr) | ||
print("scheme : ", schemeData) | ||
print("query : ", parameter) | ||
print("==============================") | ||
print("") | ||
|
||
let purePath = url.pathComponents[safe: 1] ?? "" | ||
let handler = URLHandler.init(rawValue: purePath) | ||
switch handler { | ||
case .playgroundLogin: | ||
redirectSignInVC(url: urlStr) | ||
default: return | ||
} | ||
} | ||
|
||
func redirectSignInVC(url: String) { | ||
var signInControllable = container.makeSignInVC() | ||
signInControllable.skipAnimation = true | ||
for item in parseParameter(url: url) { | ||
if item.query == "state" { | ||
signInControllable.requestState = item.value | ||
continue | ||
} | ||
|
||
if item.query == "code" { | ||
signInControllable.accessCode = item.value | ||
continue | ||
} | ||
} | ||
self.window?.rootViewController = signInControllable.viewController | ||
self.window?.makeKeyAndVisible() | ||
} | ||
} | ||
|
||
extension SceneDelegate { | ||
func parseParameter(url: String) -> [(query: String, value: String)] { | ||
let components = URLComponents(string: url) | ||
let params = components?.query ?? "" | ||
guard params.count > 0 && params != "", | ||
let items = components?.queryItems else { | ||
return [] | ||
} | ||
return items.map { | ||
($0.name, $0.value ?? "") | ||
} | ||
} | ||
} | ||
|
49 changes: 49 additions & 0 deletions
49
SOPT-iOS/Projects/Demo/SOPT-iOS-Demo/Sources/Application/SceneDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// SceneDelegate.swift | ||
// ProjectDescriptionHelpers | ||
// | ||
// Created by 양수빈 on 2022/10/01. | ||
// | ||
|
||
import UIKit | ||
|
||
import Core | ||
import MainFeature | ||
|
||
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | ||
|
||
var window: UIWindow? | ||
|
||
let container = DIContainer() | ||
|
||
func scene(_ scene: UIScene, | ||
willConnectTo session: UISceneSession, | ||
options connectionOptions: UIScene.ConnectionOptions) { | ||
guard let scene = (scene as? UIWindowScene) else { return } | ||
|
||
window = UIWindow(frame: scene.coordinateSpace.bounds) | ||
window?.windowScene = scene | ||
// let rootVC = container.makeShowAttendanceVC().viewController | ||
let rootVC = container.makeSplashVC().viewController | ||
// let rootVC = container.makeMainVC(userType: .active).viewController | ||
|
||
window?.rootViewController = UINavigationController(rootViewController: rootVC) | ||
window?.makeKeyAndVisible() | ||
} | ||
|
||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { | ||
parseContexts(openURLContexts: URLContexts) | ||
} | ||
|
||
func sceneDidDisconnect(_ scene: UIScene) {} | ||
|
||
func sceneDidBecomeActive(_ scene: UIScene) { | ||
UIApplication.shared.applicationIconBadgeNumber = 0 | ||
} | ||
|
||
func sceneWillResignActive(_ scene: UIScene) {} | ||
|
||
func sceneWillEnterForeground(_ scene: UIScene) {} | ||
|
||
func sceneDidEnterBackground(_ scene: UIScene) {} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.