Skip to content

Commit

Permalink
Merge pull request #42 in IL/yandex-checkout-payments-swift from ~TVE…
Browse files Browse the repository at this point in the history
…RDOKHLEB/yandex-checkout-payments-swift:task/b2b/BIOS-825 to release/2.0.0

* commit 'a3ac733c1121e57c2bd307ba76a65b2f78cb2c97':
  [BIOS-825] Fix height for ContractTemplate with fast rendering
  • Loading branch information
oltv00 committed Jan 25, 2019
2 parents 5b7debc + a3ac733 commit de737cb
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ 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,7 +27,9 @@ 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,6 +94,11 @@ 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,17 +33,6 @@ 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 @@ -56,8 +45,6 @@ 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,6 +270,7 @@ extension TokenizationPresenter: TokenizationViewOutput {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ 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 @@ -257,8 +251,6 @@ 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 @@ -283,8 +275,6 @@ class TokenizationViewController: UIViewController {
actionSheetTemplate.didMove(toParent: self)
vc.didMove(toParent: actionSheetTemplate)

actionSheetTemplate.endAppearanceTransition()

appendIfNeeded(vc)
self.actionSheetTemplate = actionSheetTemplate
}
Expand All @@ -301,8 +291,6 @@ 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 @@ -318,8 +306,6 @@ 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 @@ -382,20 +368,15 @@ 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 @@ -413,7 +394,6 @@ class TokenizationViewController: UIViewController {
self.view.layoutIfNeeded()
},
completion: { _ in
actionSheet.endAppearanceTransition()
actionSheet.view.removeFromSuperview()
actionSheet.removeFromParent()
self.actionSheetTemplate = nil
Expand All @@ -422,7 +402,6 @@ 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 @@ -439,7 +418,6 @@ class TokenizationViewController: UIViewController {
self.view.layoutIfNeeded()
},
completion: { _ in
pageSheet.endAppearanceTransition()
pageSheet.view.removeFromSuperview()
pageSheet.removeFromParent()
self.pageSheetTemplate = nil
Expand All @@ -448,7 +426,6 @@ 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 @@ -465,7 +442,6 @@ class TokenizationViewController: UIViewController {
self.view.layoutIfNeeded()
},
completion: { _ in
modalTemplate.endAppearanceTransition()
modalTemplate.view.removeFromSuperview()
modalTemplate.removeFromParent()
self.modalTemplate = nil
Expand All @@ -489,8 +465,6 @@ 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 @@ -523,8 +497,6 @@ class TokenizationViewController: UIViewController {
modalTemplate.didMove(toParent: self)
vc.didMove(toParent: modalTemplate)

modalTemplate.endAppearanceTransition()

self.modalTemplate = modalTemplate
completion?()
})
Expand All @@ -542,8 +514,6 @@ 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 @@ -576,8 +546,6 @@ class TokenizationViewController: UIViewController {
pageSheet.didMove(toParent: self)
vc.didMove(toParent: pageSheet)

pageSheet.endAppearanceTransition()

vc.removeKeyboardObservers()

self.pageSheetTemplate = pageSheet
Expand All @@ -595,8 +563,6 @@ 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 @@ -638,9 +604,6 @@ 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,6 +31,7 @@ extension YandexAuthPresenter: PaymentMethodsViewOutput {
}
}

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

0 comments on commit de737cb

Please sign in to comment.