Skip to content

Commit 11bdd9f

Browse files
committed
NotificationsViewController: Wiring OrderLoaderVIewController
1 parent 27968e8 commit 11bdd9f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

WooCommerce/Classes/ViewRelated/Notifications/NotificationsViewController.swift

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,37 @@ extension NotificationsViewController: UITableViewDelegate {
215215
tableView.deselectRow(at: indexPath, animated: true)
216216

217217
let note = resultsController.object(at: indexPath)
218-
let detailsViewController = NotificationDetailsViewController(note: note)
219218

219+
switch note.kind {
220+
case .storeOrder:
221+
presentOrderDetails(for: note)
222+
default:
223+
presentNotificationDetails(for: note)
224+
}
225+
}
226+
}
227+
228+
229+
// MARK: - Details Rendering
230+
//
231+
private extension NotificationsViewController {
232+
233+
/// Pushes the Order Details associated to a given Note (if possible).
234+
///
235+
func presentOrderDetails(for note: Note) {
236+
guard let orderID = note.meta.identifier(forKey: .order), let siteID = note.meta.identifier(forKey: .site) else {
237+
DDLogError("## Notification with [\(note.noteId)] lacks its OrderID!")
238+
return
239+
}
240+
241+
let loaderViewController = OrderLoaderViewController(orderID: orderID, siteID: siteID)
242+
navigationController?.pushViewController(loaderViewController, animated: true)
243+
}
244+
245+
/// Pushes the Notification Details associated to a given Note.
246+
///
247+
func presentNotificationDetails(for note: Note) {
248+
let detailsViewController = NotificationDetailsViewController(note: note)
220249
navigationController?.pushViewController(detailsViewController, animated: true)
221250
}
222251
}

0 commit comments

Comments
 (0)