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

TCA Migration to 1.5 #1028

Merged
merged 4 commits into from
Nov 29, 2023
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
28 changes: 18 additions & 10 deletions Packages/GodPackage/Sources/AboutFeature/About.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,25 +229,33 @@ public struct AboutView: View {
}
.task { await store.send(.onTask).finish() }
.onAppear { store.send(.onAppear) }
.confirmationDialog(store: store.scope(state: \.$confirmationDialog, action: { .confirmationDialog($0) }))
.confirmationDialog(
store: store.scope(
state: \.$confirmationDialog,
action: \.confirmationDialog
)
)
.fullScreenCover(
store: store.scope(state: \.$destination, action: AboutLogic.Action.destination),
state: /AboutLogic.Destination.State.howItWorks,
action: AboutLogic.Destination.Action.howItWorks,
store: store.scope(
state: \.$destination.howItWorks,
action: \.destination.howItWorks
),
content: HowItWorksView.init(store:)
)
.sheet(
store: store.scope(state: \.$destination, action: AboutLogic.Action.destination),
state: /AboutLogic.Destination.State.emailSheet,
action: AboutLogic.Destination.Action.emailSheet
store: store.scope(
state: \.$destination.emailSheet,
action: \.destination.emailSheet
)
) { store in
EmailSheetView(store: store)
.presentationBackground(Color.clear)
}
.sheet(
store: store.scope(state: \.$destination, action: AboutLogic.Action.destination),
state: /AboutLogic.Destination.State.deleteAccount,
action: AboutLogic.Destination.Action.deleteAccount
store: store.scope(
state: \.$destination.deleteAccount,
action: \.destination.deleteAccount
)
) { store in
NavigationStack {
DeleteAccountView(store: store)
Expand Down
7 changes: 4 additions & 3 deletions Packages/GodPackage/Sources/ActivityFeature/Activity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ public struct ActivityView: View {
.task { await store.send(.onTask).finish() }
.onAppear { store.send(.onAppear) }
.sheet(
store: store.scope(state: \.$destination, action: { .destination($0) }),
state: /ActivityLogic.Destination.State.profile,
action: ActivityLogic.Destination.Action.profile
store: store.scope(
state: \.$destination.profile,
action: \.destination.profile
)
) { store in
NavigationStack {
ProfileExternalView(store: store)
Expand Down
26 changes: 14 additions & 12 deletions Packages/GodPackage/Sources/AddFeature/Add.swift
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public struct AddView: View {
ZStack {
VStack(spacing: 0) {
IfLetStore(
store.scope(state: \.contactsReEnable, action: AddLogic.Action.contactsReEnable),
store.scope(state: \.contactsReEnable, action: \.contactsReEnable),
then: ContactsReEnableView.init(store:)
)
SearchField(text: viewStore.$searchQuery)
Expand Down Expand Up @@ -395,26 +395,26 @@ public struct AddView: View {

if viewStore.searchResult.isEmpty {
IfLetStore(
store.scope(state: \.friendRequestPanel, action: AddLogic.Action.friendRequestPanel),
store.scope(state: \.friendRequestPanel, action: \.friendRequestPanel),
then: FriendRequestsView.init(store:)
)
IfLetStore(
store.scope(state: \.friendsOfFriendsPanel, action: AddLogic.Action.friendsOfFriendsPanel),
store.scope(state: \.friendsOfFriendsPanel, action: \.friendsOfFriendsPanel),
then: FriendsOfFriendsPanelView.init(store:)
)
IfLetStore(
store.scope(state: \.fromSchoolPanel, action: AddLogic.Action.fromSchoolPanel),
store.scope(state: \.fromSchoolPanel, action: \.fromSchoolPanel),
then: FromSchoolPanelView.init(store:)
)
InvitationsLeftView(
store: store.scope(
state: \.invitationsLeft,
action: AddLogic.Action.invitationsLeft
action: \.invitationsLeft
)
)
} else {
ForEachStore(
store.scope(state: \.searchResult, action: AddLogic.Action.searchResult)
store.scope(state: \.searchResult, action: \.searchResult)
) {
FriendRowCardView(store: $0)
}
Expand All @@ -426,15 +426,17 @@ public struct AddView: View {
.task { await store.send(.onTask).finish() }
.onAppear { store.send(.onAppear) }
.sheet(
store: store.scope(state: \.$destination, action: AddLogic.Action.destination),
state: /AddLogic.Destination.State.message,
action: AddLogic.Destination.Action.message,
store: store.scope(
state: \.$destination.message,
action: \.destination.message
),
content: CupertinoMessageView.init
)
.sheet(
store: store.scope(state: \.$destination, action: AddLogic.Action.destination),
state: /AddLogic.Destination.State.profileExternal,
action: AddLogic.Destination.Action.profileExternal
store: store.scope(
state: \.$destination.profileExternal,
action: \.destination.profileExternal
)
) { store in
NavigationStack {
ProfileExternalView(store: store)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public struct FriendRequestsView: View {
FriendHeader(title: "FRIEND REQUESTS")

ForEachStore(
store.scope(state: \.requests, action: FriendRequestsLogic.Action.requests)
store.scope(state: \.requests, action: \.requests)
) { cardStore in
WithViewStore(cardStore, observe: { $0 }) { viewStore in
FriendRequestCardView(store: cardStore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public struct FriendsOfFriendsPanelView: View {
FriendHeader(title: "FRIENDS OF FRIENDS")

ForEachStore(
store.scope(state: \.friendsOfFriends, action: FriendsOfFriendsPanelLogic.Action.friendsOfFriends)
store.scope(state: \.friendsOfFriends, action: \.friendsOfFriends)
) { cardStore in
WithViewStore(cardStore, observe: { $0 }) { viewStore in
FriendRowCardView(store: cardStore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public struct FromSchoolPanelView: View {
FriendHeader(title: "FROM SCHOOL")

ForEachStore(
store.scope(state: \.users, action: FromSchoolPanelLogic.Action.users)
store.scope(state: \.users, action: \.users)
) { cardStore in
WithViewStore(cardStore, observe: { $0 }) { viewStore in
FriendRowCardView(store: cardStore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public struct InvitationsLeftView: View {
}
.task { await store.send(.onTask).finish() }
.sheet(
store: store.scope(state: \.$message, action: { .message($0) }),
store: store.scope(state: \.$message, action: \.message }),
content: CupertinoMessageView.init
)
}
Expand Down
2 changes: 1 addition & 1 deletion Packages/GodPackage/Sources/AppFeature/AppLogic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public struct AppView: View {
}

public var body: some View {
SwitchStore(store.scope(state: \.view, action: AppLogic.Action.view)) { initialState in
SwitchStore(store.scope(state: \.view, action: \.view)) { initialState in
switch initialState {
case .launch:
CaseLet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,7 @@ public struct DeleteAccountView: View {
}
}
}
.confirmationDialog(
store: store.scope(
state: \.$confirmationDialog,
action: DeleteAccountLogic.Action.confirmationDialog
)
)
.confirmationDialog(store: store.scope(state: \.$confirmationDialog, action: \.confirmationDialog))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Packages/GodPackage/Sources/GodFeature/God.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public struct GodView: View {
}

public var body: some View {
SwitchStore(store.scope(state: \.child, action: GodLogic.Action.child)) { initialState in
SwitchStore(store.scope(state: \.child, action: \.child)) { initialState in
switch initialState {
case .poll:
CaseLet(
Expand Down
21 changes: 12 additions & 9 deletions Packages/GodPackage/Sources/InboxDetailFeature/InboxDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,25 +349,28 @@ public struct InboxDetailView: View {
store.send(.closeButtonTapped)
}
.fullScreenCover(
store: store.scope(state: \.$destination, action: InboxDetailLogic.Action.destination),
state: /InboxDetailLogic.Destination.State.initialName,
action: InboxDetailLogic.Destination.Action.initialName
store: store.scope(
state: \.$destination.initialName,
action: \.destination.initialName
)
) { store in
InitialNameView(store: store)
.presentationBackground(Color.clear)
}
.fullScreenCover(
store: store.scope(state: \.$destination, action: InboxDetailLogic.Action.destination),
state: /InboxDetailLogic.Destination.State.fullName,
action: InboxDetailLogic.Destination.Action.fullName
store: store.scope(
state: \.$destination.fullName,
action: \.destination.fullName
)
) { store in
FullNameView(store: store)
.presentationBackground(Color.clear)
}
.fullScreenCover(
store: store.scope(state: \.$destination, action: InboxDetailLogic.Action.destination),
state: /InboxDetailLogic.Destination.State.godMode,
action: InboxDetailLogic.Destination.Action.godMode,
store: store.scope(
state: \.$destination.godMode,
action: \.destination.godMode
),
content: GodModeView.init(store:)
)
}
Expand Down
32 changes: 18 additions & 14 deletions Packages/GodPackage/Sources/InboxFeature/Inbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public struct InboxView: View {
BannerCard(banner: banner)
}
IfLetStore(
store.scope(state: \.notificationsReEnable, action: InboxLogic.Action.notificationsReEnable),
store.scope(state: \.notificationsReEnable, action: \.notificationsReEnable),
then: NotificationsReEnableView.init(store:)
)
List {
Expand All @@ -323,7 +323,7 @@ public struct InboxView: View {
}
}

FromGodTeamCard(store: store.scope(state: \.fromGodTeamCard, action: InboxLogic.Action.fromGodTeamCard))
FromGodTeamCard(store: store.scope(state: \.fromGodTeamCard, action: \.fromGodTeamCard))

Spacer()
.listRowSeparator(.hidden)
Expand Down Expand Up @@ -365,29 +365,33 @@ public struct InboxView: View {
.task { await store.send(.onTask).finish() }
.onAppear { store.send(.onAppear) }
.sheet(
store: store.scope(state: \.$destination, action: { .destination($0) }),
state: /InboxLogic.Destination.State.activatedGodMode,
action: InboxLogic.Destination.Action.activatedGodMode
store: store.scope(
state: \.$destination.activatedGodMode,
action: \.destination.activatedGodMode
)
) { store in
ActivatedGodModeView(store: store)
.presentationDetents([.fraction(0.4)])
}
.fullScreenCover(
store: store.scope(state: \.$destination, action: { .destination($0) }),
state: /InboxLogic.Destination.State.godMode,
action: InboxLogic.Destination.Action.godMode,
store: store.scope(
state: \.$destination.godMode,
action: \.destination.godMode
),
content: GodModeView.init(store:)
)
.fullScreenCover(
store: store.scope(state: \.$destination, action: { .destination($0) }),
state: /InboxLogic.Destination.State.fromGodTeam,
action: InboxLogic.Destination.Action.fromGodTeam,
store: store.scope(
state: \.$destination.fromGodTeam,
action: \.destination.fromGodTeam
),
content: FromGodTeamView.init(store:)
)
.fullScreenCover(
store: store.scope(state: \.$destination, action: { .destination($0) }),
state: /InboxLogic.Destination.State.inboxDetail,
action: InboxLogic.Destination.Action.inboxDetail,
store: store.scope(
state: \.$destination.inboxDetail,
action: \.destination.inboxDetail
),
content: InboxDetailView.init(store:)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,16 @@ public struct InviteFriendView: View {
.task { await store.send(.onTask).finish() }
.onAppear { store.send(.onAppear) }
.alert(
store: store.scope(state: \.$destination, action: InviteFriendLogic.Action.destination),
state: /InviteFriendLogic.Destination.State.alert,
action: InviteFriendLogic.Destination.Action.alert
store: store.scope(
state: \.$destination.alert,
action: \.destination.alert
)
)
.sheet(
store: store.scope(state: \.$destination, action: InviteFriendLogic.Action.destination),
state: /InviteFriendLogic.Destination.State.activity,
action: InviteFriendLogic.Destination.Action.activity
store: store.scope(
state: \.$destination.activity,
action: \.destination.activity
)
) { _ in
ActivityView(
activityItems: [viewStore.shareURL],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public struct ManageAccountView: View {
}
.navigationTitle(Text("Manage Account", bundle: .module))
.navigationBarTitleDisplayMode(.inline)
.confirmationDialog(store: store.scope(state: \.$confirmationDialog, action: { .confirmationDialog($0) }))
.confirmationDialog(store: store.scope(state: \.$confirmationDialog, action: \.confirmationDialog))
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button {
Expand Down
Loading