From fa3b11048d66fa6d31ceb9d2a17728834da0b6e9 Mon Sep 17 00:00:00 2001 From: talksik Date: Sun, 2 Jan 2022 18:27:33 -0800 Subject: [PATCH] showing audio waves while recording and stuff --- .../InnerCircle/CircleNavigationView.swift | 82 +++++++++++++------ .../Views/InnerCircle/InnerCircleView.swift | 2 +- .../InnerCircle/InnerCircleViewModel.swift | 12 ++- 3 files changed, 68 insertions(+), 28 deletions(-) diff --git a/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift b/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift index 381a80e..615d9d3 100644 --- a/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift +++ b/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift @@ -13,10 +13,6 @@ struct CircleNavigationView: View { @EnvironmentObject var navigationStack: NavigationStack @EnvironmentObject var authSessionStore: AuthSessionStore - @Binding var alertActive: Bool - @Binding var alertText: String - @Binding var alertSubtext: String - var body: some View { HStack(alignment: .center) { Menu { @@ -94,17 +90,45 @@ struct CircleNavigationView: View { } } } else { - Image((self.authSessionStore.user?.avatar)!) - .resizable() - .scaledToFit() - .background(self.innerCircleVM.isRecording ? Color.orange : Color.teal.opacity(0.5)) - .frame(width: 40, height: 40) - .clipShape(Circle()) - .shadow(radius: 10) - .overlay(alignment: .topTrailing) { - // user status - UserStatusView(status: self.authSessionStore.user?.userStatus, size: 10) - } + ZStack { + // more animations on recording + Circle() + .foregroundColor(Color.orange.opacity(0.3)) + .frame(width: 39, height: 39) + .scaleEffect(self.innerCircleVM.isRecording ? 1.3: 1) + .animation(self.innerCircleVM.isRecording ? Animation.easeIn(duration: 2).repeatForever(autoreverses: true) : .default, value: self.innerCircleVM.isRecording) + Circle() + .foregroundColor(Color.orange.opacity(0.5)) + .frame(width: 39, height: 39) + .scaleEffect(self.innerCircleVM.isRecording ? 1.2: 1) + .animation(self.innerCircleVM.isRecording ? Animation.easeOut(duration: 2).repeatForever(autoreverses: true) : .default, value: self.innerCircleVM.isRecording) + Circle() + .foregroundColor(Color.orange) + .frame(width: 40, height: 40) + .scaleEffect(self.innerCircleVM.isRecording ? 1.1: 1) + .animation(self.innerCircleVM.isRecording ? Animation.easeInOut.repeatForever(autoreverses: false) : .default, value: self.innerCircleVM.isRecording) + + Image((self.authSessionStore.user?.avatar)!) + .resizable() + .scaledToFit() + .background(Color.teal.opacity(0.5)) + .frame(width: 40, height: 40) + .clipShape(Circle()) + .shadow(radius: 10) + .overlay(alignment: .topTrailing) { + // user status + UserStatusView(status: self.authSessionStore.user?.userStatus, size: 10) + .scaleEffect(self.innerCircleVM.isRecording ? 0: 1) + + // animation on recording + Image(systemName: "waveform.circle.fill") + .scaleEffect(self.innerCircleVM.isRecording ? 1: 0) + .frame(width: 10) + .foregroundColor(Color.orange) + .animation(.spring()) + } + } + } } @@ -129,11 +153,7 @@ struct CircleNavigationView: View { Button { - self.alertActive.toggle() - - self.alertText = "❄️ Coming Soon!" - - self.alertSubtext = "Stay posted for buttery smooth convos with groups! We will be limiting you to 3 circles!" + self.innerCircleVM.toast = .circlesPreview } label: { Label("circles", systemImage: "circle.hexagongrid") .font(.caption2) @@ -147,11 +167,7 @@ struct CircleNavigationView: View { } Button { - self.alertActive.toggle() - - self.alertText = "💼 Coming Soon!" - - self.alertSubtext = "Efficient and more authentic communication for teams! Contact us for more info." + self.innerCircleVM.toast = .remoteWorkPreview } label: { Label("work", systemImage: "suitcase") @@ -164,6 +180,22 @@ struct CircleNavigationView: View { .strokeBorder(Color.white.opacity(1), lineWidth: 1) ) } + + Button { + self.innerCircleVM.toast = .moreSpacesPreview + + } label: { + Label("more spaces", systemImage: "plus") + .labelStyle(.iconOnly) + .font(.caption2) + .foregroundColor(Color.gray) + .padding(.vertical, 10) + .padding(.horizontal, 8) + .overlay( + RoundedRectangle(cornerRadius: 20, style: .continuous) + .strokeBorder(Color.white.opacity(1), lineWidth: 1) + ) + } } } } diff --git a/nirvana-ios/Views/InnerCircle/InnerCircleView.swift b/nirvana-ios/Views/InnerCircle/InnerCircleView.swift index 3cc4a0a..6b91d0d 100644 --- a/nirvana-ios/Views/InnerCircle/InnerCircleView.swift +++ b/nirvana-ios/Views/InnerCircle/InnerCircleView.swift @@ -96,7 +96,7 @@ struct InnerCircleView: View { ZStack(alignment: .topLeading) { Color.clear - CircleNavigationView(alertActive: self.$alertActive, alertText: self.$alertText, alertSubtext: self.$alertSubtext).environmentObject(innerCircleVM) + CircleNavigationView().environmentObject(innerCircleVM) } CircleFooterView(selectedFriendIndex: self.$selectedFriendIndex) diff --git a/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift b/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift index 47ee3a1..1c766f5 100644 --- a/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift +++ b/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift @@ -31,11 +31,21 @@ class InnerCircleViewModel: ObservableObject { case addedFriend case removedFriend + case circlesPreview + case remoteWorkPreview + case moreSpacesPreview + case generalError var view: AlertToast { switch self { + case .moreSpacesPreview: + return AlertToast(displayMode: .hud, type: .systemImage("command.circle", NirvanaColor.dimTeal), title: "coming soon", subTitle: "more spaces") + case .remoteWorkPreview: + return AlertToast(displayMode: .hud, type: .systemImage("suitcase.fill", NirvanaColor.dimTeal), title: "coming soon", subTitle: "remote work productivity at it's best") + case .circlesPreview: + return AlertToast(displayMode: .hud, type: .systemImage("snowflake", NirvanaColor.dimTeal), title: "coming soon", subTitle: "group convos reinvented") case .removedFriend: return AlertToast(displayMode: .alert, type: .complete(Color.green), title: "Done", subTitle: "removed friend") case .addedFriend: @@ -107,8 +117,6 @@ extension InnerCircleViewModel { audioRecorder.record() isRecording = true - self.toast = .startedClip - self.audioLocalUrl = filePath // setting this for later use when recording is stopped } catch {