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 Navigation #185

Merged
merged 20 commits into from
Aug 23, 2023
Merged

TCA Navigation #185

merged 20 commits into from
Aug 23, 2023

Conversation

stephencelis
Copy link
Member

This PR upgrades many of our domains to use TCA's navigation APIs. It's not an exhaustive list, since some contenders are not yet easy to transition due to our shared settings state. Once we refactor settings to go through a dependency it should be easier to migrate those.

I've also included a few other modernizations, like using TCA's built-in onChange operator over the one we previously built from scratch for this app.

@@ -1339,7 +1339,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use navigationDestination I've bumped the deployment target. Up for alternate ideas, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah iOS 16 sounds good to me!

group.addTask {
for await event in self.userNotifications.delegate() {
await send(.userNotifications(event))
public var body: some ReducerOf<Self> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While some of these reduce(into:) needed to migrate to the body style to compose with ifLet, I've migrated all of them for consistency.

@@ -5,20 +5,17 @@ public struct BottomMenuState<Action> {
public var buttons: [Button]
public var footerButton: Button?
public var message: TextState?
public var onDismiss: MenuAction?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can now leverage PresentationAction.dismiss for the bottom menu instead of threading in an explicit action.

Comment on lines 20 to 52
public struct Destination: Reducer {
public enum State: Equatable {
case alert(AlertState<Action.Alert>)
case bottomMenu(BottomMenuState<Action.BottomMenu>)
case gameOver(GameOver.State)
case upgradeInterstitial(UpgradeInterstitial.State = .init())
}
public enum Action: Equatable {
case alert(Alert)
case bottomMenu(BottomMenu)
case gameOver(GameOver.Action)
case upgradeInterstitial(UpgradeInterstitial.Action)

public enum Alert: Equatable {
case forfeitButtonTapped
}
public enum BottomMenu: Equatable {
case confirmRemoveCube(LatticePoint)
case endGameButtonTapped
case exitButtonTapped
case forfeitGameButtonTapped
case settingsButtonTapped
}
}
public var body: some ReducerOf<Self> {
Scope(state: /State.gameOver, action: /Action.gameOver) {
GameOver()
}
Scope(state: /State.upgradeInterstitial, action: /Action.upgradeInterstitial) {
UpgradeInterstitial()
}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Game and Home have some of the more interesting navigation refactors. Here we're able to house 4 destinations.

* Beginnings of the UserSettingsClient.

* extracted UserSettingsClient to its own library

* Decoupled haptics settings from some features.

* Stopped threading isAnimationReduced state through multple features and fixed tests.

* Stopped threading isAnimationReduced to leaderboard.

* Moved daily challenge settings into UserSettings.

* Moved enableNotifications to UserSettings.

* Moved developer settings to app storage.

* Game feature has its own settings, haven't deleted home settings yet.

* Removed GameFeature

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Fixed some runtime warnings.

* wip

* Flatten nag banner domains, remove old settings from home

* wip

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
@stephencelis stephencelis merged commit 34e28fa into main Aug 23, 2023
2 checks passed
@stephencelis stephencelis deleted the modernize branch August 23, 2023 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants