// // NotificationsPageViewController.swift // Tusker // // Created by Shadowfacts on 9/13/19. // Copyright © 2019 Shadowfacts. All rights reserved. // import UIKit import Pachyderm class NotificationsPageViewController: SegmentedPageViewController { private let notificationsTitle = NSLocalizedString("Notifications", comment: "notifications tab title") private let mentionsTitle = NSLocalizedString("Mentions", comment: "mentions tab title") init() { let notifications = NotificationsTableViewController(allowedTypes: Pachyderm.Notification.Kind.allCases) notifications.title = notificationsTitle notifications.userActivity = UserActivityManager.checkNotificationsActivity() let mentions = NotificationsTableViewController(allowedTypes: [.mention]) mentions.title = mentionsTitle mentions.userActivity = UserActivityManager.checkMentionsActivity() super.init(titles: [ notificationsTitle, mentionsTitle ], pageControllers: [ notifications, mentions ]) title = notificationsTitle tabBarItem.image = UIImage(systemName: "bell.fill") } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() selectMode(Preferences.shared.defaultNotificationsMode) } func selectMode(_ mode: NotificationsMode) { let index: Int switch mode { case .allNotifications: index = 0 case .mentionsOnly: index = 1 } segmentedControl.selectedSegmentIndex = index selectPage(at: index, animated: false) } }