-
Notifications
You must be signed in to change notification settings - Fork 230
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
TCA Navigation #185
Conversation
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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.
Sources/GameCore/GameCore.swift
Outdated
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() | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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 <[email protected]>
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.