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

[Hotfix] 그룹 생성 시 사진 업로드 동안 인디케이터 노출 #156

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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 @@ -25,6 +25,7 @@ public struct SelectGroupPhotoCore {
var keyword: GroupData.Keyword
var selectedPhotoInfo: PhotoInfo?
var isFromGetStarted: Bool
var isLoading: Bool
var photosPickerPresented: Bool
var selectedPickerItems: [PhotosPickerItem]
var nextButtonType: ButtonType {
Expand All @@ -38,6 +39,7 @@ public struct SelectGroupPhotoCore {
keyword: GroupData.Keyword,
selectedPhotoInfo: PhotoInfo? = nil,
isFromGetStarted: Bool,
isLoading: Bool = false,
photosPickerPresented: Bool = false,
selectedPickerItems: [PhotosPickerItem] = []
) {
Expand All @@ -47,6 +49,7 @@ public struct SelectGroupPhotoCore {
self.keyword = keyword
self.selectedPhotoInfo = selectedPhotoInfo
self.isFromGetStarted = isFromGetStarted
self.isLoading = isLoading
self.photosPickerPresented = photosPickerPresented
self.selectedPickerItems = selectedPickerItems
}
Expand All @@ -65,6 +68,7 @@ public struct SelectGroupPhotoCore {
case uploadFileToPresignedURLResponse(Result<Void, Error>, FileUploadInfo)
case createGroupResponse(Result<CreatedGroupInfo, Error>)
case setSelectedPhotoInfo(PhotoInfo)
case setIsLoading(Bool)

// Route Action
case moveToCreateGroupCompletion(createdGroupInfo: CreatedGroupInfo, isFromGetStarted: Bool)
Expand All @@ -78,6 +82,7 @@ public struct SelectGroupPhotoCore {
Reduce { state, action in
switch action {
case .nextButtonTapped:
state.isLoading = true
Copy link
Member

Choose a reason for hiding this comment

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

setIsLoading 액션을 활용하면 어떤가요?

return .run { [state] send in
if let photoInfo = state.selectedPhotoInfo {
await send(
Expand Down Expand Up @@ -166,6 +171,7 @@ public struct SelectGroupPhotoCore {
case let .uploadFileToPresignedURLResponse(.failure(error), _):
return .run { send in
logger.error(error.localizedDescription)
await send(.setIsLoading(false))
}

case let .createGroupResponse(.success(createdGroupInfo)):
Expand All @@ -175,11 +181,16 @@ public struct SelectGroupPhotoCore {
case let .createGroupResponse(.failure(error)):
return .run { send in
logger.error(error.localizedDescription)
await send(.setIsLoading(false))
}

case let .setSelectedPhotoInfo(photoInfo):
state.selectedPhotoInfo = photoInfo
return .none

case let .setIsLoading(value):
state.isLoading = value
return .none

case .moveToCreateGroupCompletion:
return .none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ public struct SelectGroupPhotoView: View {
maxSelectionCount: 1,
matching: .images
)
.overlay {
if store.isLoading {
ZStack {
Color.black
.opacity(0.5)
.ignoresSafeArea()

ProgressView()
.progressViewStyle(CircularProgressViewStyle())
.controlSize(.large)
.tint(.white)
}
}
}
}
}

Expand Down