profile: don't auto-load followers
This is a bandwidth-intensive operation Changelog-Changed: Don't auto-load follower count
This commit is contained in:
@@ -201,20 +201,33 @@ struct ProfileView: View {
|
||||
}
|
||||
let fview = FollowersView(damus_state: damus_state, whos: profile.pubkey)
|
||||
.environmentObject(followers)
|
||||
NavigationLink(destination: fview) {
|
||||
HStack {
|
||||
Text("\(followers.contacts.count)")
|
||||
.font(.subheadline.weight(.medium))
|
||||
Text("Followers")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.gray)
|
||||
if followers.contacts != nil {
|
||||
NavigationLink(destination: fview) {
|
||||
FollowersCount
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
} else {
|
||||
FollowersCount
|
||||
.onTapGesture {
|
||||
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
||||
followers.contacts = []
|
||||
followers.subscribe()
|
||||
}
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var FollowersCount: some View {
|
||||
HStack {
|
||||
Text("\(followers.count_display)")
|
||||
.font(.subheadline.weight(.medium))
|
||||
Text("Followers")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
ScrollView {
|
||||
@@ -237,7 +250,7 @@ struct ProfileView: View {
|
||||
}
|
||||
.onDisappear {
|
||||
profile.unsubscribe()
|
||||
//followers.unsubscribe()
|
||||
followers.unsubscribe()
|
||||
// our profilemodel needs a bit more help
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user