Skip to content

Commit

Permalink
Merge branch 'develop' into feat/sopt-makers#199
Browse files Browse the repository at this point in the history
  • Loading branch information
0inn committed Apr 23, 2023
2 parents b702132 + 8167d5e commit b41ccc7
Show file tree
Hide file tree
Showing 10 changed files with 490 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,46 @@ public extension Project {
]

static let demoInfoPlist: [String: InfoPlist.Value] = [
"UIMainStoryboardFile": "",
"UILaunchStoryboardName": "LaunchScreen",
"LSSupportsOpeningDocumentsInPlace": true,
"UIFileSharingEnabled": true,
"UIApplicationSceneManifest": [
"UIApplicationSupportsMultipleScenes": false,
"UISceneConfigurations": [
"UIWindowSceneSessionRoleApplication": [
[
"UISceneConfigurationName": "Default Configuration",
"UISceneDelegateClassName": "$(PRODUCT_MODULE_NAME).SceneDelegate"
],
]
]
],
"NSPhotoLibraryUsageDescription": "미션과 관련된 사진을 업로드하기 위해 갤러리 권한이 필요합니다.",
"App Transport Security Settings": ["Allow Arbitrary Loads": true],
"NSAppTransportSecurity": ["NSAllowsArbitraryLoads": true],
]
"CFBundleShortVersionString": "1.0.0",
"CFBundleDevelopmentRegion": "ko",
"CFBundleVersion": "1",
"CFBundleIdentifier": "com.sopt-stamp-iOS.test",
"CFBundleDisplayName": "SOPT-Test",
"UILaunchStoryboardName": "LaunchScreen",
"UIApplicationSceneManifest": [
"UIApplicationSupportsMultipleScenes": false,
"UISceneConfigurations": [
"UIWindowSceneSessionRoleApplication": [
[
"UISceneConfigurationName": "Default Configuration",
"UISceneDelegateClassName": "$(PRODUCT_MODULE_NAME).SceneDelegate"
],
]
]
],
"UIAppFonts": [
// FIXME: - 폰트 추가 후 수정
// "Item 0": "Pretendard-Black.otf",
// "Item 1": "Pretendard-Bold.otf",
// "Item 2": "Pretendard-ExtraBold.otf",
// "Item 3": "Pretendard-ExtraLight.otf",
// "Item 4": "Pretendard-Light.otf",
// "Item 5": "Pretendard-Medium.otf",
// "Item 6": "Pretendard-Regular.otf",
// "Item 7": "Pretendard-SemiBold.otf",
// "Item 8": "Pretendard-Thin.otf"
],
"App Transport Security Settings": ["Allow Arbitrary Loads": true],
"NSAppTransportSecurity": ["NSAllowsArbitraryLoads": true],
"ITSAppUsesNonExemptEncryption": false,
"UIUserInterfaceStyle": "Dark",
"NSPhotoLibraryUsageDescription": "미션과 관련된 사진을 업로드하기 위해 갤러리 권한이 필요합니다.",
"CFBundleURLTypes": [
[
"CFBundleTypeRole": "Editor",
"CFBundleURLName": "sopt-makers",
"CFBundleURLSchemes": ["sopt-makers"]
]
]
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "appstore.png",
"filename" : "appIcon.jpg",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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>
) {}
}
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 ?? "")
}
}
}

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) {}
}
9 changes: 0 additions & 9 deletions SOPT-iOS/Projects/Demo/SOPT-iOS-Demo/Sources/Demo.swift

This file was deleted.

Loading

0 comments on commit b41ccc7

Please sign in to comment.