cleaning things up nad adding their turn your turn first iteration...improve later

This commit is contained in:
talksik
2021-12-25 03:46:14 -08:00
parent 225048152d
commit 6ad872d793
3 changed files with 37 additions and 23 deletions
+1 -1
View File
@@ -309,7 +309,7 @@ extension AuthSessionStore {
// if this user is not already a friend, active or inactive/rejected, then get their user data and add to inbox
if self.userFriendsDict.keys.contains(userFriend!.userId) {
print("already have this user in my circle or I rejected them \(userFriend?.friendId)")
print("already have this user in my circle or I rejected them \(userFriend?.userId)")
continue
}
else {
@@ -37,7 +37,6 @@ struct CircleFooterView: View {
}
// meta data of convo
VStack (alignment: .leading) {
if self.selectedFriend != nil {
@@ -46,6 +45,16 @@ struct CircleFooterView: View {
.foregroundColor(NirvanaColor.light)
}
if !self.convoRelativeTime.isEmpty && self.myTurn != nil {
if self.myTurn! {
Label("your turn", systemImage: "wave.3.right.circle.fill")
.foregroundColor(Color.orange)
.font(.caption)
} else {
Label("their turn", systemImage: "wave.3.right.circle.fill")
.foregroundColor(NirvanaColor.dimTeal)
.font(.caption)
}
Text(self.convoRelativeTime)
.font(.caption)
.foregroundColor(.gray)
@@ -73,19 +73,22 @@ struct CircleGridView: View {
let scale = getScale(proxy: gridProxy, itemNumber: value, userId: friendId)
ZStack(alignment: .topTrailing) {
// check if the last message in the conversation between me and my friend was me talking or him
// also check if I have listened to it once or twice
if self.haveNewMessageFromFriend(friendDbId: friendId) { // him talking
Image(systemName: "wave.3.right.circle.fill")
.foregroundColor(Color.orange)
.font(.title)
}
Circle()
.foregroundColor(self.getBubbleTint(friendIndex: value, friendDbId: friendId)) // different color for a selected user
.blur(radius: 8)
.cornerRadius(100)
// check if the last message in the conversation between me and my friend was me talking or him
if self.haveNewMessageFromFriend(friendDbId: friendId) { // him talking
Image(systemName: "wave.3.right.circle.fill")
.foregroundColor(Color.orange)
.font(.title2)
} else {
Image(systemName: "wave.3.right.circle.fill")
.foregroundColor(NirvanaColor.dimTeal)
.font(.title2)
}
//
Image(self.authSessionStore.relevantUsersDict[friendId]?.avatar ?? Avatars.avatarSystemNames[0])
.resizable()
.scaledToFit()
@@ -158,13 +161,13 @@ struct CircleGridView: View {
ZStack(alignment: .topTrailing) {
Image(systemName: "arrow.down.left.circle.fill")
.foregroundColor(NirvanaColor.dimTeal)
.foregroundColor(Color.orange)
.font(.title)
Text("\(activeFriends.count)")
Circle()
.foregroundColor(NirvanaColor.dimTeal.opacity(0.3)) // different color for a selected user
.foregroundColor(Color.orange.opacity(0.4))
.blur(radius: 5)
.cornerRadius(100)
@@ -248,13 +251,13 @@ struct CircleGridView: View {
.padding(.trailing, Self.size / 2 + Self.spacingBetweenColumns / 2) // because of the offset of last column
.padding(.top, Self.size / 2 + Self.spacingBetweenRows / 2) // because we are going under the nav bar
}// scrollview
.onAppear {
// scrolling to first person in grid
if self.authSessionStore.friendsArr.count > 0 {
scrollReaderValue.scrollTo(self.selectedFriendIndex)
}
}
} // scrollview reader
.onAppear {
//TODO: was causing problems so commenting out
//may not need anymore with bottom nav activation
// scrollReaderValue.scrollTo(Self.numberOfItems / 2)
}
}
@@ -273,14 +276,16 @@ struct CircleGridView: View {
}
private func getBubbleTint(friendIndex: Int, friendDbId: String) -> Color {
// TODO: check if I listened to the message before or not
if self.haveNewMessageFromFriend(friendDbId: friendDbId) { // this friend has a message for me
return Color.orange.opacity(0.8)
}
if (friendDbId == self.selectedFriendIndex) { // user clicked on this user
return NirvanaColor.dimTeal.opacity(0.4)
}
else if self.haveNewMessageFromFriend(friendDbId: friendDbId) { // this user has a message
return Color.orange.opacity(0.8)
}
return Color.white.opacity(0.4)
return NirvanaColor.dimTeal.opacity(0.2)
}
}