nice color background based on isrecording or not

This commit is contained in:
talksik
2021-12-22 18:01:06 -08:00
parent 33a4241780
commit f21faa38d5
4 changed files with 10 additions and 5 deletions
@@ -9,6 +9,7 @@ import SwiftUI
import NavigationStack
struct CircleNavigationView: View {
@EnvironmentObject var innerCircleVM: InnerCircleViewModel
@EnvironmentObject var navigationStack: NavigationStack
@EnvironmentObject var authSessionStore: AuthSessionStore
@@ -83,7 +84,7 @@ struct CircleNavigationView: View {
Image((self.authSessionStore.user?.avatar)!)
.resizable()
.scaledToFit()
.background(NirvanaColor.teal.opacity(0.5))
.background(self.innerCircleVM.isRecording ? Color.orange : NirvanaColor.teal.opacity(0.5))
.frame(width: 40, height: 40)
.clipShape(Circle())
.padding(5)
@@ -28,7 +28,7 @@ struct InnerCircleView: View {
var body: some View {
ZStack {
// background
WavesGlassBackgroundView()
WavesGlassBackgroundView(isRecording: self.innerCircleVM.isRecording)
// content
CircleGridView(selectedFriendIndex: self.$selectedFriendIndex)
@@ -37,7 +37,7 @@ struct InnerCircleView: View {
// header
VStack(alignment: .leading) {
CircleNavigationView(sheetView: self.$sheetView)
CircleNavigationView(sheetView: self.$sheetView).environmentObject(innerCircleVM)
Spacer()
}
@@ -69,7 +69,7 @@ class InnerCircleViewModel: ObservableObject {
}
let newMessage = Message(sendId: senderId, receivId: receiverId, audioDUrl: audioDataUrl!.absoluteString)
print(newMessage)
// create a new message in firestore with the url for receiving user to automatically get notified
self?.firestoreService.createMessage(message: newMessage) {[weak self] res in
print(res)
@@ -11,14 +11,18 @@ struct WavesGlassBackgroundView: View {
let universalSize = UIScreen.main.bounds
// y position of where waves should start
let baseLineY = UIScreen.main.bounds.height * 0.95
var isRecording: Bool = false
@State var animateWaves = false
var body: some View {
let recordingColors = [NirvanaColor.solidBlue, NirvanaColor.dimTeal, Color.orange.opacity(0.8), NirvanaColor.teal.opacity(0.7), NirvanaColor.teal.opacity(0.7), NirvanaColor.solidTeal.opacity(0.7), NirvanaColor.solidBlue]
let normalColors = [NirvanaColor.solidBlue, NirvanaColor.dimTeal, Color.orange.opacity(0.4), NirvanaColor.teal.opacity(0.5), NirvanaColor.teal.opacity(0.3), NirvanaColor.solidTeal.opacity(0.3), NirvanaColor.solidBlue]
ZStack {
AngularGradient(
gradient: Gradient(
colors: [NirvanaColor.solidBlue, NirvanaColor.dimTeal, Color.orange.opacity(0.4), NirvanaColor.teal.opacity(0.5), NirvanaColor.teal.opacity(0.3), NirvanaColor.solidTeal.opacity(0.3), NirvanaColor.solidBlue]),
colors: self.isRecording ? recordingColors : normalColors),
center: .bottom,
angle: .degrees(120))