Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ver 1.3.1] #68

Merged
merged 40 commits into from
Jul 29, 2024
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3d13463
[Feat]: Network Infra
Jeon0976 May 6, 2024
fd6a04b
[FEAT]: Network Infra 설계
Jeon0976 May 9, 2024
730efcf
[Feat]: DataTransfer Service 설계
Jeon0976 May 9, 2024
5e43b23
[Feat]: Infra 설계
Jeon0976 May 9, 2024
08bed71
[Feat]: DIContainer / Coordinator 설계
Jeon0976 May 9, 2024
2dd1dd5
Merge pull request #64 from AVIRO-official/Feat/DI_Coordinator
Jeon0976 May 9, 2024
9bffa71
[Refector]: Data 설계
Jeon0976 May 30, 2024
1540dc0
[Chore]
Jeon0976 Jun 15, 2024
dbc1ddc
[Chore]
Jeon0976 Jun 15, 2024
6144a04
[Chore]: Amplitude Version Update
Jeon0976 Jun 17, 2024
1ca1d65
[Chore]: App version Update
Jeon0976 Jun 17, 2024
2fc5b62
[Chore]: Pod Update
Jeon0976 Jun 28, 2024
8f5a042
[Chore]: Merge from develop
Jeon0976 Jun 28, 2024
4dee7e6
[Chore]: Assets 수정
Jeon0976 Jun 28, 2024
a88ca7d
[Feat]: Social Login Domain 추가, CFont 삭제
Jeon0976 Jun 28, 2024
2d3879d
[Feat]: Social Media Button 추가
Jeon0976 Jul 1, 2024
703ba70
[Feat]: Login ViewController UI 수정
Jeon0976 Jul 1, 2024
6c72bda
[Feat]: social login thrid party library 설치 & naver repo 설계
Jeon0976 Jul 5, 2024
4a26395
[Feat]: Naver Login 연결
Jeon0976 Jul 6, 2024
dd14db8
[Feat]: Kakao Login 연결
Jeon0976 Jul 7, 2024
d73d8bc
[Feat]: Google Login 연결
Jeon0976 Jul 7, 2024
860fce9
[Feat]: Apple Login 연결
Jeon0976 Jul 7, 2024
6e043e6
[Feat]: Social Usecase, Repo Interface 수정
Jeon0976 Jul 7, 2024
a48a7eb
[Feat]: Social Login ViewController, Presenter 수정
Jeon0976 Jul 15, 2024
cdff5a7
[Feat]: Apple Login Check Member AVIRO API 연결
Jeon0976 Jul 15, 2024
e75045c
[Feat]: Apple / Google user login & isMemeber Check 기능 설계
Jeon0976 Jul 21, 2024
dca7745
[Feat]: Kakao User Check Repo 설계
Jeon0976 Jul 22, 2024
6ae3447
[Feat]: User Check 기능 설계
Jeon0976 Jul 22, 2024
da2b4f4
[Feat]: App Controller 자동 로그인 개선
Jeon0976 Jul 23, 2024
b60f53f
[Feat]: App Controller kakao auto login 방식 설계
Jeon0976 Jul 23, 2024
fcf786e
[Feat]: Sign In 기능 구현
Jeon0976 Jul 26, 2024
f949d7c
[Fix]: 회원가입 로직 버그 수정
Jeon0976 Jul 27, 2024
8bd2352
[Feat]: Login out & Withrawal 기능 변경
Jeon0976 Jul 27, 2024
395a5be
[Feat]: Revoke User 기능 구현
Jeon0976 Jul 27, 2024
088eaf4
Merge pull request #67 from AVIRO-official/Feature/SocialLogin
Jeon0976 Jul 27, 2024
0bfd466
[Feat]: Tutorial 기능 수정 & 회원 상태 Label 추가
Jeon0976 Jul 28, 2024
98ddbc0
[Chore]: Version update
Jeon0976 Jul 28, 2024
4f4c322
[Feat]: 후기 등록 디자인 요청사항 적용
Jeon0976 Jul 29, 2024
46d191e
[Feat]: home tutorial page 수정
Jeon0976 Jul 29, 2024
a50dbbb
[Chore]: Version Update
Jeon0976 Jul 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
778 changes: 769 additions & 9 deletions AVIRO.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file removed AVIRO/AVIRO-PrivacyReport 2024-04-13 14-28-13.pdf
Binary file not shown.
142 changes: 119 additions & 23 deletions AVIRO/App/AppController.swift
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@ final class AppController {
private let keychain = KeychainSwift()
private let amplitude = AmplitudeUtility()

private let socialLoginUsecase: SocialLoginUseCase

private var window: UIWindow!
private var rootViewController: UIViewController? {
didSet {
@@ -24,42 +26,81 @@ final class AppController {
}
}

private init() { }
private init() {
let container = DIContainer.shared

self.socialLoginUsecase = SocialLoginUseCase(
appleLoginRepository: container.resolve(AppleAuthRepository.self)!,
googleLoginRepository: container.resolve(GoogleAuthRepository.self)!,
kakaoLoginRepository: container.resolve(KakaoAuthRepository.self)!,
naverLoginRepository: container.resolve(NaverAuthRepository.self)!
)
}

// MARK: 외부랑 소통할 메서드
func show(in window: UIWindow) {
self.window = window
window.backgroundColor = .gray7

checkState()
// setTabBarView()
checkLoginType()
}

func setupLoginViewAfterLogout(in window: UIWindow, with type: LoginViewToastType) {
self.window = window
window.backgroundColor = .gray7

setLoginView(type: type)
}

// MARK: 불러올 view 확인 메서드
private func checkState() {
let userKey = keychain.get(KeychainKey.appleRefreshToken.rawValue)

private func checkLoginType() {
// 최초 튜토리얼 화면 안 봤을 때
guard UserDefaults.standard.bool(forKey: UDKey.tutorial.rawValue) else {
setTutorialView()
return
}

// 자동로그인 토큰 없을 때
guard let userKey = userKey else {

if let loginType = UserDefaults.standard.string(forKey: UDKey.loginType.rawValue) {
switch loginType {
case "apple":
checkMemberFromApple()
case "google", "kakao", "naver":
checkMemberFromOthers()
case "none":
setLoginView()
default:
setLoginView()
}
} else {
// login type 업데이트 전 자동로그인 적용을 위해 사전 작업
if let userKey = keychain.get(KeychainKey.appleRefreshToken.rawValue) {
UserDefaults.standard.set(
LoginTypeKey.apple.rawValue,
forKey: UDKey.loginType.rawValue
)

keychain.set(
userKey,
forKey: KeychainKey.refreshToken.rawValue
)

keychain.delete(KeychainKey.appleRefreshToken.rawValue)

checkMemberFromApple()
} else {
UserDefaults.standard.set(
LoginTypeKey.none.rawValue,
forKey: UDKey.loginType.rawValue
)

setLoginView()
}
}
}

private func checkMemberFromApple() {
keychain.delete(KeychainKey.userID.rawValue)

guard let refreshToken = keychain.get(KeychainKey.refreshToken.rawValue) else {
setLoginView()
return
}

let userCheck = AVIROAutoLoginWhenAppleUserDTO(refreshToken: userKey)

let userCheck = AVIROAutoLoginWhenAppleUserDTO(refreshToken: refreshToken)
AVIROAPI.manager.checkAppleUserWhenInitiate(with: userCheck) { [weak self] result in
DispatchQueue.main.async {
switch result {
@@ -73,20 +114,61 @@ final class AppController {
userNickname: data.nickname,
marketingAgree: data.marketingAgree
)

self?.setTabBarView()
}
} else {
self?.keychain.delete(KeychainKey.appleRefreshToken.rawValue)
self?.keychain.delete(KeychainKey.refreshToken.rawValue)
self?.setLoginView()
}
case .failure:
self?.keychain.delete(KeychainKey.appleRefreshToken.rawValue)
case .failure(_):
self?.keychain.delete(KeychainKey.refreshToken.rawValue)
self?.setLoginView()
}
}
}
}

private func checkMemberFromOthers() {
keychain.delete(KeychainKey.refreshToken.rawValue)

guard let userID = keychain.get(KeychainKey.userID.rawValue) else {
print("ADAWDAW")
setLoginView()
return
}

let userCheck = AVIROKakaoUserCheckMemberDTO(userId: userID)
print("TSET")
AVIROAPI.manager.checkKakaoUserWhenLogin(with: userCheck) { [weak self] result in
DispatchQueue.main.async {
switch result {
case .success(let model):
if model.statusCode == 200 {
if let data = model.data {
MyData.my.whenLogin(
userId: userID,
userName: "",
userEmail: "",
userNickname: data.nickname,
marketingAgree: data.marketingAgree
)

self?.setTabBarView()
}
} else {
self?.keychain.delete(KeychainKey.userID.rawValue)
self?.setLoginView()
}
case .failure(_):
self?.keychain.delete(KeychainKey.userID.rawValue)
self?.setLoginView()
}
}
}

}

// MARK: tutorial View
private func setTutorialView() {
let tutorialVC = TutorialViewController()
@@ -97,7 +179,11 @@ final class AppController {
// MARK: login View
private func setLoginView(type: LoginViewToastType = .none) {
let loginVC = LoginViewController()
let presenter = LoginViewPresenter(viewController: loginVC)
let presenter = LoginViewPresenter(
socialLoginUseCase: socialLoginUsecase,
viewController: loginVC
)

loginVC.presenter = presenter

switch type {
@@ -126,4 +212,14 @@ final class AppController {

rootViewController = tabBarVC
}

func setupLoginViewAfterLogout(
in window: UIWindow,
with type: LoginViewToastType
) {
self.window = window
window.backgroundColor = .gray7

setLoginView(type: type)
}
}
26 changes: 25 additions & 1 deletion AVIRO/App/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
//

import UIKit
import AuthenticationServices
// import AuthenticationServices

import NMapsMap
import AmplitudeSwift
@@ -23,6 +23,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
self.setNaverMapAPI()
self.setAmplitude()

self.registerRepository()

return true
}

@@ -73,4 +75,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

amplitude = Amplitude(configuration: Configuration(apiKey: key))
}

private func registerRepository() {
DIContainer.shared.register(
AppleAuthRepository.self,
dependency: AppleAuthRepository()
)

DIContainer.shared.register(
GoogleAuthRepository.self,
dependency: GoogleAuthRepository()
)

DIContainer.shared.register(
KakaoAuthRepository.self,
dependency: KakaoAuthRepository()
)

DIContainer.shared.register(
NaverAuthRepository.self,
dependency: NaverAuthRepository()
)
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
34 changes: 34 additions & 0 deletions AVIRO/App/DIContainer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// DIContainer.swift
// AVIRO
//
// Created by 전성훈 on 5/10/24.
//

import Foundation

final class DIContainer {
static let shared = DIContainer()

private var dependencies: [String: AnyObject] = [:]

private init() { }

func register<T: AnyObject>(_ type: T.Type, dependency: T) {
let key = String(describing: type)

dependencies[key] = dependency
}

func resolve<T: AnyObject>(_ type: T.Type) -> T? {
let key = String(describing: type)

guard let value = dependencies[key] as? T else {
printIfDebug("---- 의존성 key 값을 찾지 못했습니다 \(key) ----")

return nil
}

return value
}
}
38 changes: 38 additions & 0 deletions AVIRO/App/Info.plist
Original file line number Diff line number Diff line change
@@ -2,10 +2,48 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleLocalizations</key>
<array>
<string>ko</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.310817462771-q5o6bv76a0os9lgqaqfico9jomv7fvkc</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.aviro.ios</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>kakaoa880a81ee8796717e8d6e517630fff5d</string>
</array>
</dict>
</array>
<key>GIDClientID</key>
<string>310817462771-q5o6bv76a0os9lgqaqfico9jomv7fvkc.apps.googleusercontent.com</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>kakaokompassauth</string>
<string>kakaolink</string>
<string>naversearchapp</string>
<string>naversearchthridlogin</string>
</array>
<key>UIAppFonts</key>
<array>
<string>Pretendard-Black.otf</string>
29 changes: 29 additions & 0 deletions AVIRO/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -7,6 +7,10 @@

import UIKit

import NaverThirdPartyLogin
import KakaoSDKAuth
import GoogleSignIn

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?
@@ -32,4 +36,29 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}
}
}

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let urlContext = URLContexts.first else { return }
let url = urlContext.url
print(url)

// Naver
if url.scheme == "com.aviro.ios" {
NaverThirdPartyLoginConnection
.getSharedInstance()
.receiveAccessToken(url)

return
}

// Kakao
if AuthApi.isKakaoTalkLoginUrl(url) {
_ = AuthController.handleOpenUrl(url: url)

return
}

// Google
GIDSignIn.sharedInstance.handle(url)
}
}
12 changes: 12 additions & 0 deletions AVIRO/Common/Cancellable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Cancellable.swift
// AVIRO
//
// Created by 전성훈 on 7/6/24.
//

import Foundation

protocol Cancellable {
func cancel()
}
12 changes: 12 additions & 0 deletions AVIRO/Common/printIfDebug.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// printIfDebug.swift
// AVIRO
//
// Created by 전성훈 on 5/10/24.
//

func printIfDebug(_ string: String) {
#if DEBUG
print(string)
#endif
}
Loading