@@ -15,10 +15,20 @@ import UIKit
15
15
NSClassFromString ( " StripeFinancialConnections.FinancialConnectionsSDKImplementation " )
16
16
as? FinancialConnectionsSDKInterface . Type
17
17
18
- static let FinancialConnectionsLiteClass : FinancialConnectionsSDKInterface . Type ? =
18
+ static let FinancialConnectionsLiteImplementation : FinancialConnectionsSDKInterface . Type ? =
19
19
NSClassFromString ( " StripePaymentSheet.FCLiteImplementation " )
20
20
as? FinancialConnectionsSDKInterface . Type
21
21
22
+ @_spi ( STP) public static var fcLiteKillswitchEnabled : Bool = false
23
+ @_spi ( STP) public static var shouldPreferFCLite : Bool = false
24
+
25
+ private static var FCLiteClassIfEnabled : FinancialConnectionsSDKInterface . Type ? {
26
+ guard !Self. fcLiteKillswitchEnabled else {
27
+ return nil
28
+ }
29
+ return Self . FinancialConnectionsLiteImplementation
30
+ }
31
+
22
32
static let isUnitTest : Bool = {
23
33
#if targetEnvironment(simulator)
24
34
return NSClassFromString ( " XCTest " ) != nil
@@ -37,14 +47,15 @@ import UIKit
37
47
38
48
// Return true for unit tests, the value of `FinancialConnectionsSDKAvailable` for UI tests,
39
49
// and whether or not the Financial Connections SDK is available otherwise.
50
+ // Falls back on FC Lite availability.
40
51
@_spi ( STP) public static var isFinancialConnectionsSDKAvailable : Bool {
41
52
if isUnitTest {
42
53
return true
43
54
} else if isUITest {
44
55
let financialConnectionsSDKAvailable = ProcessInfo . processInfo. environment [ " FinancialConnectionsSDKAvailable " ] == " true "
45
56
return financialConnectionsSDKAvailable
46
57
} else {
47
- return ( FinancialConnectionsSDKClass != nil || FinancialConnectionsLiteClass != nil )
58
+ return ( FinancialConnectionsSDKClass != nil || FCLiteClassIfEnabled != nil )
48
59
}
49
60
}
50
61
@@ -54,7 +65,11 @@ import UIKit
54
65
return StubbedConnectionsSDKInterface ( )
55
66
}
56
67
57
- guard let klass = /*FinancialConnectionsSDKClass ??*/ FinancialConnectionsLiteClass else {
68
+ let klass : FinancialConnectionsSDKInterface . Type ? = shouldPreferFCLite
69
+ ? ( FCLiteClassIfEnabled ?? FinancialConnectionsSDKClass)
70
+ : ( FinancialConnectionsSDKClass ?? FCLiteClassIfEnabled)
71
+
72
+ guard let klass else {
58
73
return nil
59
74
}
60
75
0 commit comments