From df801a443364574ba65000abd7eab16973e482e7 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 28 Dec 2021 15:55:13 -0800 Subject: [PATCH] adding overlay to user icon but still need to view for other users --- .../InnerCircle/CircleNavigationView.swift | 29 +++++++++++++++++-- .../Views/InnerCircle/InnerCircleView.swift | 5 ++-- nirvana-ios/Views/Router/RouterView.swift | 2 ++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift b/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift index 4f341a3..5ef51aa 100644 --- a/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift +++ b/nirvana-ios/Views/InnerCircle/CircleNavigationView.swift @@ -65,7 +65,6 @@ struct CircleNavigationView: View { Label("log out", systemImage: "rectangle.portrait.and.arrow.right") .foregroundColor(NirvanaColor.teal) } - } label: { if self.authSessionStore.user?.avatar == nil { Image("Artboards_Diversity_Avatars_by_Netguru-1") @@ -75,7 +74,19 @@ struct CircleNavigationView: View { .blur(radius: 5) .frame(width: 40, height: 40) .clipShape(Circle()) - .padding(5) + .overlay(alignment: .bottomTrailing) { + // user status + switch self.authSessionStore.user?.userStatus { + case .online: + Circle() + .frame(width: 10, height: 10) + .foregroundColor(Color.green) + case .offline: + Circle() + default: + Circle() + } + } } else { Image((self.authSessionStore.user?.avatar)!) .resizable() @@ -83,8 +94,20 @@ struct CircleNavigationView: View { .background(self.innerCircleVM.isRecording ? Color.orange : NirvanaColor.teal.opacity(0.5)) .frame(width: 40, height: 40) .clipShape(Circle()) - .padding(5) .shadow(radius: 10) + .overlay(alignment: .bottomTrailing) { + // user status + switch self.authSessionStore.user?.userStatus { + case .online: + Circle() + .frame(width: 10, height: 10) + .foregroundColor(Color.green) + case .offline: + Circle() + default: + Circle() + } + } } } diff --git a/nirvana-ios/Views/InnerCircle/InnerCircleView.swift b/nirvana-ios/Views/InnerCircle/InnerCircleView.swift index 539fd1e..63b5fc0 100644 --- a/nirvana-ios/Views/InnerCircle/InnerCircleView.swift +++ b/nirvana-ios/Views/InnerCircle/InnerCircleView.swift @@ -92,11 +92,10 @@ struct InnerCircleView: View { } // header - VStack(alignment: .leading) { + ZStack(alignment: .topLeading) { + Color.clear CircleNavigationView(alertActive: self.$alertActive, alertText: self.$alertText, alertSubtext: self.$alertSubtext).environmentObject(innerCircleVM) - - Spacer() } CircleFooterView(selectedFriendIndex: self.$selectedFriendIndex).environmentObject(innerCircleVM) diff --git a/nirvana-ios/Views/Router/RouterView.swift b/nirvana-ios/Views/Router/RouterView.swift index 67e8d48..6c25859 100644 --- a/nirvana-ios/Views/Router/RouterView.swift +++ b/nirvana-ios/Views/Router/RouterView.swift @@ -42,6 +42,8 @@ struct RouterView: View { // set firestore user document isOnline to true self.authSessionStore.updateUserStatus(userStatus: .online) } else if newPhase == .background { + // TODO: find a way to do this in the background so that people can call me and start talking even if it's in the background + // but this may just not be possible, only with an actual call so to speak print("app is in backgroun") self.authSessionStore.updateUserStatus(userStatus: .background) }