From f18e5063f31c523195da50e256acaa9152fc89b4 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Thu, 10 Mar 2022 13:51:30 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=85[CHORE]=20=20#126=20-=20=ED=97=A4?= =?UTF-8?q?=EB=8D=94=EC=97=90=20=ED=86=A0=ED=81=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift b/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift index 6823b73..5e264bc 100644 --- a/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift +++ b/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift @@ -12,10 +12,10 @@ extension Const { // static var tokenHeader = ["Content-Type": "application/json", // "token": accessToken] static var tokenHeader = ["Content-Type": "application/json", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NDA4MDI4NywiZXhwIjoxNjQ1Mjg5ODg3LCJpc3MiOiJmaWxsaW4ifQ.2nXlLuXzsOdrQaVDaSldfEC86XOzTn9E4Zn5grzNifA"] + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NjMyNjgxNCwiZXhwIjoxNjQ3NTM2NDE0LCJpc3MiOiJmaWxsaW4ifQ.BqXKeusdrBVWzt0HsIAM6wlG-VxcHw8qMEF9BSn0aEs"] static var multiTokenHeader = [ "Content-Type": "multipart/form-data", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NDA4MDI4NywiZXhwIjoxNjQ1Mjg5ODg3LCJpc3MiOiJmaWxsaW4ifQ.2nXlLuXzsOdrQaVDaSldfEC86XOzTn9E4Zn5grzNifA"] + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NjMyNjgxNCwiZXhwIjoxNjQ3NTM2NDE0LCJpc3MiOiJmaWxsaW4ifQ.BqXKeusdrBVWzt0HsIAM6wlG-VxcHw8qMEF9BSn0aEs"] static let loginHeader = ["Content-Type": "application/x-www-form-urlencoded"] } From c831f7ac34e5b7337838a0ea22c4bef38ad4debc Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Thu, 10 Mar 2022 13:52:05 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8[FEAT]=20#126=20-=20=EC=98=A8?= =?UTF-8?q?=EB=B3=B4=EB=94=A9=20=EB=B7=B0=EC=BB=A8=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EA=B0=80=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SplashViewController/SplashViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/SplashViewController/SplashViewController.swift b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/SplashViewController/SplashViewController.swift index 03f07bc..34f07b4 100644 --- a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/SplashViewController/SplashViewController.swift +++ b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/SplashViewController/SplashViewController.swift @@ -52,7 +52,7 @@ extension SplashViewController { } private func presentToOnboarding() { - let onboardingNavigationController = UINavigationController(rootViewController: OnboardingFirstViewController()) + let onboardingNavigationController = UINavigationController(rootViewController: OnboardingViewController()) onboardingNavigationController.modalPresentationStyle = .fullScreen onboardingNavigationController.modalTransitionStyle = .crossDissolve self.present(onboardingNavigationController, animated: true, completion: nil) From 5acaade2342867c428aeab267f1b8a1a6b58d3f6 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Thu, 10 Mar 2022 13:58:03 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9C=A8[FEAT]=20#126=20-=20=EC=98=A8?= =?UTF-8?q?=EB=B3=B4=EB=94=A9=EC=97=90=EC=84=9C=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=EB=B7=B0=EB=A1=9C=20=EB=84=98=EC=96=B4=EA=B0=80?= =?UTF-8?q?=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OnboardingViewController.swift | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/OnboardingViewController/OnboardingViewController.swift b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/OnboardingViewController/OnboardingViewController.swift index 34250b6..7d25935 100644 --- a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/OnboardingViewController/OnboardingViewController.swift +++ b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/OnboardingViewController/OnboardingViewController.swift @@ -125,16 +125,10 @@ extension OnboardingViewController { ]) } @objc func skipButtonClicked() { - if currentPage == onboardingData.count - 1 { - let mainNavigationController = UINavigationController(rootViewController: HomeViewController()) - mainNavigationController.modalPresentationStyle = .fullScreen - mainNavigationController.modalTransitionStyle = .crossDissolve - self.present(mainNavigationController, animated: true, completion: nil) - } else { let loginVC = LoginViewController() loginVC.modalPresentationStyle = .fullScreen + loginVC.modalTransitionStyle = .crossDissolve self.present(loginVC, animated: true, completion: nil) - } } } // MARK: - CollectionView Delegate, DataSource From b63f840362f590c9c8ac00544af781c3c7a4bcc4 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Thu, 10 Mar 2022 14:35:21 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8[FEAT]=20#126=20-=20=EC=95=A0?= =?UTF-8?q?=ED=94=8C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=98=A8=EB=B3=B4=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/Constants/Header.swift | 19 +-- .../Resources/Constants/UserDefaultsKey.swift | 1 + .../Fillin-iOS/Sources/AppDelegate.swift | 7 ++ .../Fillin-iOS/Sources/SceneDelegate.swift | 109 ++++++++++-------- .../LoginViewController.swift | 4 +- 5 files changed, 82 insertions(+), 58 deletions(-) diff --git a/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift b/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift index 5e264bc..9fa9878 100644 --- a/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift +++ b/Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift @@ -9,14 +9,15 @@ import Foundation extension Const { struct Header { - // static var tokenHeader = ["Content-Type": "application/json", - // "token": accessToken] - static var tokenHeader = ["Content-Type": "application/json", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NjMyNjgxNCwiZXhwIjoxNjQ3NTM2NDE0LCJpc3MiOiJmaWxsaW4ifQ.BqXKeusdrBVWzt0HsIAM6wlG-VxcHw8qMEF9BSn0aEs"] - static var multiTokenHeader = [ - "Content-Type": "multipart/form-data", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NjMyNjgxNCwiZXhwIjoxNjQ3NTM2NDE0LCJpc3MiOiJmaWxsaW4ifQ.BqXKeusdrBVWzt0HsIAM6wlG-VxcHw8qMEF9BSn0aEs"] - - static let loginHeader = ["Content-Type": "application/x-www-form-urlencoded"] + static var tokenHeader = ["Content-Type": "application/json", + "token": accessToken] + static var multiTokenHeader = ["Content-Type": "multipart/form-data", + "token": accessToken] + static let loginHeader = ["Content-Type": "application/x-www-form-urlencoded"] +// static var tokenHeader = ["Content-Type": "application/json", +// "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NjMyNjgxNCwiZXhwIjoxNjQ3NTM2NDE0LCJpc3MiOiJmaWxsaW4ifQ.BqXKeusdrBVWzt0HsIAM6wlG-VxcHw8qMEF9BSn0aEs"] +// static var multiTokenHeader = [ +// "Content-Type": "multipart/form-data", +// "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NjMyNjgxNCwiZXhwIjoxNjQ3NTM2NDE0LCJpc3MiOiJmaWxsaW4ifQ.BqXKeusdrBVWzt0HsIAM6wlG-VxcHw8qMEF9BSn0aEs"] } } diff --git a/Fillin-iOS/Fillin-iOS/Resources/Constants/UserDefaultsKey.swift b/Fillin-iOS/Fillin-iOS/Resources/Constants/UserDefaultsKey.swift index d32baff..7fb7f2a 100644 --- a/Fillin-iOS/Fillin-iOS/Resources/Constants/UserDefaultsKey.swift +++ b/Fillin-iOS/Fillin-iOS/Resources/Constants/UserDefaultsKey.swift @@ -13,5 +13,6 @@ extension Const { static let refreshToken = "refreshToken" static let nickname = "nickname" static let userID = "userID" + static let isOnboarding = "isOnboarding" } } diff --git a/Fillin-iOS/Fillin-iOS/Sources/AppDelegate.swift b/Fillin-iOS/Fillin-iOS/Sources/AppDelegate.swift index 1d9ba7b..0d19fa4 100644 --- a/Fillin-iOS/Fillin-iOS/Sources/AppDelegate.swift +++ b/Fillin-iOS/Fillin-iOS/Sources/AppDelegate.swift @@ -37,6 +37,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } } } + + // 앱 실행 중 애플 ID 강제로 연결 취소 시 + NotificationCenter.default.addObserver(forName: ASAuthorizationAppleIDProvider.credentialRevokedNotification, object: nil, queue: nil) { (Notification) in + print("Revoked Notification") + self.isLogin = false + } + return true } diff --git a/Fillin-iOS/Fillin-iOS/Sources/SceneDelegate.swift b/Fillin-iOS/Fillin-iOS/Sources/SceneDelegate.swift index 43fb6cf..ebc5c3c 100644 --- a/Fillin-iOS/Fillin-iOS/Sources/SceneDelegate.swift +++ b/Fillin-iOS/Fillin-iOS/Sources/SceneDelegate.swift @@ -8,53 +8,66 @@ import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { - - var window: UIWindow? - - - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). - guard let _ = (scene as? UIWindowScene) else { return } - self.window = UIWindow(windowScene: scene as! UIWindowScene) - window?.rootViewController = SplashViewController() - window?.makeKeyAndVisible() - DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { - let homeNavigationController = UINavigationController(rootViewController: OnboardingViewController()) - self.window?.rootViewController = homeNavigationController - self.window?.makeKeyAndVisible() - } - } - - func sceneDidDisconnect(_ scene: UIScene) { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). - } - - func sceneDidBecomeActive(_ scene: UIScene) { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. - } - - func sceneWillResignActive(_ scene: UIScene) { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). - } - - func sceneWillEnterForeground(_ scene: UIScene) { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. - } - - func sceneDidEnterBackground(_ scene: UIScene) { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. - } - - + + var window: UIWindow? + + // MARK: - Properties + private weak var appDelegate = UIApplication.shared.delegate as? AppDelegate + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + self.window = UIWindow(windowScene: scene as! UIWindowScene) + window?.rootViewController = SplashViewController() + window?.makeKeyAndVisible() + + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { + var homeNavigationController: UINavigationController + + if self.appDelegate?.isLogin == true { + homeNavigationController = UINavigationController(rootViewController: HomeViewController()) + } else { + if UserDefaults.standard.object(forKey: Const.UserDefaultsKey.isOnboarding) != nil { + homeNavigationController = UINavigationController(rootViewController: LoginViewController()) + } else { + homeNavigationController = UINavigationController(rootViewController: OnboardingViewController()) + } + } + self.window?.rootViewController = homeNavigationController + self.window?.makeKeyAndVisible() + } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + } diff --git a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/LoginViewController/LoginViewController.swift b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/LoginViewController/LoginViewController.swift index f280f90..70f9ea0 100644 --- a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/LoginViewController/LoginViewController.swift +++ b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/LoginViewController/LoginViewController.swift @@ -107,7 +107,9 @@ extension LoginViewController { let mainNavigationController = UINavigationController(rootViewController: HomeViewController()) mainNavigationController.modalPresentationStyle = .fullScreen mainNavigationController.modalTransitionStyle = .crossDissolve - self.present(mainNavigationController, animated: true, completion: nil) + self.present(mainNavigationController, animated: true) { + UserDefaults.standard.set(false, forKey: Const.UserDefaultsKey.isOnboarding) + } } } From 9d5be8e29d55d53c118c91b00d16037f4a784d52 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Thu, 10 Mar 2022 15:01:16 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E2=9C=A8[FEAT]=20#126=20-=20=EB=8B=89?= =?UTF-8?q?=EB=84=A4=EC=9E=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeViewController/HomeViewController.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/HomeViewController/HomeViewController.swift b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/HomeViewController/HomeViewController.swift index 601f2c9..c120e98 100644 --- a/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/HomeViewController/HomeViewController.swift +++ b/Fillin-iOS/Fillin-iOS/Sources/ViewControllers/HomeViewController/HomeViewController.swift @@ -93,8 +93,7 @@ extension HomeViewController: UITableViewDataSource { guard let welcomeCell = tableView.dequeueReusableCell(withIdentifier: Const.Xib.welcomeTableViewCell, for: indexPath) as? WelcomeTableViewCell else { return UITableViewCell() } -// welcomeCell.nickNameLabel.text = ("\(UserDefaults.standard.string(forKey: Const.UserDefaultsKey.nickname) ?? "")님 , 좋은 아침이에요!") - welcomeCell.nickNameLabel.text = "찰칵찰칵 이필린님, 좋은 아침이에요!" + welcomeCell.nickNameLabel.text = ("\(UserDefaults.standard.string(forKey: Const.UserDefaultsKey.nickname) ?? "")님 , 좋은 아침이에요!") return welcomeCell case 1 : guard let tabBarCell = tableView.dequeueReusableCell(withIdentifier: Const.Xib.tabBarTableViewCell, for: indexPath) as? TabBarTableViewCell else {