Skip to content
Merged
Show file tree
Hide file tree
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 @@ -37,7 +37,7 @@ public class BottomSheetViewController: UIViewController,
public var themeManager: ThemeManager
public var themeListenerCancellable: Any?

private let viewModel: BottomSheetViewModel
internal let viewModel: BottomSheetViewModel
private var useDimmedBackground: Bool
private let childViewController: BottomSheetChild

Expand All @@ -62,7 +62,7 @@ public class BottomSheetViewController: UIViewController,
private lazy var sheetView: UIView = .build { _ in }
private lazy var contentView: UIView = .build { _ in }
private lazy var scrollContentView: UIView = .build { _ in }
private var contentViewBottomConstraint: NSLayoutConstraint?
internal var contentViewBottomConstraint: NSLayoutConstraint?
private var viewTranslation = CGPoint(x: 0, y: 0)
private let windowUUID: WindowUUID
private var glassEffectView: UIVisualEffectView?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import Common
import Foundation
import UIKit

/// A specialized bottom sheet controller for onboarding flows that uses viewWillAppear for animations
@MainActor
public class OnboardingBottomSheetViewController: BottomSheetViewController {
// MARK: - View lifecycle

override public func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

// For onboarding flows, we animate the bottom sheet presentation earlier in the lifecycle
// This ensures the animation starts before the view becomes visible, creating a smoother
// user experience during onboarding transitions
contentViewBottomConstraint?.constant = 0
UIView.animate(withDuration: viewModel.animationTransitionDuration) {
self.view.backgroundColor = self.viewModel.backgroundColor
self.view.layoutIfNeeded()
}
}

// swiftlint:disable:next unneeded_override
override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Override viewDidAppear without additional animation logic since we handle
// all presentation animations in viewWillAppear. This prevents duplicate
// animations that could cause visual glitches in onboarding flows.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ final class OnboardingService: FeatureFlaggable {
closeButtonA11yIdentifier:
AccessibilityIdentifiers.Onboarding.bottomSheetCloseButton
)
let bottomSheetVC = BottomSheetViewController(
let bottomSheetVC = OnboardingBottomSheetViewController(
viewModel: bottomSheetViewModel,
childViewController: instructionsVC,
usingDimmedBackground: true,
Expand Down