File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
import Flutter
2
2
import SquareMobilePaymentsSDK
3
+ #if DEBUG
3
4
import MockReaderUI
5
+ #endif
4
6
5
7
public class ReaderModule {
6
8
7
-
9
+ #if DEBUG
8
10
static var mockReader : MockReaderUI ? = {
9
11
do {
10
12
return try MockReaderUI ( for: MobilePaymentsSDK . shared)
11
13
} catch {
12
14
return nil
13
15
}
14
16
} ( )
15
-
17
+ #endif
16
18
17
19
static func parseTapToPayError( error: NSError , defaultError: String ) -> String {
18
20
let tapToPayReaderError = TapToPayReaderError ( rawValue: error. code)
@@ -53,17 +55,22 @@ public class ReaderModule {
53
55
}
54
56
55
57
public static func showMockReaderUI( result: @escaping FlutterResult ) {
58
+ #if DEBUG
56
59
do {
57
60
try mockReader? . present ( )
58
61
result ( " Mock Reader has been successfully presented. " )
59
62
} catch let error {
60
63
result ( FlutterError ( code: " SHOW_MOCK_READER_UI " , message: error. localizedDescription, details: nil ) )
61
64
}
65
+ #else
66
+ result ( FlutterError ( code: " SHOW_MOCK_READER_UI " , message: " Mock Reader UI is only available in debug builds " , details: nil ) )
67
+ #endif
62
68
}
63
69
64
70
public static func hideMockReaderUI( result: @escaping FlutterResult ) {
65
-
71
+ #if DEBUG
66
72
mockReader? . dismiss ( )
73
+ #endif
67
74
result ( " Mock Reader has been successfully hidden. " )
68
75
}
69
76
You can’t perform that action at this time.
0 commit comments