Skip to content

Commit 43a24e3

Browse files
authored
Merge pull request #192 from Nexters/release/1.0.1
v1.0.1 Release -> Main
2 parents 7dc05ef + e28cc4f commit 43a24e3

File tree

33 files changed

+358
-52
lines changed

33 files changed

+358
-52
lines changed

Plugins/DependencyPlugin/ProjectDescriptionHelpers/Modules.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public extension ModulePath {
4747

4848
public extension ModulePath {
4949
enum Domain: String, CaseIterable {
50+
case User
5051
case Report
5152
case WebView
5253
case Bottle

Projects/Domain/Auth/Interface/Sources/AuthClient.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public struct AuthClient {
1818
private let _revokeAppleLogin: () async throws -> Void
1919
private let fetchAppleClientSecret: () async throws -> String
2020
private let registerUserProfile: (String) async throws -> Void
21+
private let _removeAllToken: () -> Void
2122

2223
public init(
2324
signInWithKakao: @escaping () async throws -> UserInfo,
@@ -29,7 +30,8 @@ public struct AuthClient {
2930
refreshAppleToken: @escaping () async throws -> AppleToken,
3031
revokeAppleLogin: @escaping () async throws -> Void,
3132
fetchAppleClientSecret: @escaping () async throws -> String,
32-
registerUserProfile: @escaping (String) async throws -> Void
33+
registerUserProfile: @escaping (String) async throws -> Void,
34+
removeAllToken: @escaping () -> Void
3335
) {
3436
self.signInWithKakao = signInWithKakao
3537
self.signInWithApple = signInWithApple
@@ -41,6 +43,7 @@ public struct AuthClient {
4143
self._revokeAppleLogin = revokeAppleLogin
4244
self.fetchAppleClientSecret = fetchAppleClientSecret
4345
self.registerUserProfile = registerUserProfile
46+
self._removeAllToken = removeAllToken
4447
}
4548

4649
public func signInWithKakao() async throws -> UserInfo {
@@ -81,5 +84,9 @@ public struct AuthClient {
8184
public func registerUserProfile(userName: String) async throws {
8285
try await registerUserProfile(userName)
8386
}
87+
88+
public func removeAllToken() {
89+
_removeAllToken()
90+
}
8491
}
8592

Projects/Domain/Auth/Sources/AuthClient.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ extension AuthClient: DependencyKey {
8484
registerUserProfile: { userName in
8585
let requestDTO = ProfileRequestDTO(name: userName)
8686
try await networkManager.reqeust(api: .apiType(AuthAPI.profile(requestDTO)))
87+
},
88+
removeAllToken: {
89+
LocalAuthDataSourceImpl.removeAllToken()
8790
}
8891
)
8992
}

Projects/Domain/Auth/Sources/DataSource/LocalAuthDataSourceImpl.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ struct LocalAuthDataSourceImpl: LocalAuthDataSource {
2525
static func checkTokeinIsExist() -> Bool {
2626
return !KeyChainTokenStore.shared.load(property: .accessToken).isEmpty
2727
}
28+
29+
static func removeAllToken() {
30+
KeyChainTokenStore.shared.deleteAll()
31+
}
2832
}

Projects/Domain/Bottle/Interface/Sources/API/BottleAPI.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public enum BottleAPI {
1717
bottleID: Int,
1818
registerLetterAnswerRequestDTO: RegisterLetterAnswerRequestDTO
1919
)
20+
case readBottle(bottleID: Int)
2021
case imageShare(
2122
bottleID: Int,
2223
imageShareRequestDTO: BottleImageShareRequestDTO
@@ -37,6 +38,8 @@ extension BottleAPI: BaseTargetType {
3738
return "api/v1/bottles/ping-pong"
3839
case let .fetchBottlePingPong(bottleID):
3940
return "api/v1/bottles/ping-pong/\(bottleID)"
41+
case let .readBottle(bottleID):
42+
return "api/v1/bottles/ping-pong/\(bottleID)/read"
4043
case let .registerLetterAnswer(bottleID, _):
4144
return "api/v1/bottles/ping-pong/\(bottleID)/letters"
4245
case let .imageShare(bottleID, _):
@@ -56,6 +59,8 @@ extension BottleAPI: BaseTargetType {
5659
return .get
5760
case .fetchBottlePingPong:
5861
return .get
62+
case .readBottle:
63+
return .post
5964
case .registerLetterAnswer:
6065
return .post
6166
case .imageShare:
@@ -75,6 +80,8 @@ extension BottleAPI: BaseTargetType {
7580
return .requestPlain
7681
case .fetchBottlePingPong:
7782
return .requestPlain
83+
case .readBottle:
84+
return .requestPlain
7885
case let .registerLetterAnswer(_, registerLetterAnswerRequestDTO):
7986
return .requestJSONEncodable(registerLetterAnswerRequestDTO)
8087
case let .imageShare(_, imageShareRequestDTO):

Projects/Domain/Bottle/Interface/Sources/BottleClient.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public struct BottleClient {
1212
private let fetchUserBottleInfo: () async throws -> UserBottleInfo
1313
private let fetchBottleStorageList: () async throws -> BottleStorageList
1414
private let fetchBottlePingPong: (_ bottleID: Int) async throws -> BottlePingPong
15+
private let readBottle: (_ bottleID: Int) async throws -> Void
1516
private let registerLetterAnswer: (_ bottleID: Int, _ order: Int, _ answer: String) async throws -> Void
1617
private let shareImage: (_ bottleID: Int, _ willShare: Bool) async throws -> Void
1718
private let finalSelect: (_ bottleID: Int, _ willMatch: Bool) async throws -> Void
@@ -21,6 +22,7 @@ public struct BottleClient {
2122
fetchUserBottleInfo: @escaping () async throws -> UserBottleInfo,
2223
fetchBottleStorageList: @escaping () async throws -> BottleStorageList,
2324
fetchBottlePingPong: @escaping (_ bottleID: Int) async throws -> BottlePingPong,
25+
readBottle: @escaping (_ bottleID: Int) async throws -> Void,
2426
registerLetterAnswer: @escaping (_ bottleID: Int, _ order: Int, _ answer: String) async throws -> Void,
2527
shareImage: @escaping (_ bottleID: Int, _ willShare: Bool) async throws -> Void,
2628
finalSelect: @escaping (_ bottleID: Int, _ willMatch: Bool) async throws -> Void,
@@ -29,6 +31,7 @@ public struct BottleClient {
2931
self.fetchUserBottleInfo = fetchUserBottleInfo
3032
self.fetchBottleStorageList = fetchBottleStorageList
3133
self.fetchBottlePingPong = fetchBottlePingPong
34+
self.readBottle = readBottle
3235
self.registerLetterAnswer = registerLetterAnswer
3336
self.shareImage = shareImage
3437
self.finalSelect = finalSelect
@@ -47,6 +50,10 @@ public struct BottleClient {
4750
try await fetchBottlePingPong(bottleID)
4851
}
4952

53+
public func readBottle(bottleID: Int) async throws {
54+
try await readBottle(bottleID)
55+
}
56+
5057
public func registerLetterAnswer(bottleID: Int, order: Int, answer: String) async throws {
5158
try await registerLetterAnswer(bottleID, order, answer)
5259
}

Projects/Domain/Bottle/Interface/Sources/Entity/BottleStorageList.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public struct BottleStorageList: Decodable {
2222
public struct BottleStorageItem: Decodable, Equatable {
2323
public let age: Int?
2424
public let id: Int
25-
public let isRead: Bool?
25+
public let isRead: Bool
2626
public let keyword: [String]
2727
public let mbti: String
2828
public let userImageUrl: String
@@ -31,7 +31,7 @@ public struct BottleStorageItem: Decodable, Equatable {
3131
public init(
3232
age: Int?,
3333
id: Int,
34-
isRead: Bool?,
34+
isRead: Bool,
3535
keyword: [String],
3636
mbti: String,
3737
userImageUrl: String,

Projects/Domain/Bottle/Sources/BottleClient.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ extension BottleClient: DependencyKey {
3636
).toDomain()
3737
return bottlePingPong
3838
},
39+
readBottle: { id in
40+
try await networkManager.reqeust(api: .apiType(BottleAPI.readBottle(bottleID: id)))
41+
},
3942
registerLetterAnswer: { bottleID, order, answer in
4043
try await networkManager.reqeust(api: .apiType(BottleAPI.registerLetterAnswer(
4144
bottleID: bottleID,
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// UserClient.swift
3+
// DomainUserInterface
4+
//
5+
// Created by 임현규 on 8/22/24.
6+
//
7+
8+
import Foundation
9+
10+
public struct UserClient {
11+
private let _isLoggedIn: () -> Bool
12+
private let _isAppDeleted: () -> Bool
13+
private let updateLoginState: (Bool) -> Void
14+
private let updateDeleteState: (Bool) -> Void
15+
16+
public init(
17+
isLoggedIn: @escaping () -> Bool,
18+
isAppDeleted: @escaping () -> Bool,
19+
updateLoginState: @escaping (Bool) -> Void,
20+
updateDeleteState: @escaping (Bool) -> Void
21+
) {
22+
self._isLoggedIn = isLoggedIn
23+
self._isAppDeleted = isAppDeleted
24+
self.updateLoginState = updateLoginState
25+
self.updateDeleteState = updateDeleteState
26+
}
27+
28+
public func isLoggedIn() -> Bool {
29+
_isLoggedIn()
30+
}
31+
32+
public func isAppDeleted() -> Bool {
33+
_isAppDeleted()
34+
}
35+
36+
public func updateLoginState(isLoggedIn: Bool) {
37+
updateLoginState(isLoggedIn)
38+
}
39+
40+
public func updateDeleteState(isDelete: Bool) {
41+
updateDeleteState(isDelete)
42+
}
43+
}

Projects/Domain/User/Project.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import ProjectDescription
2+
import ProjectDescriptionHelpers
3+
import DependencyPlugin
4+
5+
let project = Project.makeModule(
6+
name: ModulePath.Domain.name+ModulePath.Domain.User.rawValue,
7+
targets: [
8+
.domain(
9+
interface: .User,
10+
factory: .init(dependencies: [
11+
.core
12+
])
13+
),
14+
.domain(
15+
implements: .User,
16+
factory: .init(
17+
dependencies: [
18+
.domain(interface: .User)
19+
]
20+
)
21+
),
22+
23+
.domain(
24+
testing: .User,
25+
factory: .init(
26+
dependencies: [
27+
.domain(interface: .User)
28+
]
29+
)
30+
),
31+
.domain(
32+
tests: .User,
33+
factory: .init(
34+
dependencies: [
35+
.domain(testing: .User),
36+
.domain(implements: .User)
37+
]
38+
)
39+
),
40+
41+
]
42+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// UserClient.swift
3+
// DomainUser
4+
//
5+
// Created by 임현규 on 8/22/24.
6+
//
7+
8+
import Foundation
9+
10+
import DomainUserInterface
11+
12+
import CoreKeyChainStore
13+
14+
import ComposableArchitecture
15+
16+
extension UserClient: DependencyKey {
17+
static public var liveValue: UserClient = .live()
18+
19+
static func live() -> UserClient {
20+
return .init(
21+
isLoggedIn: {
22+
return UserDefaults.standard.bool(forKey: "loginState")
23+
},
24+
25+
isAppDeleted: {
26+
return !UserDefaults.standard.bool(forKey: "deleteState")
27+
},
28+
29+
updateLoginState: { isLoggedIn in
30+
UserDefaults.standard.set(isLoggedIn, forKey: "loginState")
31+
},
32+
33+
updateDeleteState: { isDelete in
34+
UserDefaults.standard.set(!isDelete, forKey: "deleteState")
35+
}
36+
)
37+
}
38+
}
39+
40+
extension DependencyValues {
41+
public var userClient: UserClient {
42+
get { self[UserClient.self] }
43+
set { self[UserClient.self] = newValue }
44+
}
45+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// This is for Tuist
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import XCTest
2+
3+
final class UserTests: XCTestCase {
4+
override func setUpWithError() throws {}
5+
6+
override func tearDownWithError() throws {}
7+
8+
func testExample() {
9+
XCTAssertEqual(1, 1)
10+
}
11+
}

Projects/Feature/BottleStorage/Interface/Sources/BottleStorage/BottleStorageFeature.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ extension BottleStorageFeature {
2525
state.doneBottlsList = bottleStorageList.doneBottles
2626
return .none
2727

28-
case let .bottleStorageItemDidTapped(bottleID, userName):
29-
state.path.append(.pingPongDetail(.init(bottleID: bottleID, userName: userName)))
28+
case let .bottleStorageItemDidTapped(bottleID, isRead, userName):
29+
state.path.append(.pingPongDetail(.init(
30+
bottleID: bottleID,
31+
isRead: isRead,
32+
userName: userName
33+
)))
3034
return .none
3135

3236
case let .bottleActiveStateTabButtonTapped(activeState):

Projects/Feature/BottleStorage/Interface/Sources/BottleStorage/BottleStorageFeatureInterface.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ public struct BottleStorageFeature {
5555

5656
// 보틀 리스트
5757
case bottleStorageListFetched(BottleStorageList)
58-
case bottleStorageItemDidTapped(bottleID: Int, userName: String)
58+
case bottleStorageItemDidTapped(
59+
bottleID: Int,
60+
isRead: Bool,
61+
userName: String
62+
)
5963
case selectedTabDidChanged(selectedTab: TabType)
6064
case delegate(Delegate)
6165
// ETC.

Projects/Feature/BottleStorage/Interface/Sources/BottleStorage/BottleStorageView.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,14 @@ private extension BottleStorageView {
124124
mbti: bottle.mbti,
125125
keywords: bottle.keyword,
126126
imageURL: bottle.userImageUrl,
127-
isRead: bottle.isRead ?? false
127+
isRead: bottle.isRead
128128
)
129129
.asButton {
130-
store.send(.bottleStorageItemDidTapped(bottleID: bottle.id, userName: bottle.userName ?? ""))
130+
store.send(.bottleStorageItemDidTapped(
131+
bottleID: bottle.id,
132+
isRead: bottle.isRead,
133+
userName: bottle.userName ?? ""
134+
))
131135
}
132136
}
133137
}

Projects/Feature/BottleStorage/Interface/Sources/PingPongDetail/View/PhotoSharePingPongView.swift

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import SwiftUI
9+
910
import SharedDesignSystem
1011

1112
public struct PhotoSharePingPongView: View {
@@ -139,20 +140,17 @@ private extension PhotoSharePingPongView {
139140

140141
@ViewBuilder
141142
var peerProfileImage: some View {
142-
if let peerProfileImageURL = photoShareState.peerProfileImageURL {
143-
GeometryReader { geo in
144-
RemoteImageView(
145-
imageURL: peerProfileImageURL,
146-
downsamplingWidth: 150,
147-
downsamplingHeight: 150
148-
)
149-
.cornerRadius(.md, corenrs: [.topRight, .bottomLeft, .bottomRight])
150-
.frame(height: geo.size.width)
151-
}
152-
.aspectRatio(1, contentMode: .fit)
153-
} else {
154-
EmptyView()
143+
GeometryReader { geo in
144+
RemoteImageView(
145+
imageURL: photoShareState.peerProfileImageURL,
146+
downsamplingWidth: 150,
147+
downsamplingHeight: 150
148+
)
149+
.cornerRadius(.md, corenrs: [.topRight, .bottomLeft, .bottomRight])
150+
.frame(height: geo.size.width)
155151
}
152+
.aspectRatio(1, contentMode: .fit)
153+
.preventScreenshot()
156154
}
157155

158156
@ViewBuilder
@@ -167,6 +165,7 @@ private extension PhotoSharePingPongView {
167165
)
168166
.cornerRadius(.md, corenrs: [.topRight, .topLeft, .bottomLeft])
169167
.frame(height: geo.size.width)
168+
.preventScreenshot()
170169
}
171170
.aspectRatio(1, contentMode: .fit)
172171
} else {

0 commit comments

Comments
 (0)