Skip to content
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

Rename PaymentMethodsViewController to PaymentMethodSettingsViewController for clarity #1986

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import Prelude
import StripePaymentSheet
import UIKit

protocol PaymentMethodsViewControllerDelegate: AnyObject {
protocol PaymentMethodSettingsViewControllerDelegate: AnyObject {
func cancelLoadingPaymentMethodsViewController(
_ viewController: PaymentMethodsViewController)
_ viewController: PaymentMethodSettingsViewController)
}

internal final class PaymentMethodsViewController: UIViewController, MessageBannerViewControllerPresenting {
internal final class PaymentMethodSettingsViewController: UIViewController,
MessageBannerViewControllerPresenting {
private let dataSource = PaymentMethodsDataSource()
private let viewModel: PaymentMethodsViewModelType = PaymentMethodsViewModel()
private var paymentSheetFlowController: PaymentSheet.FlowController?
private weak var cancellationDelegate: PaymentMethodsViewControllerDelegate?
private weak var cancellationDelegate: PaymentMethodSettingsViewControllerDelegate?
@IBOutlet private var tableView: UITableView!

fileprivate lazy var editButton: UIBarButtonItem = {
Expand All @@ -27,8 +28,8 @@ internal final class PaymentMethodsViewController: UIViewController, MessageBann

internal var messageBannerViewController: MessageBannerViewController?

public static func instantiate() -> PaymentMethodsViewController {
return Storyboard.Settings.instantiate(PaymentMethodsViewController.self)
public static func instantiate() -> PaymentMethodSettingsViewController {
return Storyboard.Settings.instantiate(PaymentMethodSettingsViewController.self)
}

override func viewDidLoad() {
Expand Down Expand Up @@ -172,7 +173,8 @@ internal final class PaymentMethodsViewController: UIViewController, MessageBann
.showBanner(with: .error, message: error.localizedDescription)
case let .success(paymentSheetFlowController):
let topViewController = strongSelf.navigationController?.topViewController
let paymentSheetShownWithinPaymentMethodsContext = topViewController is PaymentMethodsViewController
let paymentSheetShownWithinPaymentMethodsContext =
topViewController is PaymentMethodSettingsViewController

if paymentSheetShownWithinPaymentMethodsContext {
strongSelf.paymentSheetFlowController = paymentSheetFlowController
Expand Down Expand Up @@ -254,7 +256,7 @@ internal final class PaymentMethodsViewController: UIViewController, MessageBann
}
}

extension PaymentMethodsViewController: UITableViewDelegate {
extension PaymentMethodSettingsViewController: UITableViewDelegate {
func tableView(_: UITableView, heightForFooterInSection _: Int) -> CGFloat {
return 0.1
}
Expand All @@ -264,7 +266,7 @@ extension PaymentMethodsViewController: UITableViewDelegate {
}
}

extension PaymentMethodsViewController: PaymentMethodsFooterViewDelegate {
extension PaymentMethodSettingsViewController: PaymentMethodsFooterViewDelegate {
internal func paymentMethodsFooterViewDidTapAddNewCardButton(_: PaymentMethodsFooterView) {
self.viewModel.inputs.paymentMethodsFooterViewDidTapAddNewCardButton()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Prelude
import SnapshotTesting
import UIKit

class PaymentMethodsViewControllerTests: TestCase {
class PaymentMethodSettingsViewControllerTests: TestCase {
override func setUp() {
super.setUp()

Expand Down Expand Up @@ -36,7 +36,7 @@ class PaymentMethodsViewControllerTests: TestCase {
private func generateSnapshots(with response: UserEnvelope<GraphUser>, name: String) {
combos(Language.allLanguages, Device.allCases).forEach {
arg in
let controller = PaymentMethodsViewController.instantiate()
let controller = PaymentMethodSettingsViewController.instantiate()
let (language, device) = arg
withEnvironment(
apiService: MockService(fetchGraphUserResult: .success(response)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public final class PaymentMethodsFooterView: UIView, NibLoading {
}
}

extension PaymentMethodsFooterView: PaymentMethodsViewControllerDelegate {
extension PaymentMethodsFooterView: PaymentMethodSettingsViewControllerDelegate {
func cancelLoadingPaymentMethodsViewController(
_: PaymentMethodsViewController) {
_: PaymentMethodSettingsViewController) {
self.addCardButton.isHidden = false
self.addCardButton.isUserInteractionEnabled = true
self.loadingIndicator.stopAnimating()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -636,10 +635,10 @@
</objects>
<point key="canvasLocation" x="-3161" y="124"/>
</scene>
<!--Payment Methods View Controller-->
<!--Payment Method Settings View Controller-->
<scene sceneID="zHg-cw-mrH">
<objects>
<viewController storyboardIdentifier="PaymentMethodsViewController" id="x6I-vC-YEC" customClass="PaymentMethodsViewController" customModule="Kickstarter_Framework" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="PaymentMethodSettingsViewController" id="x6I-vC-YEC" customClass="PaymentMethodSettingsViewController" customModule="Kickstarter_Framework" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="YT3-jR-gw6">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ extension SettingsAccountViewController {
case .changePassword:
return ChangePasswordViewController.instantiate()
case .paymentMethods:
return PaymentMethodsViewController.instantiate()
return PaymentMethodSettingsViewController.instantiate()
case .privacy:
return SettingsPrivacyViewController.instantiate()
case .currency:
Expand Down
16 changes: 8 additions & 8 deletions Kickstarter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@
D625AA0C23DA34EA009E6F2C /* BetaToolsFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D625AA0B23DA34EA009E6F2C /* BetaToolsFooterView.swift */; };
D62B1477221216A000AC05C8 /* DeletePaymentMethodEnvelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62B1476221216A000AC05C8 /* DeletePaymentMethodEnvelope.swift */; };
D62B14B02212184500AC05C8 /* DeletePaymentMethodEnvelopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62B14AF2212184500AC05C8 /* DeletePaymentMethodEnvelopeTests.swift */; };
D63BBCD0217E5460007E01F0 /* PaymentMethodsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63BBCCF217E5460007E01F0 /* PaymentMethodsViewController.swift */; };
D63BBCD0217E5460007E01F0 /* PaymentMethodSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63BBCCF217E5460007E01F0 /* PaymentMethodSettingsViewController.swift */; };
D63BBCDA217E7802007E01F0 /* CreditCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63BBCD8217E7802007E01F0 /* CreditCardCell.swift */; };
D63BBCDB217E7802007E01F0 /* CreditCardCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D63BBCD9217E7802007E01F0 /* CreditCardCell.xib */; };
D63BBCF9217F666B007E01F0 /* PaymentMethodsDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63BBCF8217F666B007E01F0 /* PaymentMethodsDataSource.swift */; };
Expand Down Expand Up @@ -1442,7 +1442,7 @@
D6ED38A21F796FE5006CAAE9 /* GraphCategoriesEnvelopeTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6ED38A11F796FE5006CAAE9 /* GraphCategoriesEnvelopeTemplate.swift */; };
D6F5C60F2437DD2A00C1A79D /* SignInWithAppleMutation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F5C60E2437DD2A00C1A79D /* SignInWithAppleMutation.swift */; };
D6F5C6112437E12300C1A79D /* SignInWithAppleInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F5C6102437E12300C1A79D /* SignInWithAppleInput.swift */; };
D6F741A821836E5700C2DDA2 /* PaymentMethodsViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F7416F21836C3D00C2DDA2 /* PaymentMethodsViewControllerTests.swift */; };
D6F741A821836E5700C2DDA2 /* PaymentMethodSettingsViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F7416F21836C3D00C2DDA2 /* PaymentMethodSettingsViewControllerTests.swift */; };
D70347901DBAABC30099C668 /* DiscoveryExpandableRowCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D703478F1DBAABC30099C668 /* DiscoveryExpandableRowCellViewModel.swift */; };
D703FC3120F7E280004A272D /* SettingsPrivacy.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D703FC3020F7E280004A272D /* SettingsPrivacy.storyboard */; };
D703FC6920F7E2EC004A272D /* SettingsPrivacyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D703FC6820F7E2EC004A272D /* SettingsPrivacyViewController.swift */; };
Expand Down Expand Up @@ -2961,7 +2961,7 @@
D625AA0B23DA34EA009E6F2C /* BetaToolsFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BetaToolsFooterView.swift; sourceTree = "<group>"; };
D62B1476221216A000AC05C8 /* DeletePaymentMethodEnvelope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeletePaymentMethodEnvelope.swift; sourceTree = "<group>"; };
D62B14AF2212184500AC05C8 /* DeletePaymentMethodEnvelopeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeletePaymentMethodEnvelopeTests.swift; sourceTree = "<group>"; };
D63BBCCF217E5460007E01F0 /* PaymentMethodsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentMethodsViewController.swift; sourceTree = "<group>"; };
D63BBCCF217E5460007E01F0 /* PaymentMethodSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentMethodSettingsViewController.swift; sourceTree = "<group>"; };
D63BBCD8217E7802007E01F0 /* CreditCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditCardCell.swift; sourceTree = "<group>"; };
D63BBCD9217E7802007E01F0 /* CreditCardCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CreditCardCell.xib; sourceTree = "<group>"; };
D63BBCF8217F666B007E01F0 /* PaymentMethodsDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentMethodsDataSource.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3064,7 +3064,7 @@
D6ED38A11F796FE5006CAAE9 /* GraphCategoriesEnvelopeTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphCategoriesEnvelopeTemplate.swift; sourceTree = "<group>"; };
D6F5C60E2437DD2A00C1A79D /* SignInWithAppleMutation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInWithAppleMutation.swift; sourceTree = "<group>"; };
D6F5C6102437E12300C1A79D /* SignInWithAppleInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInWithAppleInput.swift; sourceTree = "<group>"; };
D6F7416F21836C3D00C2DDA2 /* PaymentMethodsViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentMethodsViewControllerTests.swift; sourceTree = "<group>"; };
D6F7416F21836C3D00C2DDA2 /* PaymentMethodSettingsViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentMethodSettingsViewControllerTests.swift; sourceTree = "<group>"; };
D6FB2A3C1FA27D0300B0D282 /* CategoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryTests.swift; sourceTree = "<group>"; };
D703478F1DBAABC30099C668 /* DiscoveryExpandableRowCellViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoveryExpandableRowCellViewModel.swift; sourceTree = "<group>"; };
D703FC3020F7E280004A272D /* SettingsPrivacy.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = SettingsPrivacy.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5482,8 +5482,8 @@
19A97D3628C8012B0031B857 /* Controller */ = {
isa = PBXGroup;
children = (
D63BBCCF217E5460007E01F0 /* PaymentMethodsViewController.swift */,
D6F7416F21836C3D00C2DDA2 /* PaymentMethodsViewControllerTests.swift */,
D63BBCCF217E5460007E01F0 /* PaymentMethodSettingsViewController.swift */,
D6F7416F21836C3D00C2DDA2 /* PaymentMethodSettingsViewControllerTests.swift */,
);
path = Controller;
sourceTree = "<group>";
Expand Down Expand Up @@ -8387,7 +8387,7 @@
3767EDAB22CFFED40088E8E4 /* ShippingRuleCell.swift in Sources */,
47C500712696481300BB4BF2 /* CommentViewMoreRepliesFailedCell.swift in Sources */,
8ACB32A824ABC2DB00A03968 /* RewardAddOnSelectionViewController.swift in Sources */,
D63BBCD0217E5460007E01F0 /* PaymentMethodsViewController.swift in Sources */,
D63BBCD0217E5460007E01F0 /* PaymentMethodSettingsViewController.swift in Sources */,
379CFFFC2242DAE800F6F0C2 /* Nib.swift in Sources */,
A7CC14451D00E75F00035C52 /* FindFriendsDataSource.swift in Sources */,
A7808BBE1D6240B9001CF96A /* ProjectCreatorViewController.swift in Sources */,
Expand Down Expand Up @@ -8589,7 +8589,7 @@
A7ED20521E8323E900BFFA01 /* FacebookConfirmationViewControllerTests.swift in Sources */,
37CA16B323304DD9006044F9 /* ToggleViewControllerTests.swift in Sources */,
A7ED20231E83237F00BFFA01 /* Combos.swift in Sources */,
D6F741A821836E5700C2DDA2 /* PaymentMethodsViewControllerTests.swift in Sources */,
D6F741A821836E5700C2DDA2 /* PaymentMethodSettingsViewControllerTests.swift in Sources */,
A7ED20621E83256700BFFA01 /* AppDelegateViewModelTests.swift in Sources */,
77EFBAE02268D34A00DA5C3C /* RewardsCollectionViewControllerTests.swift in Sources */,
8A49395D24B5394700C3C3CE /* RewardAddOnSelectionDataSourceTests.swift in Sources */,
Expand Down