cleaning things up nad adding their turn your turn first iteration...improve later
This commit is contained in:
@@ -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 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) {
|
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
|
continue
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ struct CircleFooterView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// meta data of convo
|
// meta data of convo
|
||||||
VStack (alignment: .leading) {
|
VStack (alignment: .leading) {
|
||||||
if self.selectedFriend != nil {
|
if self.selectedFriend != nil {
|
||||||
@@ -46,6 +45,16 @@ struct CircleFooterView: View {
|
|||||||
.foregroundColor(NirvanaColor.light)
|
.foregroundColor(NirvanaColor.light)
|
||||||
}
|
}
|
||||||
if !self.convoRelativeTime.isEmpty && self.myTurn != nil {
|
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)
|
Text(self.convoRelativeTime)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
|
|||||||
@@ -73,19 +73,22 @@ struct CircleGridView: View {
|
|||||||
let scale = getScale(proxy: gridProxy, itemNumber: value, userId: friendId)
|
let scale = getScale(proxy: gridProxy, itemNumber: value, userId: friendId)
|
||||||
|
|
||||||
ZStack(alignment: .topTrailing) {
|
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()
|
Circle()
|
||||||
.foregroundColor(self.getBubbleTint(friendIndex: value, friendDbId: friendId)) // different color for a selected user
|
.foregroundColor(self.getBubbleTint(friendIndex: value, friendDbId: friendId)) // different color for a selected user
|
||||||
.blur(radius: 8)
|
.blur(radius: 8)
|
||||||
.cornerRadius(100)
|
.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])
|
Image(self.authSessionStore.relevantUsersDict[friendId]?.avatar ?? Avatars.avatarSystemNames[0])
|
||||||
.resizable()
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
@@ -158,13 +161,13 @@ struct CircleGridView: View {
|
|||||||
|
|
||||||
ZStack(alignment: .topTrailing) {
|
ZStack(alignment: .topTrailing) {
|
||||||
Image(systemName: "arrow.down.left.circle.fill")
|
Image(systemName: "arrow.down.left.circle.fill")
|
||||||
.foregroundColor(NirvanaColor.dimTeal)
|
.foregroundColor(Color.orange)
|
||||||
.font(.title)
|
.font(.title)
|
||||||
|
|
||||||
Text("\(activeFriends.count)")
|
Text("\(activeFriends.count)")
|
||||||
|
|
||||||
Circle()
|
Circle()
|
||||||
.foregroundColor(NirvanaColor.dimTeal.opacity(0.3)) // different color for a selected user
|
.foregroundColor(Color.orange.opacity(0.4))
|
||||||
.blur(radius: 5)
|
.blur(radius: 5)
|
||||||
.cornerRadius(100)
|
.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(.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
|
.padding(.top, Self.size / 2 + Self.spacingBetweenRows / 2) // because we are going under the nav bar
|
||||||
}// scrollview
|
}// scrollview
|
||||||
|
.onAppear {
|
||||||
|
// scrolling to first person in grid
|
||||||
|
if self.authSessionStore.friendsArr.count > 0 {
|
||||||
|
scrollReaderValue.scrollTo(self.selectedFriendIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
} // scrollview reader
|
} // 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 {
|
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
|
if (friendDbId == self.selectedFriendIndex) { // user clicked on this user
|
||||||
return NirvanaColor.dimTeal.opacity(0.4)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user