refactor: Create subscriptions controller from code
This commit is contained in:
@@ -26,8 +26,6 @@
|
||||
|
||||
@implementation AllerteViewController
|
||||
|
||||
static NSString * const SegueIdentifierPrioritySubscriptions = @"ShowPrioritySubscriptions";
|
||||
|
||||
/// Sections inside the app
|
||||
typedef NS_ENUM(NSInteger, AllerteTableRow) {
|
||||
AllerteTableRowLocationPermission = 0,
|
||||
@@ -358,9 +356,10 @@ typedef NS_ENUM(NSInteger, AllerteTableRow) {
|
||||
|
||||
AllerteTableRow tableRow = [self.tableItems[indexPath.row] integerValue];
|
||||
switch (tableRow) {
|
||||
case AllerteTableRowServizioPriorita:
|
||||
[self performSegueWithIdentifier:SegueIdentifierPrioritySubscriptions sender:nil];
|
||||
break;
|
||||
case AllerteTableRowServizioPriorita: {
|
||||
SubscriptionsViewController *controller = [[SubscriptionsViewController alloc] init];
|
||||
[self.navigationController pushViewController:controller animated:YES];
|
||||
}; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import UIKit
|
||||
import StoreKit
|
||||
import Shogun
|
||||
|
||||
|
||||
@objc
|
||||
class SubscriptionsViewController: UITableViewController {
|
||||
|
||||
// sezioni
|
||||
@@ -41,6 +41,13 @@ class SubscriptionsViewController: UITableViewController {
|
||||
/// Tells if a restore is in progress
|
||||
private var isRestorePurchase = false
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
@objc
|
||||
convenience init() {
|
||||
self.init(style: .plain)
|
||||
}
|
||||
|
||||
// MARK: - View Lifecycle
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -85,9 +92,12 @@ class SubscriptionsViewController: UITableViewController {
|
||||
let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(closeTapped(_:)))
|
||||
navigationItem.leftBarButtonItem = doneButton
|
||||
}
|
||||
navigationItem.largeTitleDisplayMode = .never
|
||||
|
||||
tableView.rowHeight = UITableView.automaticDimension
|
||||
tableView.estimatedRowHeight = 600.0
|
||||
tableView.separatorStyle = .none
|
||||
tableView.backgroundColor = .systemGroupedBackground
|
||||
tableView.registerCell(for: SubscriptionsActiveTableViewCell.self)
|
||||
tableView.registerCell(for: SubscriptionsDescriptionTableViewCell.self)
|
||||
tableView.registerCell(for: SubscriptionProductTableViewCell.self)
|
||||
@@ -275,13 +285,3 @@ class SubscriptionsViewController: UITableViewController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension SubscriptionsViewController: StoryboardInitializable {
|
||||
static var storyboardName: String {
|
||||
"Main"
|
||||
}
|
||||
|
||||
static var storyboardControllerId: String {
|
||||
"subscriptionsController"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ class AlertSimulatorViewController: UIViewController, MKMapViewDelegate {
|
||||
}
|
||||
|
||||
private func navigateToSubscriptions() {
|
||||
let controller = SubscriptionsViewController.makeViewController()
|
||||
let controller = SubscriptionsViewController()
|
||||
let navigationController = UINavigationController(rootViewController: controller)
|
||||
present(navigationController, animated: true)
|
||||
}
|
||||
|
||||
@@ -266,25 +266,6 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-8710" y="-4526"/>
|
||||
</scene>
|
||||
<!--Subscriptions View Controller-->
|
||||
<scene sceneID="9hc-If-3Tb">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="subscriptionsController" modalPresentationStyle="fullScreen" id="cXN-cY-DjM" customClass="SubscriptionsViewController" customModule="Earthquake_Network" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="q2Q-SQ-bFH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="cXN-cY-DjM" id="bo0-tj-smp"/>
|
||||
<outlet property="delegate" destination="cXN-cY-DjM" id="y7A-F9-Alv"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" largeTitleDisplayMode="never" id="rLC-QL-XEw"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="PGf-04-LJ4" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-6649" y="-7441"/>
|
||||
</scene>
|
||||
<!--Main Tab Bar Controller-->
|
||||
<scene sceneID="ZSH-pu-BI9">
|
||||
<objects>
|
||||
@@ -795,7 +776,6 @@ Sisma rilevato da 10 smartphone</string>
|
||||
<outlet property="bannerContainerView" destination="PyX-yA-DXv" id="KjR-S3-WEU"/>
|
||||
<outlet property="expandeCollapseButton" destination="pbW-2s-ktg" id="QmE-Nl-SmO"/>
|
||||
<outlet property="tableView" destination="a35-sg-TCr" id="OhR-Ty-elu"/>
|
||||
<segue destination="cXN-cY-DjM" kind="show" identifier="ShowPrioritySubscriptions" id="yhm-9X-yNM"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="9hV-CI-LbC" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
@@ -821,8 +801,5 @@ Sisma rilevato da 10 smartphone</string>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemGroupedBackgroundColor">
|
||||
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
Reference in New Issue
Block a user