Skip to content

Commit

Permalink
Fix brave#1426: App crash at launch on iOS 12 devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
iccub committed Aug 23, 2019
1 parent 572271f commit da87d60
Showing 1 changed file with 5 additions and 8 deletions.
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

0 comments on commit da87d60

Please sign in to comment.