Skip to content

Commit

Permalink
fix: Remove redundant code and add token setup functionality
Browse files Browse the repository at this point in the history
- Removed redundant code related to token handling in SceneDelegate.
- Added TokenSetting struct with setup function for token management.
- Created TokenSetting.swift file to handle token setup logic.
  • Loading branch information
dodo849 committed Aug 27, 2024
1 parent 36a00cc commit 23b3ed3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public struct TokenRefreshingMiddleware: ClientMiddleware {
}
}


/// Function to refresh the token.
/// - Parameter baseURL: The base URL for the API requests.
/// - Throws: An error if the token refresh fails.
Expand Down
9 changes: 1 addition & 8 deletions Projects/Noffice/Noffice/Sources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
let tabBarController = TabBarController()
Router.shared.push(tabBarController)

let tokenKeychainManager = KeychainManager<Token>()
if let token = tokenKeychainManager.get() {
print(token)
} else {
print("has no token")
Router.shared.presentFullScreen(.signup, animated: false)
}

window?.makeKeyAndVisible()

// Set setting
NotificationCenterSetting.setup()
TokenSetting.setup()

// Set config
DebugButtonConfig.setup(window: window)
Expand Down
22 changes: 22 additions & 0 deletions Projects/Noffice/Noffice/Sources/Setting/TokenSetting.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// TokenSetting.swift
// Noffice
//
// Created by DOYEON LEE on 8/28/24.
//

import KeychainUtility
import Router

@MainActor
struct TokenSetting {
static func setup() {
let tokenKeychainManager = KeychainManager<Token>()
if let token = tokenKeychainManager.get() {
print(token)
} else {
print("has no token")
Router.shared.presentFullScreen(.signup, animated: false)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public class SignupView: BaseView {
$0.width.equalTo(200)
}

dummyButton.snp.makeConstraints {
$0.left.right.equalToSuperview().inset(GlobalViewConstant.PagePadding)
$0.centerX.equalToSuperview()
$0.centerY.equalToSuperview().multipliedBy(1.5)
}
// dummyButton.snp.makeConstraints {
// $0.left.right.equalToSuperview().inset(GlobalViewConstant.PagePadding)
// $0.centerX.equalToSuperview()
// $0.centerY.equalToSuperview().multipliedBy(1.5)
// }

appleSigninButton.snp.makeConstraints {
$0.left.right.equalToSuperview().inset(GlobalViewConstant.PagePadding)
Expand Down

0 comments on commit 23b3ed3

Please sign in to comment.