Let notification open domain

This commit is contained in:
relikd
2020-07-27 19:06:44 +02:00
parent 01523b250f
commit e398ac8bcd
5 changed files with 21 additions and 7 deletions

View File

@@ -339,7 +339,7 @@
<!--Hosts-->
<scene sceneID="ZCV-Yx-jjW">
<objects>
<tableViewController id="WcC-nb-Vf5" customClass="TVCHosts" customModule="AppCheck" customModuleProvider="target" sceneMemberID="viewController">
<tableViewController storyboardIdentifier="requestsHosts" id="WcC-nb-Vf5" customClass="TVCHosts" customModule="AppCheck" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="nRF-dc-dC2">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -394,7 +394,7 @@
<!--Occurrences-->
<scene sceneID="ws3-sK-l8m">
<objects>
<tableViewController id="h7Z-Qr-pJ5" customClass="TVCHostDetails" customModule="AppCheck" customModuleProvider="target" sceneMemberID="viewController">
<tableViewController storyboardIdentifier="requestsOccurrences" id="h7Z-Qr-pJ5" customClass="TVCHostDetails" customModule="AppCheck" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="4ms-FO-Fge">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

View File

@@ -36,3 +36,9 @@ extension UIEdgeInsets {
self.init(top: top ?? all, left: left ?? all, bottom: bottom ?? all, right: right ?? all)
}
}
extension UIStoryboard {
func load<T: UIViewController>(_ identifier: String) -> T {
instantiateViewController(withIdentifier: identifier) as! T
}
}

View File

@@ -49,7 +49,7 @@ class VCAnalysisBar: UIViewController, UITabBarDelegate {
private func openCoOccurrence() {
guard let delegate = parent as? AnalysisBarDelegate,
let vc = storyboard?.instantiateViewController(withIdentifier: "IBCoOccurrence") as? VCCoOccurrence else {
let vc: VCCoOccurrence = storyboard?.load("IBCoOccurrence") else {
return
}
let info = delegate.analysisBarWillOpenCoOccurrence()

View File

@@ -25,11 +25,20 @@ class TVCDomains: UITableViewController, UISearchBarDelegate, GroupedDomainDataS
}
}
func pushOpen(domain: String) {
let A: TVCHosts = storyboard!.load("requestsHosts")
let B: TVCHostDetails = storyboard!.load("requestsOccurrences")
A.parentDomain = domain.extractDomain()
B.fullDomain = domain
navigationController?.pushViewController(A, animated: false)
navigationController?.pushViewController(B, animated: false)
}
// MARK: - Filter
@IBAction private func filterButtonTapped(_ sender: UIBarButtonItem) {
let vc = self.storyboard!.instantiateViewController(withIdentifier: "domainFilter")
let vc = storyboard!.load("domainFilter")
vc.modalPresentationStyle = .custom
if #available(iOS 13.0, *) {
vc.isModalInPresentation = true

View File

@@ -108,9 +108,8 @@ extension TBCMain: UNUserNotificationCenterDelegate {
case PushNotification.Identifier.CantStopMeNowReminder.rawValue:
(openTab(2) as! TVCSettings).openRestartVPNSettings()
//case PushNotification.Identifier.RestInPeaceTombstoneReminder // only badge
default: // domain notification
// TODO: open specific domain?
openTab(0) // open Requests tab
case let x: // domain notification
(openTab(0) as! TVCDomains).pushOpen(domain: x) // open requests tab
}
completionHandler()
}