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

[CAT-298] 이름짓기 뷰 Rive 파일 추가 #53

Merged
merged 2 commits into from
Aug 23, 2024
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 @@ -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.
Loading