Skip to content
Open
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
5 changes: 3 additions & 2 deletions BrowserKit/Sources/OnboardingKit/Views/Helper/UX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ enum UX {

struct LaunchScreen {
struct Logo {
static let size: CGFloat = 125
static let rotationDuration: TimeInterval = 2.0
static let rotationAngle: Double = 360
static let rotationAngle: Double = .pi * 2.0
static let image = "firefoxLoader"
static let animationKey = "rotationAnimation"
static let animationKeyPath = "transform.rotation.z"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// 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 SwiftUI
import Common

public struct LaunchScreenBackgroundView: View {
private let windowUUID: WindowUUID
private let themeManager: ThemeManager

public init(windowUUID: WindowUUID, themeManager: ThemeManager) {
self.windowUUID = windowUUID
self.themeManager = themeManager
}

public var body: some View {
AnimatedGradientView(
windowUUID: windowUUID,
themeManager: themeManager
)
.ignoresSafeArea()
}
}

public class LaunchScreenLoaderView: UIView {
private let imageView: UIImageView = .build {
$0.image = UIImage(named: UX.LaunchScreen.Logo.image, in: Bundle.module, with: nil)
$0.contentMode = .scaleAspectFit
}

override public init(frame: CGRect) {
super.init(frame: frame)
setupLayout()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setupLayout() {
addSubview(imageView)
imageView.pinToSuperview()
}

public func startAnimating() {
imageView.layer.removeAnimation(forKey: UX.LaunchScreen.Logo.animationKey)

let rotationAnimation = CABasicAnimation(keyPath: UX.LaunchScreen.Logo.animationKeyPath)
rotationAnimation.fromValue = 0.0
rotationAnimation.toValue = UX.LaunchScreen.Logo.rotationAngle
rotationAnimation.duration = UX.LaunchScreen.Logo.rotationDuration
rotationAnimation.repeatCount = HUGE
rotationAnimation.isCumulative = true

imageView.layer.add(rotationAnimation, forKey: UX.LaunchScreen.Logo.animationKey)
}
}

This file was deleted.

8 changes: 0 additions & 8 deletions firefox-ios/Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,6 @@
8CE1E43A2B8C76C80026530B /* LoginListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CE1E4362B8C76C80026530B /* LoginListView.swift */; };
8CEDF07E2BFE04B100D2617B /* AddressListViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CEDF07D2BFE04B100D2617B /* AddressListViewModelTests.swift */; };
8CF40B482DFC22C200DCB7F0 /* OnboardingServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CF40B472DFC22C200DCB7F0 /* OnboardingServiceTests.swift */; };
8CFA38232E607B9900BF9113 /* ModernLaunchTransitionAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CFA38222E607B9900BF9113 /* ModernLaunchTransitionAnimator.swift */; };
8CFA38252E607F8B00BF9113 /* ModernLaunchTransitionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CFA38242E607F8B00BF9113 /* ModernLaunchTransitionDelegate.swift */; };
8D8251811F4DE67F00780643 /* AdvancedAccountSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D8251721F4DE67E00780643 /* AdvancedAccountSettingViewController.swift */; };
94AEF1552D690043003E2623 /* DownloadLiveActivityTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94AEF1542D690040003E2623 /* DownloadLiveActivityTest.swift */; };
94D3DD162D545B6A00D368B8 /* DownloadLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94D3DD152D545B6A00D368B8 /* DownloadLiveActivity.swift */; };
Expand Down Expand Up @@ -9211,8 +9209,6 @@
8CEDF07D2BFE04B100D2617B /* AddressListViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressListViewModelTests.swift; sourceTree = "<group>"; };
8CEDF07F2BFE138B00D2617B /* AutofillProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillProvider.swift; sourceTree = "<group>"; };
8CF40B472DFC22C200DCB7F0 /* OnboardingServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingServiceTests.swift; sourceTree = "<group>"; };
8CFA38222E607B9900BF9113 /* ModernLaunchTransitionAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModernLaunchTransitionAnimator.swift; sourceTree = "<group>"; };
8CFA38242E607F8B00BF9113 /* ModernLaunchTransitionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModernLaunchTransitionDelegate.swift; sourceTree = "<group>"; };
8D1340A4B7E4ACBF43347178 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/LoginManager.strings; sourceTree = "<group>"; };
8D194DCF9E244D29DA68FDE5 /* az */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = az; path = az.lproj/Shared.strings; sourceTree = "<group>"; };
8D1D42808537A1B29FEE3BF4 /* ast */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ast; path = ast.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -14007,8 +14003,6 @@
8A69047F2B97BBAE00E30047 /* SplashScreenAnimation.swift */,
8A832A9329DC99BA0025D5DD /* LaunchScreenViewController.swift */,
8C1588602E5F5D1800EDDC9C /* ModernLaunchScreenViewController.swift */,
8CFA38242E607F8B00BF9113 /* ModernLaunchTransitionDelegate.swift */,
8CFA38222E607B9900BF9113 /* ModernLaunchTransitionAnimator.swift */,
8A832A9129DC99790025D5DD /* LaunchScreenViewModel.swift */,
);
path = LaunchView;
Expand Down Expand Up @@ -18514,7 +18508,6 @@
FA9293D41D6580E100AC8D33 /* QRCodeViewController.swift in Sources */,
8AAEBA082BF52708000C02B5 /* MicrosurveyCoordinator.swift in Sources */,
5A679E4B2B239FAE004F2B0D /* TabPeekViewController.swift in Sources */,
8CFA38232E607B9900BF9113 /* ModernLaunchTransitionAnimator.swift in Sources */,
E18CE8DC2BDA3FA600EE2BCD /* NavigationToolbarContainerModel.swift in Sources */,
2178A6A0291454B5002EC290 /* ReaderModeThemeButton.swift in Sources */,
39F4C10A2045DB2E00746155 /* FocusHelper.swift in Sources */,
Expand Down Expand Up @@ -18871,7 +18864,6 @@
AB3DB0C92B596739001D32CB /* AppStartupTelemetry.swift in Sources */,
D8AA923421A602DC002605C0 /* HomePageSettingViewController.swift in Sources */,
8A161411282C035D00DDBB02 /* CustomizeHomepageSectionViewModel.swift in Sources */,
8CFA38252E607F8B00BF9113 /* ModernLaunchTransitionDelegate.swift in Sources */,
8A454D2C2CB81153009436D9 /* MerinoStandardCell.swift in Sources */,
AB9CBC042C53B64C00102610 /* TrackingProtectionModel.swift in Sources */,
C8DC90C52A066B6A0008832B /* MarkupTokenizingUtility.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ final class LaunchCoordinator: BaseCoordinator,
private let isIphone: Bool
let windowUUID: WindowUUID
let themeManager: ThemeManager = AppContainer.shared.resolve()
private let modernTransitionDelegate = ModernLaunchTransitionDelegate()
weak var parentCoordinator: LaunchCoordinatorDelegate?

init(router: Router,
Expand Down Expand Up @@ -179,7 +178,6 @@ final class LaunchCoordinator: BaseCoordinator,
let viewController = PortraitOnlyHostingController(rootView: view)
viewController.modalPresentationStyle = .fullScreen
viewController.modalTransitionStyle = .crossDissolve
viewController.transitioningDelegate = modernTransitionDelegate

router.present(viewController, animated: true)
}
Expand Down Expand Up @@ -302,7 +300,6 @@ final class LaunchCoordinator: BaseCoordinator,
let hostingController = PortraitOnlyHostingController(rootView: view)
hostingController.modalPresentationStyle = .fullScreen
hostingController.modalTransitionStyle = .crossDissolve
hostingController.transitioningDelegate = modernTransitionDelegate

router.present(hostingController, animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ModernLaunchScreenViewController: UIViewController, LaunchFinishedLoadingD
static let fadeOutDelay: TimeInterval = 0
static let fadeOutAlpha: CGFloat = 0.0
static let minimumDisplayTimeSeconds: TimeInterval = 0.1
static let logoSize: CGFloat = 125.0
}

private weak var coordinator: LaunchFinishedLoadingDelegate?
Expand All @@ -34,12 +35,13 @@ class ModernLaunchScreenViewController: UIViewController, LaunchFinishedLoadingD
private var shouldLoadNextLaunchType = false

// MARK: - UI Components
private lazy var modernLaunchView: ModernLaunchScreenView = {
return ModernLaunchScreenView(windowUUID: windowUUID, themeManager: themeManager)
}()

private lazy var hostingController: UIHostingController<ModernLaunchScreenView> = {
let controller = UIHostingController(rootView: modernLaunchView)
private let loaderView: LaunchScreenLoaderView = .build {
$0.isAccessibilityElement = false
}
private lazy var backgroundViewController: UIHostingController<LaunchScreenBackgroundView> = {
let controller = UIHostingController(
rootView: LaunchScreenBackgroundView(windowUUID: windowUUID, themeManager: themeManager)
)
controller.view.backgroundColor = .clear
return controller
}()
Expand Down Expand Up @@ -81,6 +83,7 @@ class ModernLaunchScreenViewController: UIViewController, LaunchFinishedLoadingD

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loaderView.startAnimating()
// TODO: FXIOS-13434 Refactor the `LaunchScreenViewModel` to enhance the logic
// making it easier to comprehend and facilitating unit testing.
// Only load next launch type if loading is complete, otherwise defer it
Expand All @@ -93,11 +96,6 @@ class ModernLaunchScreenViewController: UIViewController, LaunchFinishedLoadingD
}
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
startLoaderAnimation()
}

// MARK: - Loading
func startLoading() {
isLoading = true
Expand All @@ -106,36 +104,30 @@ class ModernLaunchScreenViewController: UIViewController, LaunchFinishedLoadingD

// MARK: - Setup
private func setupLayout() {
addChild(hostingController)
view.addSubview(hostingController.view)
hostingController.didMove(toParent: self)
addChild(backgroundViewController)
view.addSubviews(backgroundViewController.view, loaderView)
backgroundViewController.didMove(toParent: self)

hostingController.view.translatesAutoresizingMaskIntoConstraints = false
backgroundViewController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
backgroundViewController.view.topAnchor.constraint(equalTo: view.topAnchor),
backgroundViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
backgroundViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
backgroundViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),

loaderView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
loaderView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
loaderView.heightAnchor.constraint(lessThanOrEqualToConstant: UX.logoSize),
loaderView.widthAnchor.constraint(lessThanOrEqualToConstant: UX.logoSize)
])
}

// MARK: - Animation Control
func startLoaderAnimation() {
modernLaunchView.startAnimation()
}

func stopLoaderAnimation() {
modernLaunchView.stopAnimation()
}

// MARK: - LaunchFinishedLoadingDelegate
func launchWith(launchType: LaunchType) {
stopLoaderAnimation()
coordinator?.launchWith(launchType: launchType)
}

func launchBrowser() {
stopLoaderAnimation()
coordinator?.launchBrowser()
}

Expand Down
Loading