From 1ad1027550a7ad5b9b8f6c38c3f225119a3bb094 Mon Sep 17 00:00:00 2001 From: danilpapa Date: Wed, 3 Jun 2026 22:28:01 +0300 Subject: [PATCH 1/2] fix loader --- iosApp/iosApp/DesignKit/Loading.swift | 3 ++- .../iosApp/Modules/Events/EventDetail/EventDetailView.swift | 2 +- iosApp/iosApp/Modules/Friends/FriendsView.swift | 4 ++-- iosApp/iosApp/Modules/Profile/ProfileView.swift | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/iosApp/iosApp/DesignKit/Loading.swift b/iosApp/iosApp/DesignKit/Loading.swift index c63b271..94b5161 100644 --- a/iosApp/iosApp/DesignKit/Loading.swift +++ b/iosApp/iosApp/DesignKit/Loading.swift @@ -8,11 +8,12 @@ import SwiftUI struct LoadingView: View { + let title: String var body: some View { VStack(spacing: 12) { ProgressView() - Text("Loading friends...") + Text(title) .font(.subheadline) .foregroundColor(.secondary) } diff --git a/iosApp/iosApp/Modules/Events/EventDetail/EventDetailView.swift b/iosApp/iosApp/Modules/Events/EventDetail/EventDetailView.swift index a4ad217..7fcf5dc 100644 --- a/iosApp/iosApp/Modules/Events/EventDetail/EventDetailView.swift +++ b/iosApp/iosApp/Modules/Events/EventDetail/EventDetailView.swift @@ -44,7 +44,7 @@ struct EventDetailView: View { var body: some View { if reducer.isLoading { - LoadingView() + LoadingView(title: "Loading event detail...") } else if let errorMessage = reducer.errorMessage { VStack(spacing: DesignTheme.Spacing.lg) { Image(systemName: "exclamationmark.triangle.fill") diff --git a/iosApp/iosApp/Modules/Friends/FriendsView.swift b/iosApp/iosApp/Modules/Friends/FriendsView.swift index a75541a..1b6f3bb 100644 --- a/iosApp/iosApp/Modules/Friends/FriendsView.swift +++ b/iosApp/iosApp/Modules/Friends/FriendsView.swift @@ -17,7 +17,7 @@ struct FriendsView: View { var body: some View { Group { if reducer == nil { - LoadingView() + LoadingView(title: "Loading friend...") } else { VStack(spacing: 0) { SearchBar( @@ -44,7 +44,7 @@ struct FriendsView: View { contentListView() .overlay { if reducer.isLoading { - LoadingView() + LoadingView(title: "Loading friends...") } } .opacity(reducer.isLoading ? 0 : 1) diff --git a/iosApp/iosApp/Modules/Profile/ProfileView.swift b/iosApp/iosApp/Modules/Profile/ProfileView.swift index 155dee6..37d9fbe 100644 --- a/iosApp/iosApp/Modules/Profile/ProfileView.swift +++ b/iosApp/iosApp/Modules/Profile/ProfileView.swift @@ -17,7 +17,7 @@ struct ProfileView: View { var body: some View { Group { if profileReducer == nil { - LoadingView() + LoadingView(title: "Loading profile...") } else if let profile = profileReducer.profile { ScrollView { VStack(spacing: DesignTheme.Spacing.xxl) { @@ -70,7 +70,7 @@ struct ProfileView: View { } } } else { - LoadingView() + LoadingView(title: "Loading profile...") .onAppear { profileReducer.loadProfile() } From 00cf25ab7523c7aab9628dd413442aa0da7f1c98 Mon Sep 17 00:00:00 2001 From: danilpapa Date: Wed, 3 Jun 2026 22:32:06 +0300 Subject: [PATCH 2/2] also fix error handling --- .../core/domain/model/UserFriendlyError.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared/src/commonMain/kotlin/friends/mobile/core/domain/model/UserFriendlyError.kt b/shared/src/commonMain/kotlin/friends/mobile/core/domain/model/UserFriendlyError.kt index 70a948f..7413e0b 100644 --- a/shared/src/commonMain/kotlin/friends/mobile/core/domain/model/UserFriendlyError.kt +++ b/shared/src/commonMain/kotlin/friends/mobile/core/domain/model/UserFriendlyError.kt @@ -23,14 +23,14 @@ sealed class UserFriendlyError(open val message: String) { } fun mapApiErrorToUserFriendly(error: ApiError): UserFriendlyError = when (error.code) { - 401 -> UserFriendlyError.Unauthorized(error.message) - 403 -> UserFriendlyError.Forbidden(error.message) - 404 -> UserFriendlyError.NotFound(error.message) - 409 -> UserFriendlyError.Conflict(error.message) - in 400..499 -> UserFriendlyError.ClientError(error.message) - in 500..599 -> UserFriendlyError.Server(error.message) - -1 -> UserFriendlyError.Network(error.message) - else -> UserFriendlyError.Unknown(error.message) + 401 -> UserFriendlyError.Unauthorized() + 403 -> UserFriendlyError.Forbidden() + 404 -> UserFriendlyError.NotFound() + 409 -> UserFriendlyError.Conflict() + in 400..499 -> UserFriendlyError.ClientError() + in 500..599 -> UserFriendlyError.Server() + -1 -> UserFriendlyError.Network() + else -> UserFriendlyError.Unknown() } fun getErrorMessage(error: UserFriendlyError): String = error.message