Skip to content

Commit

Permalink
Merge branch 'feature/DesingnQA' of https://github.com/DDD-Community/…
Browse files Browse the repository at this point in the history
…OPeace into Release
  • Loading branch information
Roy-wonji committed Nov 12, 2024
2 parents 2e9b5a3 + 9b0329d commit 24e67db
Show file tree
Hide file tree
Showing 130 changed files with 8,412 additions and 6,904 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public extension TargetDependency.SPM {

static let firebaseAuth = TargetDependency.external(name: "FirebaseAuth", condition: .none)
static let firebaseAnalytics = TargetDependency.external(name: "FirebaseAnalytics", condition: .none)
static let firebaseRemoteConfig = TargetDependency.external(name: "FirebaseRemoteConfig", condition: .none)
static let firebaseCrashlytics = TargetDependency.external(name: "FirebaseCrashlytics", condition: .none)
static let swiftUIIntrospect = TargetDependency.external(name: "SwiftUIIntrospect", condition: .none)
static let isEmojiView = TargetDependency.external(name: "ISEmojiView", condition: .none)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import ProjectDescription

extension String {
public static func appVersion(version: String = "1.0.0") -> String {
public static func appVersion(version: String = "1.0.1") -> String {
return version
}

Expand Down
98 changes: 89 additions & 9 deletions OPeace/Projects/App/OPeace.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

84 changes: 41 additions & 43 deletions OPeace/Projects/App/OpeaceTests/Sources/ProfileTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,49 @@ import Utills

@MainActor
struct ProfileTest {
let store = TestStore(initialState: Profile.State()) {
Profile()
} withDependencies: {
let repository = AuthRepository()
$0.authUseCase = AuthUseCase(repository: repository)
let store = TestStore(initialState: Profile.State()) {
Profile()
} withDependencies: {
let repository = AuthRepository()
$0.authUseCase = AuthUseCase(repository: repository)
}

@Test("유저 정보 조회")
func testUserInfo_유저정보_조회() async throws {
var mockUpdateUserInfo = UpdateUserInfoDTOModel.mockModel

await store.send(.async(.fetchUserProfileResponse(.success(mockUpdateUserInfo)))) { state in
state.profileUserModel = mockUpdateUserInfo
}

@Test("유저 정보 조회")
func testUserInfo_유저정보_조회() async throws {
var mockUpdateUserInfo = UpdateUserInfoModel.mockModel

await store.send(.async(.fetchUserProfileResponse(.success(mockUpdateUserInfo)))) { state in
state.profileUserModel = mockUpdateUserInfo
}

await store.send(.async(.fetchUser))

store.assert { state in
state.profileUserModel = mockUpdateUserInfo
}

let mockError = CustomError.unknownError("Failed to fetch user info")


await store.send(.async(.fetchUserProfileResponse(.failure(mockError)))) {
XCTAssertNil($0.profileUserModel)
}



await store.finish()
store.exhaustivity = .off

await store.send(.async(.fetchUser))

store.assert { state in
state.profileUserModel = mockUpdateUserInfo
}

@Test("유저 정보 업데이트")
func testUserInfo_유저정보_업데이트() async throws {
let testEditStore = TestStore(initialState: EditProfile.State()) {
EditProfile()
} withDependencies: {
let repository = AuthRepository()
$0.authUseCase = AuthUseCase(repository: repository)
let signupRepository = SingUpRepository()
$0.signUpUseCase = SignUpUseCase(repository: signupRepository)
}

await testEditStore.send(.async(.updateUserInfo(nickName: "로이", year: 1998, job: "개발", generation: "Z 세대")))
let mockError = CustomError.unknownError("Failed to fetch user info")


await store.send(.async(.fetchUserProfileResponse(.failure(mockError)))) {
XCTAssertNil($0.profileUserModel)
}

await store.finish()
store.exhaustivity = .off
}

@Test("유저 정보 업데이트")
func testUserInfo_유저정보_업데이트() async throws {
let testEditStore = TestStore(initialState: EditProfile.State()) {
EditProfile()
} withDependencies: {
let repository = AuthRepository()
$0.authUseCase = AuthUseCase(repository: repository)
let signupRepository = SingUpRepository()
$0.signUpUseCase = SignUpUseCase(repository: signupRepository)
}

await testEditStore.send(.async(.updateUserInfo(nickName: "로이", year: 1998, job: "개발", generation: "Z 세대")))
}
}
10 changes: 10 additions & 0 deletions OPeace/Projects/App/Sources/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@
//
import UIKit
import Firebase
import FirebaseRemoteConfig

class AppDelegate: UIResponder, UIApplicationDelegate {
var remoteConfig: RemoteConfig!
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
FirebaseConfiguration.shared.setLoggerLevel(FirebaseLoggerLevel.min)
remoteConfig = RemoteConfig.remoteConfig()
let settings = RemoteConfigSettings()
settings.minimumFetchInterval = 0
remoteConfig.configSettings = settings
remoteConfig.setDefaults(fromPlist: "RemoteConfigDefaults")
return true
}



func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// OAuthDTOModel.swift
// Model
//
// Created by Wonji Suh on 11/10/24.
//

import Foundation

public struct OAuthDTOModel: Codable, Equatable {
public let data: OAuthReponseDTOModel

public init(
data: OAuthReponseDTOModel
) {
self.data = data
}
}

public struct OAuthReponseDTOModel: Codable, Equatable {
public let accessToken: String
public let refreshToken: String


public init(accessToken: String, refreshToken: String) {
self.accessToken = accessToken
self.refreshToken = refreshToken
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Extension+AppleTokenResponse.swift
// Model
//
// Created by Wonji Suh on 11/10/24.
//

import Foundation

public extension AppleTokenResponse {
func toOAuthDTOToModel() -> OAuthDTOModel {
let data: OAuthReponseDTOModel = .init(
accessToken: self.access_token ?? "",
refreshToken: self.refresh_token ?? "")

return OAuthDTOModel(data: data)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Extension+KakaoResponseModel.swift
// Model
//
// Created by Wonji Suh on 11/10/24.
//

public extension UserLoginModel {
func toOAuthDTOModel() -> OAuthDTOModel {
let data: OAuthReponseDTOModel = .init(
accessToken: self.data?.accessToken ?? "",
refreshToken: self.data?.refreshToken ?? ""
)

return OAuthDTOModel(data: data)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
import Foundation

// MARK: - Welcome
public struct UserLoginModel: Codable, Equatable {
public let data: UserLoginResponse?
public struct UserLoginModel: Decodable {
let data: UserLoginResponse?

public init(data: UserLoginResponse?) {
init(data: UserLoginResponse?) {
self.data = data
}
}

public struct UserLoginResponse: Codable, Equatable {
public let socialID, accessToken, refreshToken: String?
public let expiresIn, refreshTokenExpiresIn: Int?
public let isExpires, isRefreshTokenExpires: Bool?
struct UserLoginResponse: Decodable {
let socialID, accessToken, refreshToken: String?
let expiresIn, refreshTokenExpiresIn: Int?
let isExpires, isRefreshTokenExpires: Bool?


enum CodingKeys: String, CodingKey {
Expand Down
Loading

0 comments on commit 24e67db

Please sign in to comment.