wip: fake chat bubbles animation

pull/891/head
Ryan Zhao 2 years ago
parent c7c5969e6f
commit 71433155e5

@ -9,6 +9,8 @@ import SessionUtilitiesKit
struct LandingView: View { struct LandingView: View {
@EnvironmentObject var host: HostWrapper @EnvironmentObject var host: HostWrapper
@State var numberOfBubblesShown: Int = 0
var body: some View { var body: some View {
NavigationView { NavigationView {
ZStack(alignment: .center) { ZStack(alignment: .center) {
@ -30,7 +32,17 @@ struct LandingView: View {
.foregroundColor(themeColor: .textPrimary) .foregroundColor(themeColor: .textPrimary)
.padding(.vertical, Values.mediumSpacing) .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() Spacer()
} }
@ -170,6 +182,8 @@ struct ChatBubble: View {
} }
struct FakeChat: View { struct FakeChat: View {
@Binding var numberOfBubblesShown: Int
let chatBubbles: [ChatBubble] = [ let chatBubbles: [ChatBubble] = [
ChatBubble(text: "onboarding_chat_bubble_1".localized(), outgoing: false), ChatBubble(text: "onboarding_chat_bubble_1".localized(), outgoing: false),
ChatBubble(text: "onboarding_chat_bubble_2".localized(), outgoing: true), 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), ChatBubble(text: "onboarding_chat_bubble_4".localized(), outgoing: true),
] ]
init(_ numberOfBubblesShown: Binding<Int>) {
self._numberOfBubblesShown = numberOfBubblesShown
}
var body: some View { var body: some View {
VStack( VStack(
alignment: .leading, alignment: .leading,
@ -192,6 +210,7 @@ struct FakeChat: View {
maxWidth: .infinity, maxWidth: .infinity,
alignment: chatBubble.outgoing ? .trailing : .leading alignment: chatBubble.outgoing ? .trailing : .leading
) )
.opacity(index < numberOfBubblesShown ? 1.0 : 0.0)
} }
} }
.padding(.horizontal, 36) .padding(.horizontal, 36)

@ -41,6 +41,10 @@ struct LoadAccountView: View {
} }
} }
func continueWithQRCode() {
}
func continueWithMnemonic() { func continueWithMnemonic() {
let mnemonic = recoveryPassword.lowercased() let mnemonic = recoveryPassword.lowercased()
let hexEncodedSeed: String let hexEncodedSeed: String

Loading…
Cancel
Save