Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public struct ClassAIChatFeature {
case response
}

@Dependency(\.classUseCase) private var debateUseCase
@Dependency(\.classDebateUseCase) private var debateUseCase

public var body: some Reducer<State, Action> {
Reduce { state, action in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public struct ClassAIVoteFeature {

@Dependency(\.uuid) private var uuid
@Dependency(\.battleUseCase) private var battleUseCase
@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classBattleUseCase) private var classUseCase

public var body: some Reducer<State, Action> {
Reduce { state, action in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public struct ClassBattleFlowFeature {
}

@Dependency(\.uuid) private var uuid
@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classBattleUseCase) private var classUseCase
@Dependency(\.battleUseCase) private var battleUseCase
@Dependency(\.audioPlayer) private var audioPlayer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public struct ClassDeadlineEditFeature {
case save(UUID)
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classRoomUseCase) private var classUseCase
@Dependency(\.date) private var date
@Dependency(\.uuid) private var uuid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public struct ClassDetailFeature {
case deleted(Int, ClassError?)
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classRoomUseCase) private var classRoomUseCase

public var body: some Reducer<State, Action> {
Reduce { state, action in
Expand Down Expand Up @@ -234,9 +234,9 @@ extension ClassDetailFeature {
state.errorMessage = nil
switch action {
case let .delete(id):
return .run { [classUseCase] send in
return .run { [classRoomUseCase] send in
do {
try await classUseCase.deleteClass(id: id)
try await classRoomUseCase.deleteClass(id: id)
await send(.inner(.deleted(id, nil)))
} catch {
await send(.inner(.deleted(id, ClassError.from(error))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ public struct ClassJoinFeature {
case nameOwner(UUID)
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classRoomUseCase) private var classRoomUseCase
@Dependency(\.classMemberUseCase) private var classMemberUseCase
Comment on lines +157 to +158

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Migrate existing overrides to the new dependency keys

The existing test and audit callers still inject classUseCase, which is independent of classRoomUseCase, so these reducers now silently use the default MockClassRepository instead of the supplied stub. For example, ClassDeadlineEditTests.저장_실패는_폼을_남겨_수동_재시도할_수_있다 injects an empty repository to force .invalidCode, but the new key resolves to a populated repository; ClassJoinTests and MyClassTests likewise lose their configured responses and shared repository state. Update the affected test and audit overrides alongside this migration so the existing assertions and coordinator/child state sharing remain valid.

Useful? React with 👍 / 👎.

@Dependency(\.uuid) private var uuid

public var body: some Reducer<State, Action> {
Expand Down Expand Up @@ -250,9 +251,9 @@ extension ClassJoinFeature {
state.activeFindRequestID = requestID
state.errorMessage = nil
state.nicknameErrorMessage = nil
return .run { [classUseCase, instanceID = state.instanceID] send in
return .run { [classRoomUseCase, instanceID = state.instanceID] send in
let result = await Result {
try await classUseCase.fetchClassPreview(joinCode: code)
try await classRoomUseCase.fetchClassPreview(joinCode: code)
}
.mapError(ClassError.from)
guard !Task.isCancelled else { return }
Expand All @@ -266,9 +267,9 @@ extension ClassJoinFeature {
state.activeJoinRequestID = requestID
state.errorMessage = nil
state.nicknameErrorMessage = nil
return .run { [classUseCase, instanceID = state.instanceID] send in
return .run { [classRoomUseCase, instanceID = state.instanceID] send in
let result = await Result {
try await classUseCase.joinClass(joinCode: code, nickname: nickname)
try await classRoomUseCase.joinClass(joinCode: code, nickname: nickname)
}
.mapError(ClassError.from)
guard !Task.isCancelled else { return }
Expand All @@ -287,9 +288,9 @@ extension ClassJoinFeature {
state.activeOwnerRequestID = requestID
state.errorMessage = nil
state.nicknameErrorMessage = nil
return .run { [classUseCase, room = state.preview] send in
return .run { [classMemberUseCase, room = state.preview] send in
let result = await Result { () async throws -> ClassRoom in
_ = try await classUseCase.updateMyDisplayName(classID: roomID, name: nickname)
_ = try await classMemberUseCase.updateMyDisplayName(classID: roomID, name: nickname)
guard let room else { throw ClassError.invalidCode }
return room
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public struct ClassMyOpinionsFeature {
case fetch
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classBattleUseCase) private var classUseCase

public var body: some Reducer<State, Action> {
Reduce { state, action in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public struct ClassOwnerDashboardFeature {
case openFeedback(ClassOwnerMember)
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classResultUseCase) private var classUseCase
@Dependency(\.uuid) private var uuid

public var body: some Reducer<State, Action> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public struct ClassRecommendFeature {
case select
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classRecommendationUseCase) private var classRecommendationUseCase
@Dependency(\.classTopicDraftUseCase) private var classTopicDraftUseCase

public var body: some Reducer<State, Action> {
Reduce { state, action in
Expand Down Expand Up @@ -242,9 +243,9 @@ extension ClassRecommendFeature {
if state.viewState == .loading || state.viewState == .error {
state.viewState = .loading
}
return .run { [classUseCase] send in
return .run { [classRecommendationUseCase] send in
let result = await Result {
try await classUseCase.fetchRecommendedBattles(filter: filter)
try await classRecommendationUseCase.fetchRecommendedBattles(filter: filter)
}
.mapError(ClassError.from)
await send(.inner(.battles(result)))
Expand All @@ -254,9 +255,9 @@ extension ClassRecommendFeature {
case let .createDraft(filter):
state.isLoading = true
state.viewState = .loading
return .run { [classUseCase] send in
return .run { [classTopicDraftUseCase] send in
let result = await Result {
try await classUseCase.createTopicDraft(filter: filter)
try await classTopicDraftUseCase.createTopicDraft(filter: filter)
}
.mapError(ClassError.from)
guard !Task.isCancelled else { return }
Expand All @@ -267,12 +268,12 @@ extension ClassRecommendFeature {
case let .suggest(draftID):
state.isLoading = true
state.viewState = .loading
return .run { [classUseCase] send in
return .run { [classTopicDraftUseCase] send in
let result = await Result {
let draft = try await classUseCase.suggestTopicDraft(id: draftID, filter: nil)
let draft = try await classTopicDraftUseCase.suggestTopicDraft(id: draftID, filter: nil)
guard !Task.isCancelled else { throw CancellationError() }
await send(.inner(.suggestionStarted(draft)))
return try await Self.pollSuggestion(draft: draft, useCase: classUseCase)
return try await Self.pollSuggestion(draft: draft, useCase: classTopicDraftUseCase)
}
.mapError(ClassError.from)
guard !Task.isCancelled else { return }
Expand All @@ -283,10 +284,10 @@ extension ClassRecommendFeature {
case let .poll(draftID):
state.isLoading = true
state.viewState = .loading
return .run { [classUseCase] send in
return .run { [classTopicDraftUseCase] send in
let result = await Result {
let draft = try await classUseCase.fetchTopicDraft(id: draftID)
return try await Self.pollSuggestion(draft: draft, useCase: classUseCase)
let draft = try await classTopicDraftUseCase.fetchTopicDraft(id: draftID)
return try await Self.pollSuggestion(draft: draft, useCase: classTopicDraftUseCase)
}
.mapError(ClassError.from)
guard !Task.isCancelled else { return }
Expand All @@ -296,9 +297,9 @@ extension ClassRecommendFeature {

case let .select(draftID, batchNo, candidateID):
state.isLoading = true
return .run { [classUseCase] send in
return .run { [classTopicDraftUseCase] send in
let result = await Result {
try await classUseCase.selectTopicDraft(draftID: draftID, batchNo: batchNo, candidateID: candidateID)
try await classTopicDraftUseCase.selectTopicDraft(draftID: draftID, batchNo: batchNo, candidateID: candidateID)
}
.mapError(ClassError.from)
guard !Task.isCancelled else { return }
Expand Down Expand Up @@ -368,7 +369,7 @@ extension ClassRecommendFeature {

private static func pollSuggestion(
draft: ClassTopicDraft,
useCase: any ClassInterface
useCase: any ClassTopicDraftInterface
) async throws -> ClassTopicDraft {
var current = draft
for _ in 0 ..< 90 where current.suggestStatus == "GENERATING" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public struct ClassReportFeature {
case generate(UUID)
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classResultUseCase) private var classUseCase
@Dependency(\.uuid) private var uuid

public var body: some Reducer<State, Action> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ private extension ClassReportView {
)
return Store(initialState: state) {
ClassReportFeature()
.dependency(\.classUseCase, repository)
.dependency(\.classResultUseCase, repository)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public struct ClassSettingFeature {
}

@Dependency(\.date) private var date
@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classRoomUseCase) private var classUseCase

public var body: some Reducer<State, Action> {
BindingReducer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public struct ClassTicketFeature {
case existingTicket(UUID)
}

@Dependency(\.classUseCase) private var ticketUseCase
@Dependency(\.classTicketUseCase) private var ticketUseCase

public var body: some Reducer<State, Action> {
BindingReducer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public struct MyClassFeature {
case left(Int)
}

@Dependency(\.classUseCase) private var classUseCase
@Dependency(\.classRoomUseCase) private var classUseCase

public var body: some Reducer<State, Action> {
Reduce { state, action in
Expand Down
Loading