11import SwiftUI
22
3+ @available ( iOS 17 . 0 , * )
34struct PointOfSaleBarcodeScannerSetUpFlow : View {
45 @Binding var isPresented : Bool
56
@@ -9,7 +10,22 @@ struct PointOfSaleBarcodeScannerSetUpFlow: View {
910
1011 var body : some View {
1112 NavigationStack {
12- ScannerSelectionView ( isPresented: $isPresented)
13+ VStack ( spacing: POSSpacing . xxLarge) {
14+ PointOfSaleModalHeader ( isPresented: $isPresented,
15+ title: . constant( AttributedString ( Localization . setupHeading) ) )
16+
17+ VStack {
18+ ScannerSelectionView ( isPresented: $isPresented)
19+ Spacer ( )
20+ }
21+ . scrollVerticallyIfNeeded ( )
22+ }
23+ . toolbar ( . hidden, for: . navigationBar)
24+ }
25+ . padding ( POSPadding . xxLarge)
26+ . background ( Color . posSurfaceBright)
27+ . containerRelativeFrame ( [ . horizontal, . vertical] ) { length, _ in
28+ max ( length * 0.75 , Constants . modalFrameMaxSmallDimension)
1329 }
1430 . onAppear {
1531 ServiceLocator . analytics. track ( . pointOfSaleBarcodeScannerSetupFlowShown)
@@ -19,53 +35,50 @@ struct PointOfSaleBarcodeScannerSetUpFlow: View {
1935
2036struct ScannerSelectionView : View {
2137 @Binding var isPresented : Bool
22-
2338 var body : some View {
24- PointOfSaleInformationModal ( isPresented: $isPresented, title: AttributedString ( Localization . setupHeading) ) {
25- VStack ( spacing: POSSpacing . medium) {
26- Text ( AttributedString ( Localization . setupIntroMessage) )
27- . font ( . posBodyLargeRegular( ) )
28- . foregroundStyle ( Color . posOnSurface)
29- . multilineTextAlignment ( . leading)
30- . fixedSize ( horizontal: false , vertical: true )
31-
32- VStack ( spacing: POSSpacing . small) {
33- // Socket S720
34- NavigationLink ( destination: EmptyView ( ) ) {
35- ScannerOptionView (
36- title: Localization . socketS720Title,
37- subtitle: Localization . socketS720Subtitle
38- )
39- }
40- . buttonStyle ( PlainButtonStyle ( ) )
41-
42- // Star BSH-20B
43- NavigationLink ( destination: EmptyView ( ) ) {
44- ScannerOptionView (
45- title: Localization . starBSH20BTitle,
46- subtitle: Localization . starBSH20BSubtitle
47- )
48- }
49- . buttonStyle ( PlainButtonStyle ( ) )
50-
51- // TBC Scanner
52- NavigationLink ( destination: EmptyView ( ) ) {
53- ScannerOptionView (
54- title: Localization . tbcScannerTitle,
55- subtitle: Localization . tbcScannerSubtitle
56- )
57- }
58- . buttonStyle ( PlainButtonStyle ( ) )
59-
60- // Other
61- NavigationLink ( destination: BarcodeScannerInformationView ( ) ) {
62- ScannerOptionView (
63- title: Localization . otherTitle,
64- subtitle: Localization . otherSubtitle
65- )
66- }
67- . buttonStyle ( PlainButtonStyle ( ) )
39+ VStack ( spacing: POSSpacing . medium) {
40+ Text ( Localization . setupIntroMessage)
41+ . font ( . posBodyLargeRegular( ) )
42+ . foregroundStyle ( Color . posOnSurface)
43+ . multilineTextAlignment ( . leading)
44+ . fixedSize ( horizontal: false , vertical: true )
45+
46+ VStack ( spacing: POSSpacing . small) {
47+ // Socket S720
48+ NavigationLink ( destination: EmptyView ( ) ) {
49+ ScannerOptionView (
50+ title: Localization . socketS720Title,
51+ subtitle: Localization . socketS720Subtitle
52+ )
53+ }
54+ . buttonStyle ( PlainButtonStyle ( ) )
55+
56+ // Star BSH-20B
57+ NavigationLink ( destination: EmptyView ( ) ) {
58+ ScannerOptionView (
59+ title: Localization . starBSH20BTitle,
60+ subtitle: Localization . starBSH20BSubtitle
61+ )
62+ }
63+ . buttonStyle ( PlainButtonStyle ( ) )
64+
65+ // TBC Scanner
66+ NavigationLink ( destination: EmptyView ( ) ) {
67+ ScannerOptionView (
68+ title: Localization . tbcScannerTitle,
69+ subtitle: Localization . tbcScannerSubtitle
70+ )
6871 }
72+ . buttonStyle ( PlainButtonStyle ( ) )
73+
74+ // Other
75+ NavigationLink ( destination: BarcodeScannerInformationView ( isPresented: $isPresented) ) {
76+ ScannerOptionView (
77+ title: Localization . otherTitle,
78+ subtitle: Localization . otherSubtitle
79+ )
80+ }
81+ . buttonStyle ( PlainButtonStyle ( ) )
6982 }
7083 }
7184 }
@@ -86,7 +99,7 @@ struct ScannerOptionView: View {
8699 . foregroundColor ( . posOnSurfaceVariantHighest)
87100 }
88101 Spacer ( )
89- Image ( systemName: " chevron.right " )
102+ Image ( systemName: " chevron.forward " )
90103 . font ( . posBodyMediumBold)
91104 . foregroundColor ( . posOnSurfaceVariantHighest)
92105 }
@@ -97,29 +110,27 @@ struct ScannerOptionView: View {
97110}
98111
99112struct BarcodeScannerInformationView : View {
100- @Environment ( \ . dismiss ) private var dismiss
113+ @Binding var isPresented : Bool
101114
102115 var body : some View {
103- PointOfSaleBarcodeScannerInformationModal ( isPresented: . constant( true ) )
104- . navigationBarBackButtonHidden ( true )
105- . toolbar {
106- ToolbarItem ( placement: . navigationBarLeading) {
107- Button ( action: {
108- dismiss ( )
109- } ) {
110- HStack ( spacing: POSSpacing . xSmall) {
111- Image ( systemName: " chevron.left " )
112- . font ( . posBodyMediumBold)
113- Text ( Localization . backButtonTitle)
114- . font ( . posBodyMediumBold)
115- }
116- . foregroundColor ( . posOnSurface)
117- }
116+ VStack ( spacing: POSSpacing . xxLarge) {
117+ PointOfSaleModalHeader ( isPresented: $isPresented,
118+ title: . constant( AttributedString ( PointOfSaleBarcodeScannerInformationModal . Localization. barcodeInfoHeading) ) )
119+ VStack {
120+ BarcodeScannerInformationContent ( )
121+ Spacer ( )
118122 }
123+ . scrollVerticallyIfNeeded ( )
119124 }
125+ . toolbar ( . hidden, for: . navigationBar)
120126 }
121127}
122128
129+
130+ private enum Constants {
131+ static var modalFrameMaxSmallDimension : CGFloat { 752 }
132+ }
133+
123134// MARK: - Localization
124135private enum Localization {
125136 static let setupHeading = NSLocalizedString (
@@ -139,7 +150,7 @@ private enum Localization {
139150 )
140151 static let socketS720Subtitle = NSLocalizedString (
141152 " pos.barcodeScannerSetup.socketS720.subtitle " ,
142- value: " Recommended scanner" ,
153+ value: " Small handheld scanner with a charging dock or stand " ,
143154 comment: " Subtitle for Socket S720 scanner option in barcode scanner setup "
144155 )
145156 static let starBSH20BTitle = NSLocalizedString (
@@ -149,7 +160,7 @@ private enum Localization {
149160 )
150161 static let starBSH20BSubtitle = NSLocalizedString (
151162 " pos.barcodeScannerSetup.starBSH20B.subtitle " ,
152- value: " Recommended scanner" ,
163+ value: " Ergonomic scanner with a stand " ,
153164 comment: " Subtitle for Star BSH-20B scanner option in barcode scanner setup "
154165 )
155166 static let tbcScannerTitle = NSLocalizedString (
@@ -169,7 +180,7 @@ private enum Localization {
169180 )
170181 static let otherSubtitle = NSLocalizedString (
171182 " pos.barcodeScannerSetup.other.subtitle " ,
172- value: " General setup instructions " ,
183+ value: " General scanner setup instructions " ,
173184 comment: " Subtitle for other scanner option in barcode scanner setup "
174185 )
175186 static let backButtonTitle = NSLocalizedString (
@@ -179,6 +190,7 @@ private enum Localization {
179190 )
180191}
181192
193+ @available ( iOS 17 . 0 , * )
182194#Preview {
183195 PointOfSaleBarcodeScannerSetUpFlow ( isPresented: . constant( true ) )
184196}
0 commit comments