decent place to load the friends in the view

This commit is contained in:
talksik
2021-12-21 04:04:44 -08:00
parent 2972fd60e4
commit 799a3c82f4
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -32,7 +32,7 @@ final class AuthSessionStore: ObservableObject, SessionStore {
@Published var sessionState: SessionState = SessionState.isLoggedOut
// TODO: figure out which ones to publish
var friendsArr: [User] = []
@Published var friendsArr: [User] = []
var messagesArr: [Message] = []
// transformed data for the views
@@ -232,6 +232,7 @@ extension AuthSessionStore {
self.friendsArr.append(returnedUser!)
// if this friend do not exist in the dict, add it to show up in my circle
// TODO: prolly don't need this function to mess with dictionary
if self.friendMessagesDict[returnedUser!.id!] == nil {
self.friendMessagesDict[returnedUser!.id!] = []
}
@@ -53,7 +53,8 @@ struct CircleGridView: View {
alignment: .center,
spacing: Self.spacingBetweenRows
) {
ForEach(0..<Self.numberOfItems) { value in
ForEach(Array(self.authSessionStore.friendsArr.enumerated()), id: \.offset) { value, element in
// for (value, element) in self.authSessionStore.friendMessagesDict.keys.enumerated() {
GeometryReader {gridProxy in
let scale = getScale(proxy: gridProxy, itemNumber: value)
@@ -63,7 +64,7 @@ struct CircleGridView: View {
.blur(radius: 8)
.cornerRadius(100)
Image("Artboards_Diversity_Avatars_by_Netguru-\(value + 1)")
Image(element.avatar ?? Avatars.avatarSystemNames[0])
.resizable()
.scaledToFit()
.shadow(color: Color.black.opacity(0.2), radius: 10, x: 0, y: 20)