Skip to content

Commit

Permalink
feat: 🎸 invited
Browse files Browse the repository at this point in the history
  • Loading branch information
tomokisun committed Nov 6, 2023
1 parent 8062b3d commit f435289
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Packages/GodPackage/Sources/OnboardFeature/InviteFriend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ public struct InviteFriendLogic: Reducer {
}

public struct State: Equatable {
var remainingInvitationCount = 3
var remainingInvitationCount: Int {
return invites.filter { !$0 }.count
}
var invites = Array(repeating: false, count: 3)
@BindingState var isPresented = false
@PresentationState var alert: AlertState<Action.Alert>?

Expand Down Expand Up @@ -77,7 +80,12 @@ public struct InviteFriendLogic: Reducer {
completion.result,
state.remainingInvitationCount > 0
else { return .none }
state.remainingInvitationCount -= 1
for i in 0..<state.invites.count {
if !state.invites[i] {
state.invites[i] = true
break
}
}
return .none

case .alert(.presented(.confirmOkay)):
Expand Down Expand Up @@ -113,8 +121,8 @@ public struct InviteFriendView: View {
.background(Color.godService)
.clipShape(Capsule())

HStack(spacing: 24) {
ForEach(0..<3) { _ in
HStack(alignment: .top, spacing: 24) {
ForEach(viewStore.invites, id: \.self) { isInvited in
Button {
store.send(.inviteFriendButtonTapped)
} label: {
Expand All @@ -123,8 +131,8 @@ public struct InviteFriendView: View {
.frame(width: 80, height: 80)
.font(.system(size: 50))
.clipShape(Circle())

Text("No friend\ninvited yet", bundle: .module)
Text(isInvited ? "invited via\nother app" : "No friend\ninvited yet", bundle: .module)
.font(.system(.body, design: .rounded))
}
.foregroundStyle(Color.godTextSecondaryDark)
Expand Down
10 changes: 10 additions & 0 deletions Packages/GodPackage/Sources/OnboardFeature/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,16 @@
}
}
},
"invited via\nother app" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "招待済み"
}
}
}
},
"Last Name" : {
"localizations" : {
"ja" : {
Expand Down

0 comments on commit f435289

Please sign in to comment.