Skip to content

Commit

Permalink
Merge pull request #131 from TeamFILL-IN/feat/#126
Browse files Browse the repository at this point in the history
โœจ[FEAT] #126 - ์• ํ”Œ ๋กœ๊ทธ์ธ ๊ตฌํ˜„
  • Loading branch information
dlwns33 authored Mar 10, 2022
2 parents d366ada + 9d5be8e commit 38de694
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 67 deletions.
19 changes: 10 additions & 9 deletions Fillin-iOS/Fillin-iOS/Resources/Constants/Header.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NDA4MDI4NywiZXhwIjoxNjQ1Mjg5ODg3LCJpc3MiOiJmaWxsaW4ifQ.2nXlLuXzsOdrQaVDaSldfEC86XOzTn9E4Zn5grzNifA"]
static var multiTokenHeader = [
"Content-Type": "multipart/form-data",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOm51bGwsImlhdCI6MTY0NDA4MDI4NywiZXhwIjoxNjQ1Mjg5ODg3LCJpc3MiOiJmaWxsaW4ifQ.2nXlLuXzsOdrQaVDaSldfEC86XOzTn9E4Zn5grzNifA"]

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"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ extension Const {
static let refreshToken = "refreshToken"
static let nickname = "nickname"
static let userID = "userID"
static let isOnboarding = "isOnboarding"
}
}
7 changes: 7 additions & 0 deletions Fillin-iOS/Fillin-iOS/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
109 changes: 61 additions & 48 deletions Fillin-iOS/Fillin-iOS/Sources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}


}

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 38de694

Please sign in to comment.