Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #1426: App crash at launch on iOS 12 devices. #1427

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ class OnboardingNavigationController: UINavigationController {
}
}

let onboardingType: OnboardingType
private(set) var onboardingType: OnboardingType?

init?(profile: Profile, onboardingType: OnboardingType) {
convenience init?(profile: Profile, onboardingType: OnboardingType) {
guard let firstScreen = onboardingType.screens.first else { return nil }
self.onboardingType = onboardingType

let firstViewController = firstScreen.viewController(with: profile)
super.init(rootViewController: firstViewController)
self.init(rootViewController: firstViewController)
self.onboardingType = onboardingType
firstViewController.delegate = self

isNavigationBarHidden = true
Expand All @@ -84,15 +84,12 @@ class OnboardingNavigationController: UINavigationController {
}
preferredContentSize = UX.preferredModalSize
}

@available(*, unavailable)
required init(coder: NSCoder) { fatalError() }
}

extension OnboardingNavigationController: Onboardable {

func presentNextScreen(current: OnboardingViewController) {
let allScreens = onboardingType.screens
guard let allScreens = onboardingType?.screens else { return }
let index = allScreens.firstIndex { $0.type == type(of: current) }

guard let nextIndex = index?.advanced(by: 1),
Expand Down