Skip to content

Commit

Permalink
Revert "[BIOS-825] Fix height for ContractTemplate with fast rendering"
Browse files Browse the repository at this point in the history
This reverts commit a3ac733
  • Loading branch information
oltv00 committed Jan 25, 2019
1 parent de737cb commit e5e9104
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protocol PaymentMethodsViewInput: ActivityIndicatorFullViewPresenting {

protocol PaymentMethodsViewOutput: ActionTextDialogDelegate {
func setupView()
func viewDidAppear()
func didSelectViewModel(_ viewModel: PaymentMethodViewModel, at indexPath: IndexPath)
func logoutDidPress(at indexPath: IndexPath)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ extension PaymentMethodsPresenter: PaymentMethodsViewOutput {
view.showActivity()
view.setLogoVisible(isLogoVisible)
view.setPlaceholderViewButtonTitle(§Localized.PlaceholderView.buttonTitle)
}

func viewDidAppear() {
DispatchQueue.global().async { [weak self] in
self?.interactor.fetchPaymentMethods()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ final class PaymentMethodsViewController: UIViewController, PlaceholderProvider
output.setupView()
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
output.viewDidAppear()
}

private func loadSubviews() {
titleView.contentView.addSubview(headerView)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ public enum TokenizationAssembly {
clientApplicationKey: inputData.clientApplicationKey,
amount: inputData.amount)

let paymentMethodsModuleInputData
= PaymentMethodsModuleInputData(clientApplicationKey: inputData.clientApplicationKey,
gatewayId: inputData.gatewayId,
amount: inputData.amount,
tokenizationSettings: inputData.tokenizationSettings,
testModeSettings: inputData.testModeSettings,
isLoggingEnabled: inputData.isLoggingEnabled)

let paymentMethods = PaymentMethodsAssembly.makeModule(inputData: paymentMethodsModuleInputData,
moduleOutput: presenter)

viewController.output = presenter
viewController.transitioningDelegate = router
viewController.modalPresentationStyle = .custom
Expand All @@ -45,6 +56,8 @@ public enum TokenizationAssembly {

router.transitionHandler = viewController

viewController.show(paymentMethods, sender: nil)

return viewController
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ extension TokenizationPresenter: TokenizationViewOutput {

func setupView() {
interactor.startAnalyticsService()
presentPaymentMethodsModule()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class TokenizationViewController: UIViewController {

private var containerConstraints: [NSLayoutConstraint] = []

// MARK: - Managing Child View Controllers in a Custom Container

override var shouldAutomaticallyForwardAppearanceMethods: Bool {
return false
}

// MARK: - Configuring the View Rotation Settings

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
Expand Down Expand Up @@ -251,6 +257,8 @@ class TokenizationViewController: UIViewController {
view.addSubview(actionSheetTemplate.view)
actionSheetTemplate.dummyView.addSubview(vc.view)

actionSheetTemplate.beginAppearanceTransition(true, animated: false)

actionSheetTemplate.view.translatesAutoresizingMaskIntoConstraints = false
vc.view.translatesAutoresizingMaskIntoConstraints = false

Expand All @@ -275,6 +283,8 @@ class TokenizationViewController: UIViewController {
actionSheetTemplate.didMove(toParent: self)
vc.didMove(toParent: actionSheetTemplate)

actionSheetTemplate.endAppearanceTransition()

appendIfNeeded(vc)
self.actionSheetTemplate = actionSheetTemplate
}
Expand All @@ -291,6 +301,8 @@ class TokenizationViewController: UIViewController {
vc.view.translatesAutoresizingMaskIntoConstraints = false
modalTemplate.setContentView(vc.view)

modalTemplate.beginAppearanceTransition(true, animated: true)

let modalTemplateConstraints = [
view.leading.constraint(equalTo: modalTemplate.view.leading),
view.trailing.constraint(equalTo: modalTemplate.view.trailing),
Expand All @@ -306,6 +318,8 @@ class TokenizationViewController: UIViewController {
modalTemplate.didMove(toParent: self)
vc.didMove(toParent: modalTemplate)

modalTemplate.endAppearanceTransition()

let hasNavigationBar = (vc as? Presentable)?.hasNavigationBar ?? true
modalTemplate.setNavigationBarHidden(hasNavigationBar == false, animated: false)
modalTemplate.setNavigationItems(modules.map { $0.navigationItem }, animated: false)
Expand Down Expand Up @@ -368,15 +382,20 @@ class TokenizationViewController: UIViewController {
private func hideContainer(_ vc: UIViewController) {
vc.willMove(toParent: nil)

vc.beginAppearanceTransition(false, animated: false)

containerConstraints = []

vc.view.removeFromSuperview()
vc.removeFromParent()

vc.endAppearanceTransition()
}

// MARK: - Hide view controller animated

private func hideAnimated(actionSheet: ActionSheetTemplate, completion: (() -> Void)? = nil) {
actionSheet.beginAppearanceTransition(false, animated: true)
actionSheet.willMove(toParent: nil)

NSLayoutConstraint.deactivate(containerConstraints)
Expand All @@ -394,6 +413,7 @@ class TokenizationViewController: UIViewController {
self.view.layoutIfNeeded()
},
completion: { _ in
actionSheet.endAppearanceTransition()
actionSheet.view.removeFromSuperview()
actionSheet.removeFromParent()
self.actionSheetTemplate = nil
Expand All @@ -402,6 +422,7 @@ class TokenizationViewController: UIViewController {
}

private func hideAnimated(pageSheet: PageSheetTemplate, completion: (() -> Void)? = nil) {
pageSheet.beginAppearanceTransition(false, animated: true)
pageSheet.willMove(toParent: nil)
NSLayoutConstraint.deactivate(containerConstraints)

Expand All @@ -418,6 +439,7 @@ class TokenizationViewController: UIViewController {
self.view.layoutIfNeeded()
},
completion: { _ in
pageSheet.endAppearanceTransition()
pageSheet.view.removeFromSuperview()
pageSheet.removeFromParent()
self.pageSheetTemplate = nil
Expand All @@ -426,6 +448,7 @@ class TokenizationViewController: UIViewController {
}

private func hideAnimated(modalTemplate: ModalTemplate, completion: (() -> Void)? = nil) {
modalTemplate.beginAppearanceTransition(false, animated: true)
modalTemplate.willMove(toParent: nil)
NSLayoutConstraint.deactivate(containerConstraints)

Expand All @@ -442,6 +465,7 @@ class TokenizationViewController: UIViewController {
self.view.layoutIfNeeded()
},
completion: { _ in
modalTemplate.endAppearanceTransition()
modalTemplate.view.removeFromSuperview()
modalTemplate.removeFromParent()
self.modalTemplate = nil
Expand All @@ -465,6 +489,8 @@ class TokenizationViewController: UIViewController {
modalTemplate.addChild(vc)
modalTemplate.setContentView(vc.view)

modalTemplate.beginAppearanceTransition(true, animated: true)

let startConstraints = [
modalTemplate.view.leading.constraint(equalTo: view.leading),
modalTemplate.view.top.constraint(equalTo: view.bottom),
Expand Down Expand Up @@ -497,6 +523,8 @@ class TokenizationViewController: UIViewController {
modalTemplate.didMove(toParent: self)
vc.didMove(toParent: modalTemplate)

modalTemplate.endAppearanceTransition()

self.modalTemplate = modalTemplate
completion?()
})
Expand All @@ -514,6 +542,8 @@ class TokenizationViewController: UIViewController {
vc.view.translatesAutoresizingMaskIntoConstraints = false
pageSheet.setContentView(vc.view)

pageSheet.beginAppearanceTransition(true, animated: true)

let startConstraints = [
pageSheet.view.leading.constraint(equalTo: view.leading),
pageSheet.view.top.constraint(equalTo: view.bottom),
Expand Down Expand Up @@ -546,6 +576,8 @@ class TokenizationViewController: UIViewController {
pageSheet.didMove(toParent: self)
vc.didMove(toParent: pageSheet)

pageSheet.endAppearanceTransition()

vc.removeKeyboardObservers()

self.pageSheetTemplate = pageSheet
Expand All @@ -563,6 +595,8 @@ class TokenizationViewController: UIViewController {
actionSheetTemplate.addChild(vc)
vc.didMove(toParent: actionSheetTemplate)

actionSheetTemplate.beginAppearanceTransition(true, animated: true)

view.addSubview(actionSheetTemplate.view)
actionSheetTemplate.dummyView.addSubview(vc.view)

Expand Down Expand Up @@ -604,6 +638,9 @@ class TokenizationViewController: UIViewController {
},
completion: { _ in
actionSheetTemplate.didMove(toParent: self)

actionSheetTemplate.endAppearanceTransition()

completion?()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ extension YandexAuthPresenter: PaymentMethodsViewOutput {
}
}

func viewDidAppear() {}
func didSelectViewModel(_ viewModel: PaymentMethodViewModel, at indexPath: IndexPath) {}
func logoutDidPress(at indexPath: IndexPath) {}
}
Expand Down

0 comments on commit e5e9104

Please sign in to comment.