@@ -86,16 +86,18 @@ private extension SettingsViewController {
8686 }
8787
8888 func configureSections( ) {
89- let primaryStoreTitle = NSLocalizedString ( " PRIMARY STORE " , comment: " My Store > Settings > Primary Store information section " ) . uppercased ( )
90- let privacySettingsTitle = NSLocalizedString ( " HELP IMPROVE THE APP " , comment: " My Store > Settings > Privacy settings section " ) . uppercased ( )
89+ let primaryStoreTitle = NSLocalizedString ( " Primary Store " , comment: " My Store > Settings > Primary Store information section " ) . uppercased ( )
90+ let improveTheAppTitle = NSLocalizedString ( " Help Improve The App " , comment: " My Store > Settings > Privacy settings section " ) . uppercased ( )
9191 let aboutSettingsTitle = NSLocalizedString ( " About the app " , comment: " My Store > Settings > About app section " ) . uppercased ( )
92+ let otherTitle = NSLocalizedString ( " Other " , comment: " My Store > Settings > Other app section " ) . uppercased ( )
9293
9394 sections = [
94- Section ( title: primaryStoreTitle, rows: [ . primaryStore] ) ,
95- Section ( title: nil , rows: [ . support] ) ,
96- Section ( title: privacySettingsTitle, rows: [ . privacy, . featureRequest] ) ,
97- Section ( title: aboutSettingsTitle, rows: [ . about, . licenses] ) ,
98- Section ( title: nil , rows: [ . logout] ) ,
95+ Section ( title: primaryStoreTitle, rows: [ . primaryStore] , footerHeight: CGFloat . leastNonzeroMagnitude) ,
96+ Section ( title: nil , rows: [ . support] , footerHeight: UITableView . automaticDimension) ,
97+ Section ( title: improveTheAppTitle, rows: [ . privacy, . featureRequest] , footerHeight: UITableView . automaticDimension) ,
98+ Section ( title: aboutSettingsTitle, rows: [ . about, . licenses] , footerHeight: UITableView . automaticDimension) ,
99+ Section ( title: otherTitle, rows: [ . appSettings] , footerHeight: CGFloat . leastNonzeroMagnitude) ,
100+ Section ( title: nil , rows: [ . logout] , footerHeight: CGFloat . leastNonzeroMagnitude)
99101 ]
100102 }
101103
@@ -121,6 +123,8 @@ private extension SettingsViewController {
121123 configureAbout ( cell: cell)
122124 case let cell as BasicTableViewCell where row == . licenses:
123125 configureLicenses ( cell: cell)
126+ case let cell as BasicTableViewCell where row == . appSettings:
127+ configureAppSettings ( cell: cell)
124128 case let cell as BasicTableViewCell where row == . logout:
125129 configureLogout ( cell: cell)
126130 default :
@@ -131,6 +135,7 @@ private extension SettingsViewController {
131135 func configurePrimaryStore( cell: HeadlineLabelTableViewCell ) {
132136 cell. headline = siteUrl
133137 cell. body = accountName
138+ cell. selectionStyle = . none
134139 }
135140
136141 func configureSupport( cell: BasicTableViewCell ) {
@@ -163,7 +168,14 @@ private extension SettingsViewController {
163168 cell. textLabel? . text = NSLocalizedString ( " Open source licenses " , comment: " Navigates to open source licenses screen " )
164169 }
165170
171+ func configureAppSettings( cell: BasicTableViewCell ) {
172+ cell. accessoryType = . disclosureIndicator
173+ cell. selectionStyle = . default
174+ cell. textLabel? . text = NSLocalizedString ( " Open device settings " , comment: " Opens iOS's Device Settings for the app " )
175+ }
176+
166177 func configureLogout( cell: BasicTableViewCell ) {
178+ cell. selectionStyle = . default
167179 cell. textLabel? . textAlignment = . center
168180 cell. textLabel? . textColor = StyleManager . destructiveActionColor
169181 cell. textLabel? . text = NSLocalizedString ( " Logout account " , comment: " Logout Action " )
@@ -230,6 +242,13 @@ private extension SettingsViewController {
230242 present ( safariViewController, animated: true , completion: nil )
231243 }
232244
245+ func appSettingsWasPressed( ) {
246+ guard let targetURL = URL ( string: UIApplication . openSettingsURLString) else {
247+ return
248+ }
249+ UIApplication . shared. open ( targetURL)
250+ }
251+
233252 func logOutUser( ) {
234253 StoresManager . shared. deauthenticate ( )
235254 navigationController? . popToRootViewController ( animated: true )
@@ -267,8 +286,7 @@ extension SettingsViewController: UITableViewDataSource {
267286 }
268287
269288 func tableView( _ tableView: UITableView , heightForFooterInSection section: Int ) -> CGFloat {
270- // iOS 11 table bug. Must return a tiny value to collapse `nil` or `empty` section headers.
271- return CGFloat . leastNonzeroMagnitude
289+ return sections [ section] . footerHeight
272290 }
273291
274292 func tableView( _ tableView: UITableView , cellForRowAt indexPath: IndexPath ) -> UITableViewCell {
@@ -305,6 +323,8 @@ extension SettingsViewController: UITableViewDelegate {
305323 licensesWasPressed ( )
306324 case . about:
307325 aboutWasPressed ( )
326+ case . appSettings:
327+ appSettingsWasPressed ( )
308328 default :
309329 break
310330 }
@@ -322,6 +342,7 @@ private struct Constants {
322342private struct Section {
323343 let title : String ?
324344 let rows : [ Row ]
345+ let footerHeight : CGFloat
325346}
326347
327348private enum Row : CaseIterable {
@@ -332,6 +353,7 @@ private enum Row: CaseIterable {
332353 case featureRequest
333354 case about
334355 case licenses
356+ case appSettings
335357
336358 var type : UITableViewCell . Type {
337359 switch self {
@@ -349,6 +371,8 @@ private enum Row: CaseIterable {
349371 return BasicTableViewCell . self
350372 case . licenses:
351373 return BasicTableViewCell . self
374+ case . appSettings:
375+ return BasicTableViewCell . self
352376 }
353377 }
354378
0 commit comments