decent place to load the friends in the view
This commit is contained in:
@@ -32,7 +32,7 @@ final class AuthSessionStore: ObservableObject, SessionStore {
|
|||||||
@Published var sessionState: SessionState = SessionState.isLoggedOut
|
@Published var sessionState: SessionState = SessionState.isLoggedOut
|
||||||
|
|
||||||
// TODO: figure out which ones to publish
|
// TODO: figure out which ones to publish
|
||||||
var friendsArr: [User] = []
|
@Published var friendsArr: [User] = []
|
||||||
var messagesArr: [Message] = []
|
var messagesArr: [Message] = []
|
||||||
|
|
||||||
// transformed data for the views
|
// transformed data for the views
|
||||||
@@ -232,6 +232,7 @@ extension AuthSessionStore {
|
|||||||
self.friendsArr.append(returnedUser!)
|
self.friendsArr.append(returnedUser!)
|
||||||
|
|
||||||
// if this friend do not exist in the dict, add it to show up in my circle
|
// 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 {
|
if self.friendMessagesDict[returnedUser!.id!] == nil {
|
||||||
self.friendMessagesDict[returnedUser!.id!] = []
|
self.friendMessagesDict[returnedUser!.id!] = []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ struct CircleGridView: View {
|
|||||||
alignment: .center,
|
alignment: .center,
|
||||||
spacing: Self.spacingBetweenRows
|
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
|
GeometryReader {gridProxy in
|
||||||
let scale = getScale(proxy: gridProxy, itemNumber: value)
|
let scale = getScale(proxy: gridProxy, itemNumber: value)
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ struct CircleGridView: View {
|
|||||||
.blur(radius: 8)
|
.blur(radius: 8)
|
||||||
.cornerRadius(100)
|
.cornerRadius(100)
|
||||||
|
|
||||||
Image("Artboards_Diversity_Avatars_by_Netguru-\(value + 1)")
|
Image(element.avatar ?? Avatars.avatarSystemNames[0])
|
||||||
.resizable()
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.shadow(color: Color.black.opacity(0.2), radius: 10, x: 0, y: 20)
|
.shadow(color: Color.black.opacity(0.2), radius: 10, x: 0, y: 20)
|
||||||
|
|||||||
Reference in New Issue
Block a user