From 71433155e5379cbc02d7250d3d91d2eec0e42859 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Thu, 24 Aug 2023 11:49:05 +1000 Subject: [PATCH] wip: fake chat bubbles animation --- Session/Onboarding/LandingView.swift | 21 ++++++++++++++++++++- Session/Onboarding/LoadAccountView.swift | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Session/Onboarding/LandingView.swift b/Session/Onboarding/LandingView.swift index 0bf52a5b7..178e49667 100644 --- a/Session/Onboarding/LandingView.swift +++ b/Session/Onboarding/LandingView.swift @@ -9,6 +9,8 @@ import SessionUtilitiesKit struct LandingView: View { @EnvironmentObject var host: HostWrapper + @State var numberOfBubblesShown: Int = 0 + var body: some View { NavigationView { ZStack(alignment: .center) { @@ -30,7 +32,17 @@ struct LandingView: View { .foregroundColor(themeColor: .textPrimary) .padding(.vertical, Values.mediumSpacing) - FakeChat() + FakeChat($numberOfBubblesShown) + .onAppear { + Timer.scheduledTimerOnMainThread(withTimeInterval: 1.5, repeats: true) { timer in + withAnimation(.spring().speed(0.68)) { + numberOfBubblesShown += 1 + if numberOfBubblesShown >= 4 { + timer.invalidate() + } + } + } + } Spacer() } @@ -170,6 +182,8 @@ struct ChatBubble: View { } struct FakeChat: View { + @Binding var numberOfBubblesShown: Int + let chatBubbles: [ChatBubble] = [ ChatBubble(text: "onboarding_chat_bubble_1".localized(), outgoing: false), ChatBubble(text: "onboarding_chat_bubble_2".localized(), outgoing: true), @@ -177,6 +191,10 @@ struct FakeChat: View { ChatBubble(text: "onboarding_chat_bubble_4".localized(), outgoing: true), ] + init(_ numberOfBubblesShown: Binding) { + self._numberOfBubblesShown = numberOfBubblesShown + } + var body: some View { VStack( alignment: .leading, @@ -192,6 +210,7 @@ struct FakeChat: View { maxWidth: .infinity, alignment: chatBubble.outgoing ? .trailing : .leading ) + .opacity(index < numberOfBubblesShown ? 1.0 : 0.0) } } .padding(.horizontal, 36) diff --git a/Session/Onboarding/LoadAccountView.swift b/Session/Onboarding/LoadAccountView.swift index 0b1b516fe..858a8e4ce 100644 --- a/Session/Onboarding/LoadAccountView.swift +++ b/Session/Onboarding/LoadAccountView.swift @@ -41,6 +41,10 @@ struct LoadAccountView: View { } } + func continueWithQRCode() { + + } + func continueWithMnemonic() { let mnemonic = recoveryPassword.lowercased() let hexEncodedSeed: String