patch
This commit is contained in:
		
							parent
							
								
									3f0543aa3a
								
							
						
					
					
						commit
						3e9d6696b0
					
				@ -24,8 +24,11 @@ struct BlockedUsersView: View {
 | 
			
		||||
                emptyState
 | 
			
		||||
            } else {
 | 
			
		||||
                usersSection
 | 
			
		||||
                if hasMore {
 | 
			
		||||
                    loadMoreState
 | 
			
		||||
                if isLoading && !blockedUsers.isEmpty {
 | 
			
		||||
                    Section {
 | 
			
		||||
                        ProgressView()
 | 
			
		||||
                            .frame(maxWidth: .infinity, alignment: .center)
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -82,7 +85,8 @@ struct BlockedUsersView: View {
 | 
			
		||||
 | 
			
		||||
    private var usersSection: some View {
 | 
			
		||||
        Section(header: Text(NSLocalizedString("Заблокированные", comment: ""))) {
 | 
			
		||||
            ForEach(blockedUsers) { user in
 | 
			
		||||
            ForEach(blockedUsers) {
 | 
			
		||||
                user in
 | 
			
		||||
                HStack(spacing: 12) {
 | 
			
		||||
                    Circle()
 | 
			
		||||
                        .fill(Color.accentColor.opacity(0.15))
 | 
			
		||||
@ -113,6 +117,11 @@ struct BlockedUsersView: View {
 | 
			
		||||
                    }
 | 
			
		||||
                    .disabled(removingUserIds.contains(user.id))
 | 
			
		||||
                }
 | 
			
		||||
                .task {
 | 
			
		||||
                    if user == blockedUsers.last, hasMore, !isLoading {
 | 
			
		||||
                        await loadBlockedUsers()
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -139,18 +148,6 @@ struct BlockedUsersView: View {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private var loadMoreState: some View {
 | 
			
		||||
        Section {
 | 
			
		||||
            ProgressView()
 | 
			
		||||
                .frame(maxWidth: .infinity, alignment: .center)
 | 
			
		||||
                .onAppear {
 | 
			
		||||
                    Task {
 | 
			
		||||
                        await loadBlockedUsers()
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private func errorState(_ message: String) -> some View {
 | 
			
		||||
        Section {
 | 
			
		||||
            Text(message)
 | 
			
		||||
@ -166,6 +163,8 @@ struct BlockedUsersView: View {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        isLoading = true
 | 
			
		||||
        defer { isLoading = false }
 | 
			
		||||
 | 
			
		||||
        if offset == 0 {
 | 
			
		||||
            loadError = nil
 | 
			
		||||
        }
 | 
			
		||||
@ -183,8 +182,6 @@ struct BlockedUsersView: View {
 | 
			
		||||
            activeAlert = .error(message: message)
 | 
			
		||||
            if AppConfig.DEBUG { print("[BlockedUsersView] load blocked users failed: \(error)") }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        isLoading = false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @MainActor
 | 
			
		||||
@ -268,4 +265,4 @@ private enum ActiveAlert: Identifiable {
 | 
			
		||||
            return id.uuidString
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user