Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
coby5502 committed Feb 23, 2024
2 parents bddfd62 + 569ed24 commit 9b64697
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions FoodBowl.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2224,7 +2224,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.2.1;
NONCE = wH_pSu5wSUHzoFPBUE9Q9ZRs3fcKzGSn;
PRODUCT_BUNDLE_IDENTIFIER = com.coby.FoodBowl;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2267,7 +2267,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.2.1;
NONCE = wH_pSu5wSUHzoFPBUE9Q9ZRs3fcKzGSn;
PRODUCT_BUNDLE_IDENTIFIER = com.coby.FoodBowl;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ final class CreateReviewViewModel: NSObject, BaseViewModelType {

// MARK: - property

private var isEnabled: Bool = true

private var reviewImages: [UIImage] = []
var location: CLLocationCoordinate2D? = nil
private var store: Store?
Expand All @@ -39,9 +41,12 @@ final class CreateReviewViewModel: NSObject, BaseViewModelType {
.store(in: &self.cancellable)

input.completeButtonDidTap
.throttle(for: .milliseconds(1000), scheduler: RunLoop.main, latest: false)
.sink(receiveValue: { [weak self] comment in
self?.createReview(comment: comment)
guard let self = self else { return }
if self.isEnabled {
self.isEnabled = false
self.createReview(comment: comment)
}
})
.store(in: &self.cancellable)

Expand Down Expand Up @@ -85,6 +90,7 @@ final class CreateReviewViewModel: NSObject, BaseViewModelType {
try await self.usecase.createReview(request: request, images: imagesData)
self.isCompletedSubject.send(.success(()))
} catch(let error) {
self.isEnabled = true
self.isCompletedSubject.send(.failure(error))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ final class UpdateProfileViewModel: NSObject, BaseViewModelType {

// MARK: - property

private var isEnabled: Bool = true

private var profileImage: UIImage = ImageLiteral.defaultProfile

private let usecase: UpdateProfileUsecase
Expand Down Expand Up @@ -48,10 +50,12 @@ final class UpdateProfileViewModel: NSObject, BaseViewModelType {
.store(in: &self.cancellable)

input.completeButtonDidTap
.throttle(for: .milliseconds(1000), scheduler: RunLoop.main, latest: false)
.sink(receiveValue: { [weak self] nickname, introduction in
guard let self = self else { return }
self.updateMemberProfile(nickname: nickname, introduction: introduction)
if self.isEnabled {
self.isEnabled = false
self.updateMemberProfile(nickname: nickname, introduction: introduction)
}
})
.store(in: &self.cancellable)

Expand Down Expand Up @@ -107,6 +111,7 @@ final class UpdateProfileViewModel: NSObject, BaseViewModelType {
try await imageUpdate
self.isCompletedSubject.send(.success(()))
} catch(let error) {
self.isEnabled = true
self.isCompletedSubject.send(.failure(error))
}
}
Expand Down

0 comments on commit 9b64697

Please sign in to comment.