Skip to content

Commit

Permalink
parameterize dismiss action
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dydx committed Sep 16, 2024
1 parent a967fd6 commit 9622320
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 43 deletions.
4 changes: 0 additions & 4 deletions PlatformParticles/PlatformParticles.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
0271236928E545A50015D39F /* SwiftMessages in Frameworks */ = {isa = PBXBuildFile; productRef = 0271236828E545A50015D39F /* SwiftMessages */; };
27897DA02C93EA2800196F21 /* DismissPresentedAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27897D922C93EA2800196F21 /* DismissPresentedAction.swift */; };
27ED353A2AD5BD0900C159F5 /* BannerErrorAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27ED35392AD5BD0900C159F5 /* BannerErrorAlert.swift */; };
3101F9C52511303E00AC4010 /* ConfirmAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3101F9C42511303E00AC4010 /* ConfirmAction.swift */; };
3101F9C62511303E00AC4010 /* ConfirmAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3101F9C42511303E00AC4010 /* ConfirmAction.swift */; };
Expand Down Expand Up @@ -635,7 +634,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
27897D922C93EA2800196F21 /* DismissPresentedAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DismissPresentedAction.swift; sourceTree = "<group>"; };
27ED35392AD5BD0900C159F5 /* BannerErrorAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerErrorAlert.swift; sourceTree = "<group>"; };
3101F9C42511303E00AC4010 /* ConfirmAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmAction.swift; sourceTree = "<group>"; };
3101F9C92511308E00AC4010 /* AuthLoginPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthLoginPresenter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1170,7 +1168,6 @@
314B5FA223DCCE2800139EB3 /* ConfirmationAction.swift */,
3101F9C42511303E00AC4010 /* ConfirmAction.swift */,
3180B04E272B509400CCAB67 /* DismissAction.swift */,
27897D922C93EA2800196F21 /* DismissPresentedAction.swift */,
64AF47822817123C00EBFDC6 /* SafariAction.swift */,
);
path = _Actions;
Expand Down Expand Up @@ -2349,7 +2346,6 @@
3128DDF026B89CE80099B62E /* LikedTableViewListPresenter.swift in Sources */,
314B604D23DCCE2900139EB3 /* ListPresenterManager.swift in Sources */,
314B5FD123DCCE2900139EB3 /* PrivacyPermissionPresenter.swift in Sources */,
27897DA02C93EA2800196F21 /* DismissPresentedAction.swift in Sources */,
314B5FE323DCCE2900139EB3 /* ObjectPresenterCollectionViewCell.swift in Sources */,
314B5FE123DCCE2900139EB3 /* UIView+Xib.swift in Sources */,
3101F9C52511303E00AC4010 /* ConfirmAction.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ private class DismissAction: NSObject, NavigableProtocol {
@objc open func navigate(to request: RoutingRequest?, animated: Bool, completion: RoutingCompletionBlock?) {
if request?.path == "/action/dismiss" {
let viewController = UIViewController.topmost()
if viewController?.navigationController?.topViewController == viewController,
if let shouldPrioritizeDismiss = request?.params?["shouldPrioritizeDismiss"] as? Bool,
shouldPrioritizeDismiss && viewController?.presentingViewController !== nil {
viewController?.dismiss(animated: animated, completion: {
completion?(nil, true)
})
} else if viewController?.navigationController?.topViewController == viewController,
viewController?.navigationController?.viewControllers.count ?? 0 > 1 {
viewController?.navigationController?.popViewController(animated: animated)
} else if viewController?.presentingViewController !== nil {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
"/action/dismiss": {
"destination":"PlatformParticles.DismissActionBuilder"
},
"/action/dismiss_presented": {
"destination":"PlatformParticles.DismissPresentedActionBuilder"
},
"/action/order/cancel": {
"destination":"dydxPresenters.dydxCancelOrderActionBuilder"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private class dydxVaultDepositWithdrawConfirmationViewPresenter: HostedViewPrese
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
if Int.random(in: 1...6) == 1 {
// success
Router.shared?.navigate(to: RoutingRequest(path: "/action/dismiss_presented"), animated: true, completion: nil)
Router.shared?.navigate(to: RoutingRequest(path: "/action/dismiss", params: ["shouldPrioritizeDismiss": true]), animated: true, completion: nil)
} else {
// failure
self?.viewModel?.isFirstSubmission = false
Expand Down Expand Up @@ -138,7 +138,7 @@ private class dydxVaultDepositWithdrawConfirmationViewPresenter: HostedViewPrese
let curFreeCollateral = subaccount?.freeCollateral?.current?.doubleValue,
let curMarginUsage = subaccount?.marginUsage?.current?.doubleValue
else {
assertionFailure()
// assertionFailure()
return
}

Expand Down

0 comments on commit 9622320

Please sign in to comment.