@@ -78,12 +78,12 @@ import WordPressUI
7878 switch selectionMode {
7979 case . post:
8080 navigationItem. rightBarButtonItem = rightBarButtonItem
81- title = NSLocalizedString ( " Post Categories " , comment : " Title for selecting categories for a post " )
81+ title = Strings . postCategoriesTitle
8282 case . parent:
8383 navigationItem. rightBarButtonItem = rightBarButtonItem
84- title = NSLocalizedString ( " Parent Category " , comment : " Title for selecting parent category of a category " )
84+ title = Strings . parentCategoryTitle
8585 case . blogDefault:
86- title = NSLocalizedString ( " Default Category " , comment : " Title for selecting a default category for a post " )
86+ title = Strings . defaultCategoryTitle
8787 }
8888 }
8989
@@ -170,7 +170,7 @@ import WordPressUI
170170 private func configureNoCategoryRow( cell: WPTableViewCell ) {
171171 WPStyleGuide . configureTableViewDestructiveActionCell ( cell)
172172 cell. textLabel? . textAlignment = . natural
173- cell. textLabel? . text = NSLocalizedString ( " No Category " , comment : " Text shown (to select no-category) in the parent-category-selection screen when creating a new category. " )
173+ cell. textLabel? . text = Strings . noCategoryText
174174 if selectedCategories. isEmpty {
175175 cell. accessoryType = selectedCategories. isEmpty ? . checkmark : . none
176176 } else {
@@ -184,11 +184,14 @@ import WordPressUI
184184 cell. indentationWidth = Constants . categoryCellIndentation
185185 cell. textLabel? . text = category. categoryName. stringByDecodingXMLCharacters ( )
186186 WPStyleGuide . configureTableViewCell ( cell)
187- if selectedCategories. contains ( category) {
188- cell. accessoryType = . checkmark
189- } else {
190- cell. accessoryType = . none
191- }
187+ cell. accessoryView = makeAccessoryView ( isSelected: selectedCategories. contains ( category) )
188+ }
189+
190+ private func makeAccessoryView( isSelected: Bool ) -> UIView {
191+ let image = UIImage ( systemName: isSelected ? " checkmark.circle.fill " : " circle " )
192+ let view = UIImageView ( image: image)
193+ view. tintColor = isSelected ? UIAppColor . primary : . opaqueSeparator
194+ return view
192195 }
193196
194197 //tableView
@@ -255,10 +258,10 @@ import WordPressUI
255258 if selectedCategories. contains ( category) ,
256259 let index = selectedCategories. firstIndex ( of: category) {
257260 selectedCategories. remove ( at: index)
258- tableView. cellForRow ( at: indexPath) ? . accessoryType = . none
261+ tableView. cellForRow ( at: indexPath) ? . accessoryView = makeAccessoryView ( isSelected : false )
259262 } else {
260263 selectedCategories. append ( category)
261- tableView. cellForRow ( at: indexPath) ? . accessoryType = . checkmark
264+ tableView. cellForRow ( at: indexPath) ? . accessoryView = makeAccessoryView ( isSelected : true )
262265 }
263266
264267 delegate? . postCategoriesViewController ? ( self , didUpdateSelectedCategories: NSSet ( array: selectedCategories) )
@@ -284,4 +287,30 @@ private extension PostCategoriesViewController {
284287 static let categoryCellIdentifier = " CategoryCellIdentifier "
285288 static let categoryCellIndentation = CGFloat ( 16.0 )
286289 }
290+
291+ enum Strings {
292+ static let postCategoriesTitle = NSLocalizedString (
293+ " postCategories.title " ,
294+ value: " Categories " ,
295+ comment: " Title for selecting categories for a post or a page "
296+ )
297+
298+ static let parentCategoryTitle = NSLocalizedString (
299+ " parentCategory.title " ,
300+ value: " Parent Category " ,
301+ comment: " Title for selecting parent category of a category "
302+ )
303+
304+ static let defaultCategoryTitle = NSLocalizedString (
305+ " defaultCategory.title " ,
306+ value: " Default Category " ,
307+ comment: " Title for selecting a default category for a post "
308+ )
309+
310+ static let noCategoryText = NSLocalizedString (
311+ " parentCategory.noCategory " ,
312+ value: " No Category " ,
313+ comment: " Text shown (to select no-category) in the parent-category-selection screen when creating a new category. "
314+ )
315+ }
287316}
0 commit comments