@@ -89,16 +89,6 @@ class CustomListViewController: UIViewController {
89
89
}
90
90
91
91
private func configureNavigationItem( ) {
92
- <<<<<<< HEAD
93
- =======
94
- navigationItem. title = NSLocalizedString (
95
- " CUSTOM_LIST_NAVIGATION_EDIT_TITLE " ,
96
- tableName: " CustomLists " ,
97
- value: subject. value. name,
98
- comment: " "
99
- )
100
-
101
- >>>>>>> ba5bb4354 ( Add UI for creating and editing a custom list )
102
92
navigationItem. leftBarButtonItem = UIBarButtonItem (
103
93
systemItem: . cancel,
104
94
primaryAction: UIAction ( handler: { _ in
@@ -157,8 +147,7 @@ class CustomListViewController: UIViewController {
157
147
}
158
148
159
149
private func onDelete( ) {
160
- // TODO: Show error dialog.
161
- delegate? . customListDidDelete ( )
150
+ showDeleteAlert ( )
162
151
}
163
152
164
153
private func showSaveErrorAlert( ) {
@@ -186,4 +175,44 @@ class CustomListViewController: UIViewController {
186
175
187
176
alertPresenter. showAlert ( presentation: presentation, animated: true )
188
177
}
178
+
179
+ private func showDeleteAlert( ) {
180
+ let presentation = AlertPresentation (
181
+ id: " api-custom-lists-delete-list-alert " ,
182
+ icon: . alert,
183
+ message: NSLocalizedString (
184
+ " CUSTOM_LISTS_DELETE_PROMPT " ,
185
+ tableName: " APIAccess " ,
186
+ value: " Delete \( subject. value. name) ? " ,
187
+ comment: " "
188
+ ) ,
189
+ buttons: [
190
+ AlertAction (
191
+ title: NSLocalizedString (
192
+ " CUSTOM_LISTS_DELETE_BUTTON " ,
193
+ tableName: " APIAccess " ,
194
+ value: " Delete " ,
195
+ comment: " "
196
+ ) ,
197
+ style: . destructive,
198
+ handler: {
199
+ self . interactor. deleteCustomList ( id: self . subject. value. id)
200
+ self . dismiss ( animated: true )
201
+ self . delegate? . customListDidDelete ( )
202
+ }
203
+ ) ,
204
+ AlertAction (
205
+ title: NSLocalizedString (
206
+ " CUSTOM_LISTS_CANCEL_BUTTON " ,
207
+ tableName: " APIAccess " ,
208
+ value: " Cancel " ,
209
+ comment: " "
210
+ ) ,
211
+ style: . default
212
+ ) ,
213
+ ]
214
+ )
215
+
216
+ alertPresenter. showAlert ( presentation: presentation, animated: true )
217
+ }
189
218
}
0 commit comments