Mercurial > public > simoleon
comparison Simoleon/Helpers/CurrencySelector.swift @ 93:529feb1fc8d5
Added UI Tests for capture screenshots
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Tue, 03 Aug 2021 12:33:32 +0100 |
parents | 1069c33d3a42 |
children | 599fe95307f6 |
comparison
equal
deleted
inserted
replaced
92:8386dbf80047 | 93:529feb1fc8d5 |
---|---|
38 var body: some View { | 38 var body: some View { |
39 NavigationView { | 39 NavigationView { |
40 VStack { | 40 VStack { |
41 SearchBar(placeholder: "Search...", text: $searchCurrency) | 41 SearchBar(placeholder: "Search...", text: $searchCurrency) |
42 .padding() | 42 .padding() |
43 .accessibilityIdentifier("SearchBar") | |
43 | 44 |
44 if entitlementIsActive { | 45 if entitlementIsActive { |
45 List(searchResults, id: \.self) { currencyPair in | 46 List(searchResults, id: \.self) { currencyPair in |
46 Button(action: { | 47 Button(action: { |
47 self.currencyPair = currencyPair.name | 48 self.currencyPair = currencyPair.name |
48 showingCurrencySelector = false | 49 showingCurrencySelector = false |
49 }) { | 50 }) { |
50 CurrencyRow(currencyPairName: currencyPair.name) | 51 CurrencyRow(currencyPairName: currencyPair.name) |
51 } | 52 } |
53 .accessibilityIdentifier("CurrencyRow") | |
52 } | 54 } |
53 .listStyle() | 55 .listStyle() |
54 } else { | 56 } else { |
55 List(searchResults, id: \.self) { currencyPair in | 57 List(searchResults, id: \.self) { currencyPair in |
56 Button(action: { select(currencyPair) }) { | 58 Button(action: { select(currencyPair) }) { |
94 } | 96 } |
95 } | 97 } |
96 | 98 |
97 // Check if user subscription is active | 99 // Check if user subscription is active |
98 private func checkEntitlement() { | 100 private func checkEntitlement() { |
101 #if DEBUG | |
102 entitlementIsActive = true | |
103 #else | |
99 Purchases.shared.purchaserInfo { (purchaserInfo, error) in | 104 Purchases.shared.purchaserInfo { (purchaserInfo, error) in |
100 if purchaserInfo?.entitlements["all"]?.isActive == true { | 105 if purchaserInfo?.entitlements["all"]?.isActive == true { |
101 entitlementIsActive = true | 106 entitlementIsActive = true |
102 } | 107 } |
103 | 108 |
105 alertTitle = error.localizedDescription | 110 alertTitle = error.localizedDescription |
106 alertMessage = error.localizedFailureReason ?? "" | 111 alertMessage = error.localizedFailureReason ?? "" |
107 showingAlert = true | 112 showingAlert = true |
108 } | 113 } |
109 } | 114 } |
115 #endif | |
110 } | 116 } |
111 } | 117 } |
112 extension View { | 118 extension View { |
113 func listStyle() -> some View { | 119 func listStyle() -> some View { |
114 self.modifier(ListModifier()) | 120 self.modifier(ListModifier()) |