adding overlay to user icon but still need to view for other users

This commit is contained in:
talksik
2021-12-28 15:55:13 -08:00
parent fa0024eafa
commit df801a4433
3 changed files with 30 additions and 6 deletions
@@ -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()
}
}
}
}
@@ -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)
@@ -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)
}