Skip to content

Commit

Permalink
Fix dismissal in UIKit demos.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw committed Apr 13, 2024
1 parent 7e90901 commit fd4b169
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class LazyNavigationViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

if !isMovingToParent {
if !isMovingToParent && store.optionalCounter != nil {
store.send(.setNavigation(isActive: false))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class EagerNavigationViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

if !isMovingToParent {
if !isMovingToParent && store.isNavigationActive {
store.send(.setNavigation(isActive: false))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class LoginViewController: UIViewController {
public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

if !isMovingToParent {
if !isMovingToParent && store.twoFactor != nil {
store.twoFactorDismissed()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public struct TwoFactor: Sendable {
}

@Dependency(\.authenticationClient) var authenticationClient
@Dependency(\.dismiss) var dismiss

public init() {}

Expand All @@ -57,6 +58,8 @@ public struct TwoFactor: Sendable {
return .none

case .view(.submitButtonTapped):
return .run { _ in await self.dismiss() }

state.isTwoFactorRequestInFlight = true
return .run { [code = state.code, token = state.token] send in
await send(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public final class TwoFactorViewController: UIViewController {
guard let self else { return }
activityIndicator.isHidden = store.isActivityIndicatorHidden
codeTextField.text = store.code
loginButton.isEnabled = store.isLoginButtonEnabled
//loginButton.isEnabled = store.isLoginButtonEnabled

if let store = store.scope(state: \.alert, action: \.alert),
alertController == nil
Expand Down

0 comments on commit fd4b169

Please sign in to comment.