Skip to content

Commit

Permalink
[CAT-298] 이름짓기 뷰 Rive 파일 추가 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jihyun247 authored Aug 23, 2024
1 parent 4c1a253 commit 582a333
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public struct NamingCatCore {
var isButtonDisabled: Bool = false
var inputFieldError: NamingCatError?
var tooltip: DownDirectionTooltip? = .init()
var catRiv: RiveViewModel = Rive.catSelectRiv(stateMachineName: "State Machine_selectCat")
var catRiv: RiveViewModel = Rive.catRenameRiv(stateMachineName: "State Machine_Rename")

public init(route: Route) {
self.route = route
}
Expand All @@ -36,7 +36,7 @@ public struct NamingCatCore {
public enum Action: BindableAction {
case onAppear
case namedButtonTapped
case triggerCatAnimation
case catSetInput
case moveToHome
case setTooltip(DownDirectionTooltip?)
case saveChangedCat(SomeCat)
Expand Down Expand Up @@ -73,7 +73,7 @@ public struct NamingCatCore {
if let myCat = try await self.userService.getUserInfo(databaseClient: self.databaseClient)?.cat {
await send(.set(\.selectedCat, SomeCat(baseInfo: myCat)))
}
await send(.triggerCatAnimation)
await send(.catSetInput)
}

case .namedButtonTapped:
Expand All @@ -89,10 +89,10 @@ public struct NamingCatCore {
await send(._setNextAction)
}

case .triggerCatAnimation:
case .catSetInput:
guard let selectedCat = state.selectedCat else { return .none }
state.catRiv.stop()
state.catRiv.triggerInput(selectedCat.rivTriggerName)
state.catRiv.reset()
state.catRiv.setInput(selectedCat.rivInputName, value: true)
return .none

case .moveToHome:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public struct NamingCatView: View {

store.catRiv.view()
.setTooltipTarget(tooltip: DownDirectionTooltip.self)
.frame(height: 240)
.frame(minHeight: 200, maxHeight: 240)

VStack(spacing: Alias.Spacing.small) {
HStack {
Expand Down
31 changes: 17 additions & 14 deletions Projects/Feature/CatFeature/Sources/SelectCat/SelectCatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct SelectCatView: View {
VStack(spacing: Alias.Spacing.small) {
CatPushNotificationExampleView(selectedCat: $store.selectedCat)
store.catRiv.view()
.frame(height: 240)
.frame(minHeight: 200, maxHeight: 240)
}

Spacer(minLength: Alias.Spacing.large)
Expand Down Expand Up @@ -103,23 +103,26 @@ struct CatPushNotificationExampleView: View {
.cornerRadius(8.5, corners: .allCorners)

VStack(alignment: .leading, spacing: .zero) {
Text("모하냥")
.font(Typography.bodySB)
.foregroundStyle(Alias.Color.Text.primary)
HStack {
Text("모하냥")
.font(Typography.bodySB)
.foregroundStyle(Alias.Color.Text.primary)

Spacer()

VStack(alignment: .trailing, spacing: .zero) {
Text("지금")
.font(Typography.captionR)
.foregroundStyle(Alias.Color.Text.primary)
Spacer()
}
.padding(.trailing, Alias.Spacing.small)
}

Text(selectedCat.disturbPushTitle)
.font(Typography.subBodyR)
.foregroundStyle(Alias.Color.Text.primary)
}

Spacer()

VStack(alignment: .trailing, spacing: .zero) {
Text("지금")
.font(Typography.captionR)
.foregroundStyle(Alias.Color.Text.primary)
Spacer()
}
.padding(.trailing, Alias.Spacing.small)
}
.padding(.all, Alias.Spacing.large)
} else {
Expand Down
Binary file not shown.

0 comments on commit 582a333

Please sign in to comment.