Skip to content

Commit

Permalink
[NTV-259] Enable change of payment method to Apple Pay when variant i…
Browse files Browse the repository at this point in the history
…s active (#1626)

* Adding signal to support changing payment method to Apple Pay when optimizely variant is active

* Adding tests for control and a boolean check on signal.

* Checking and unchecking automatically manage signing for Alpha
  • Loading branch information
singhhari authored Oct 27, 2021
1 parent d080f72 commit 3e31e13
Show file tree
Hide file tree
Showing 3 changed files with 506 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Kickstarter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8302,6 +8302,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "app-icon-alpha";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Kickstarter-iOS/Alpha.entitlements";
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 5DAN4UM3NC;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
Expand Down
9 changes: 9 additions & 0 deletions Library/ViewModels/PledgeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,19 @@ public class PledgeViewModel: PledgeViewModelType, PledgeViewModelInputs, Pledge

// MARK: - Apple Pay

let applePayButtonTappedAndIsChangingPaymentMethod = self.applePayButtonTappedSignal
.filter { _ in !isNativeRiskMessagingControlEnabled() }
.combineLatest(with: context)
.map(second)
.filter { $0 == .changePaymentMethod }
.ignoreValues()

// If the Optimizely risk messaging experiment is set to the control AND the Pay With Apple button is tapped
// Or if the Optimizely risk messaging experiment is set to the variant, and we are changing the payment method to Pay With Apple
// Or if the Optimizely risk messaging experiment is set to the variant and it is dismissed, this emits
let applePayButtonTappedOrRiskMessagingModalDismissed = Signal.merge(
self.applePayButtonTappedSignal.filter(isNativeRiskMessagingControlEnabled),
applePayButtonTappedAndIsChangingPaymentMethod,
self.riskMessagingViewControllerDismissedProperty.signal.skipNil().filter(isTrue).ignoreValues()
)

Expand Down
Loading

0 comments on commit 3e31e13

Please sign in to comment.