From 024a7c63335a94f23fcd8d18a6872f06ea9f5b32 Mon Sep 17 00:00:00 2001 From: Andrea Busi Date: Sat, 21 Nov 2020 12:29:29 +0100 Subject: [PATCH] feat: Add button to open subscriptions page from simulator result --- .../InApp/SubscriptionsViewController.swift | 10 ++++++++++ .../Simulator/AlertSimulatorViewController.swift | 8 ++++++++ .../Storyboards/Base.lproj/Main.storyboard | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift index 9222169..c450376 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift @@ -255,3 +255,13 @@ class SubscriptionsViewController: UITableViewController { } } } + +extension SubscriptionsViewController: StoryboardInitializable { + static var storyboardName: String { + "Main" + } + + static var storyboardControllerId: String { + "subscriptionsController" + } +} diff --git a/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift b/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift index fc1c9b0..1624fd4 100644 --- a/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift +++ b/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift @@ -224,10 +224,18 @@ class AlertSimulatorViewController: UIViewController, MKMapViewDelegate { } let alert = UIAlertController(title: NSLocalizedString("main_simulator", comment: ""), message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: NSLocalizedString("globe_simulation_priority", comment: ""), style: .default) { (action) in + self.navigateToSubscriptions() + }) alert.addAction(UIAlertAction(title: NSLocalizedString("Ok", comment: ""), style: .cancel, handler: nil)) present(alert, animated: true) } + private func navigateToSubscriptions() { + let controller = SubscriptionsViewController.makeController() + navigationController?.pushViewController(controller, animated: true) + } + // MARK: MKMapViewDelegate func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { diff --git a/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard b/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard index 715a327..e046075 100644 --- a/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard +++ b/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard @@ -1007,7 +1007,7 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern - +