From 949307492662af745229d58157bb9553a036ad69 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 9 Dec 2019 11:50:45 +1100 Subject: [PATCH] Fix fake chat view glitch --- Signal/src/Loki/Redesign/Components/FakeChatView.swift | 5 +++++ .../src/Loki/Redesign/View Controllers/LandingVC.swift | 10 ++++++++++ .../Registration/OnboardingController.swift | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Signal/src/Loki/Redesign/Components/FakeChatView.swift b/Signal/src/Loki/Redesign/Components/FakeChatView.swift index 95c4cf727..59eac33e3 100644 --- a/Signal/src/Loki/Redesign/Components/FakeChatView.swift +++ b/Signal/src/Loki/Redesign/Components/FakeChatView.swift @@ -2,6 +2,11 @@ final class FakeChatView : UIView { private let spacing = Values.mediumSpacing + var contentOffset: CGPoint { + get { return scrollView.contentOffset } + set { scrollView.contentOffset = newValue } + } + private lazy var chatBubbles = [ getChatBubble(withText: NSLocalizedString("What is Loki Messenger? A completely decentralised private messaging application for all platforms.", comment: ""), wasSentByCurrentUser: true), getChatBubble(withText: NSLocalizedString("So no metadata collection, or personally identifiable information? How does it work?", comment: ""), wasSentByCurrentUser: false), diff --git a/Signal/src/Loki/Redesign/View Controllers/LandingVC.swift b/Signal/src/Loki/Redesign/View Controllers/LandingVC.swift index 0f0b25b12..5b22ae9ab 100644 --- a/Signal/src/Loki/Redesign/View Controllers/LandingVC.swift +++ b/Signal/src/Loki/Redesign/View Controllers/LandingVC.swift @@ -1,5 +1,6 @@ final class LandingVC : UIViewController { + private var fakeChatViewContentOffset: CGPoint! // MARK: Components private lazy var fakeChatView: FakeChatView = { @@ -77,8 +78,17 @@ final class LandingVC : UIViewController { topSpacer.heightAnchor.constraint(equalTo: bottomSpacer.heightAnchor, multiplier: 1).isActive = true } + override func viewDidDisappear(_ animated: Bool) { + super.viewDidAppear(animated) + fakeChatView.contentOffset = fakeChatViewContentOffset + } + // MARK: Interaction @objc private func register() { + fakeChatViewContentOffset = fakeChatView.contentOffset + DispatchQueue.main.async { + self.fakeChatView.contentOffset = self.fakeChatViewContentOffset + } let publicKeyVC = PublicKeyVC() navigationController!.pushViewController(publicKeyVC, animated: true) } diff --git a/Signal/src/ViewControllers/Registration/OnboardingController.swift b/Signal/src/ViewControllers/Registration/OnboardingController.swift index 6180c7342..bee26af63 100644 --- a/Signal/src/ViewControllers/Registration/OnboardingController.swift +++ b/Signal/src/ViewControllers/Registration/OnboardingController.swift @@ -122,9 +122,9 @@ public class OnboardingController: NSObject { } public func pushDisplayNameVC(from viewController: UIViewController) { - AssertIsOnMainThread() - let displayNameVC = DisplayNameVC(onboardingController: self) - viewController.navigationController?.pushViewController(displayNameVC, animated: true) +// AssertIsOnMainThread() +// let displayNameVC = DisplayNameVC(onboardingController: self) +// viewController.navigationController?.pushViewController(displayNameVC, animated: true) } public func onboardingRegistrationSucceeded(viewController: UIViewController) {