fixing issue of updating inbox users and the grid changing problem but need to still fix overall problem of ordering people consistently based on friend creation date

This commit is contained in:
talksik
2021-12-25 00:56:20 -08:00
parent 05068043d9
commit fb56c79fe8
3 changed files with 10 additions and 10 deletions
@@ -373,6 +373,10 @@ extension AuthSessionStore {
}
}
// listener for people who have me as an active friend might make inbox easier
// where friendId = me, isActive = true...this way it's a published property that can update the ui
// as inbox users is only being called on load
self.listenersActive = true
// adding listeners to be able to deinit later
@@ -398,6 +402,8 @@ extension AuthSessionStore {
// transforming data to make it more valuable
extension AuthSessionStore {
func getActiveFriendIds() -> [String] {
// TODO: order friends by user friend creation date as dictionaries don't have any inherent order
// they order randomly through hash value creation
var activeFriendIds: [String] = []
for (friendId, userFriend) in self.userFriendsDict {
@@ -68,6 +68,7 @@ struct CircleGridView: View {
// active friends
ForEach(0..<activeFriends.count, id: \.self) {value in
let friendId = activeFriends[value]
GeometryReader {gridProxy in
let scale = getScale(proxy: gridProxy, itemNumber: value, userId: friendId)
@@ -151,7 +152,7 @@ struct CircleGridView: View {
// inbox users
ForEach(0..<inboxUsers.count, id: \.self) {inboxValue in
let inboxUserId = inboxUsers[inboxValue]
let adjustedValue = inboxValue + activeFriends.count // IMPORTANT: accounting for the active friends iterations
let adjustedValue = inboxValue + self.authSessionStore.getActiveFriendIds().count // IMPORTANT: accounting for the active friends iterations
GeometryReader {gridProxy in
let scale = getScale(proxy: gridProxy, itemNumber: adjustedValue, userId: inboxUserId) * 0.75 // don't want inbox to match size of active
@@ -211,7 +212,7 @@ struct CircleGridView: View {
}
// stale state for adding a contact
let staleAdjustedValue = activeFriends.count + inboxUsers.count
let staleAdjustedValue = self.authSessionStore.getActiveFriendIds().count + self.authSessionStore.getInboxUsersIds().count
GeometryReader {gridProxy in
let scale = getScale(proxy: gridProxy, itemNumber: staleAdjustedValue, userId: nil) * 0.75 // adjusting size as stale states should be the smallest
Button {
@@ -84,14 +84,7 @@ struct InnerCircleView: View {
}
.padding()
} else {
Image("undraw_fall_is_coming_yl-0-x")
.renderingMode(.original)
.resizable()
.aspectRatio(contentMode: .fit)
.blur(radius: 20)
} else {
// content
CircleGridView(selectedFriendIndex: self.$selectedFriendIndex)
.environmentObject(innerCircleVM)