Commit ac6c8546 authored by Jose Blaya's avatar Jose Blaya
Browse files

Add WelcomeChild protocol to Restore view controller and add it as a Page

parent 4b4ce7fb
......@@ -13,7 +13,7 @@
<!--Restore Signup View Controller-->
<scene sceneID="fct-7p-tbm">
<objects>
<viewController id="Y1W-Um-2lp" customClass="RestoreSignupViewController" customModule="PIALibrary" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="RestoreSignupViewController" id="Y1W-Um-2lp" customClass="RestoreSignupViewController" customModule="PIALibrary" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="MO3-fL-T5Z">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
......@@ -864,7 +864,7 @@ You will not be charged during this process.</string>
<constraint firstAttribute="height" constant="20" id="8C6-6B-4dA"/>
</constraints>
<connections>
<segue destination="Y1W-Um-2lp" kind="show" identifier="RestorePurchaseSegue" id="Od1-de-d57"/>
<segue destination="vXZ-lx-hvc" kind="show" identifier="RestorePurchaseSegue" id="n8s-aK-2Sf"/>
</connections>
</button>
</subviews>
......@@ -911,7 +911,7 @@ You will not be charged during this process.</string>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="gh3-NB-ifC" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="239" y="-236"/>
<point key="canvasLocation" x="-2972" y="-203"/>
</scene>
<!--Redeem View Controller-->
<scene sceneID="RUV-dc-TfS">
......@@ -1157,7 +1157,7 @@ You will not be charged during this process.</string>
<image name="plan-unselected" width="46" height="46"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="L3M-2E-gAx"/>
<segue reference="apR-1h-IYV"/>
<segue reference="n8s-aK-2Sf"/>
<segue reference="Vqa-Fa-HWk"/>
</inferredMetricsTieBreakers>
</document>
......@@ -28,6 +28,8 @@ internal enum Asset {
internal static let logoLight = ImageAsset(name: "logo-light")
internal static let planSelected = ImageAsset(name: "plan-selected")
internal static let planUnselected = ImageAsset(name: "plan-unselected")
internal static let trustedIcon = ImageAsset(name: "trusted-icon")
internal static let untrustedIcon = ImageAsset(name: "untrusted-icon")
internal static let closeIcon = ImageAsset(name: "close-icon")
internal static let imageAccountFailed = ImageAsset(name: "image-account-failed")
internal static let imageNoInternet = ImageAsset(name: "image-no-internet")
......
......@@ -27,6 +27,7 @@ internal enum StoryboardScene {
internal static let purchaseViewController = SceneType<PIALibrary.PurchaseViewController>(storyboard: Welcome.self, identifier: "PurchaseViewController")
internal static let redeemViewController = SceneType<PIALibrary.RedeemViewController>(storyboard: Welcome.self, identifier: "RedeemViewController")
internal static let restoreViewController = SceneType<PIALibrary.RestoreSignupViewController>(storyboard: Welcome.self, identifier: "RestoreSignupViewController")
}
}
// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name
......
......@@ -73,11 +73,6 @@ public class GetStartedViewController: AutolayoutViewController, ConfigurationAc
public override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let vc = segue.destination as? PIAWelcomeViewController else {
if segue.identifier == StoryboardSegue.Welcome.restorePurchaseSegue.rawValue {
if let vc = segue.destination as? RestoreSignupViewController {
vc.preset = preset
}
}
return
}
......@@ -91,6 +86,8 @@ public class GetStartedViewController: AutolayoutViewController, ConfigurationAc
vc.preset.pages = .purchase
case StoryboardSegue.Welcome.loginAccountSegue.rawValue:
vc.preset.pages = .login
case StoryboardSegue.Welcome.restorePurchaseSegue.rawValue:
vc.preset.pages = .restore
default:
break
}
......
......@@ -11,7 +11,12 @@ import SwiftyBeaver
private let log = SwiftyBeaver.self
public class RestoreSignupViewController: AutolayoutViewController, BrandableNavigationBar {
public class RestoreSignupViewController: AutolayoutViewController, BrandableNavigationBar, WelcomeChild {
var omitsSiblingLink = false
var completionDelegate: WelcomeCompletionDelegate?
@IBOutlet private weak var scrollView: UIScrollView!
@IBOutlet private weak var viewModal: UIView!
......
......@@ -21,7 +21,6 @@ class WelcomePageViewController: UIPageViewController {
guard let preset = self.preset else {
fatalError("Preset not propagated")
}
if preset.pages.contains(.login) {
let vc = StoryboardScene.Welcome.loginViewController.instantiate()
source.append(vc)
......@@ -34,6 +33,10 @@ class WelcomePageViewController: UIPageViewController {
let vc = StoryboardScene.Welcome.redeemViewController.instantiate()
source.append(vc)
}
if preset.pages.contains(.restore) {
let vc = StoryboardScene.Welcome.restoreViewController.instantiate()
source.append(vc)
}
dataSource = self
guard !source.isEmpty else {
......@@ -76,7 +79,10 @@ class WelcomePageViewController: UIPageViewController {
case .redeem:
index = 2
case .restore:
index = 3
default:
return
}
......
......@@ -12,16 +12,19 @@ import Foundation
public struct Pages: OptionSet {
/// The login page.
public static let login = Pages(rawValue: 0x01)
public static let login = Pages(rawValue: 1 << 0)
/// The purchase plan page.
public static let purchase = Pages(rawValue: 0x02)
public static let purchase = Pages(rawValue: 1 << 1)
/// The redeem page.
public static let redeem = Pages(rawValue: 0x04)
public static let redeem = Pages(rawValue: 1 << 2)
/// The redeem page.
public static let restore = Pages(rawValue: 1 << 3)
/// All pages.
public static let all: Pages = [.login, .purchase, .redeem]
public static let all: Pages = [.login, .purchase, .redeem, .restore]
/// :nodoc:
public let rawValue: Int
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment