Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion iosApp/iosApp/DesignKit/Loading.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions iosApp/iosApp/Modules/Friends/FriendsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -44,7 +44,7 @@ struct FriendsView: View {
contentListView()
.overlay {
if reducer.isLoading {
LoadingView()
LoadingView(title: "Loading friends...")
}
}
.opacity(reducer.isLoading ? 0 : 1)
Expand Down
4 changes: 2 additions & 2 deletions iosApp/iosApp/Modules/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -70,7 +70,7 @@ struct ProfileView: View {
}
}
} else {
LoadingView()
LoadingView(title: "Loading profile...")
.onAppear {
profileReducer.loadProfile()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading