diff --git a/yobble/Resources/Localizable.xcstrings b/yobble/Resources/Localizable.xcstrings index 9fec7a2..b54f0b9 100644 --- a/yobble/Resources/Localizable.xcstrings +++ b/yobble/Resources/Localizable.xcstrings @@ -94,6 +94,9 @@ }, "Email не подтверждён. Подтвердите, чтобы активировать дополнительные проверки." : { "comment" : "Описание необходимости подтверждения email" + }, + "error" : { + }, "Fun Fest" : { "comment" : "Fun Fest", diff --git a/yobble/Views/Tab/Settings/BlockedUsersView.swift b/yobble/Views/Tab/Settings/BlockedUsersView.swift index 1e9edcf..f0b9368 100644 --- a/yobble/Views/Tab/Settings/BlockedUsersView.swift +++ b/yobble/Views/Tab/Settings/BlockedUsersView.swift @@ -10,6 +10,7 @@ struct BlockedUsersView: View { @State private var showUnblockConfirmation = false @State private var removingUserIds: Set = [] @State private var activeAlert: ActiveAlert? + @State private var errorMessageDown: String? private let blockedUsersService = BlockedUsersService() private let limit = 20 @@ -24,11 +25,13 @@ struct BlockedUsersView: View { emptyState } else { usersSection - if isLoading && !blockedUsers.isEmpty { + if isLoading { Section { ProgressView() .frame(maxWidth: .infinity, alignment: .center) } + } else if errorMessageDown != nil{ + Text("error") } } } @@ -117,9 +120,11 @@ struct BlockedUsersView: View { } .disabled(removingUserIds.contains(user.id)) } - .task { - if user == blockedUsers.last, hasMore, !isLoading { - await loadBlockedUsers() + .onAppear { + if user.id == blockedUsers.last?.id { + Task { + await loadBlockedUsers() + } } } } @@ -158,6 +163,7 @@ struct BlockedUsersView: View { @MainActor private func loadBlockedUsers() async { + errorMessageDown = nil guard !isLoading, hasMore else { return } @@ -180,6 +186,7 @@ struct BlockedUsersView: View { loadError = message } activeAlert = .error(message: message) + errorMessageDown = message if AppConfig.DEBUG { print("[BlockedUsersView] load blocked users failed: \(error)") } } } @@ -265,4 +272,4 @@ private enum ActiveAlert: Identifiable { return id.uuidString } } -} \ No newline at end of file +}