fix(ios): iptal edilen isteklerde hata gösterimini düzelt
- API uç noktasını yeni IP adresine güncelle - Docker yapılandırmasında node_modules için adlandırılmış volume ekle - Arama işlemlerinde iptal durumlarını yoksay ve hata mesajı gösterme - NetworkErrorView'da wifi ikonunu kaldır
This commit is contained in:
@@ -6,8 +6,6 @@ struct NetworkErrorView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 12) {
|
||||
Image(systemName: "wifi.exclamationmark")
|
||||
.font(.title2)
|
||||
Text(message)
|
||||
.font(.subheadline)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
@@ -1 +1 @@
|
||||
API_BASE_URL = http://192.168.1.124:8080
|
||||
API_BASE_URL = http://192.168.1.141:8080
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<true/>
|
||||
</dict>
|
||||
<key>API_BASE_URL</key>
|
||||
<string>http://192.168.1.124:8080</string>
|
||||
<string>http://192.168.1.141:8080</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>ISBN barkodu taramak için kameraya erişim gerekiyor.</string>
|
||||
</dict>
|
||||
|
||||
@@ -1 +1 @@
|
||||
API_BASE_URL = http://localhost:8080
|
||||
API_BASE_URL = http://192.168.1.141:8080
|
||||
|
||||
@@ -108,7 +108,7 @@ extension Bundle {
|
||||
return url
|
||||
}
|
||||
|
||||
// 2) If scheme is missing (e.g. "192.168.1.124:8080"), prepend http://.
|
||||
// 2) If scheme is missing (e.g. "192.168.1.141:8080"), prepend http://.
|
||||
if !raw.isEmpty, !raw.contains("://"),
|
||||
let url = URL(string: "http://\(raw)"),
|
||||
let host = url.host, !host.isEmpty {
|
||||
@@ -116,7 +116,7 @@ extension Bundle {
|
||||
}
|
||||
|
||||
// 3) Device-local fallback for current dev network.
|
||||
if let fallback = URL(string: "http://192.168.1.124:8080") {
|
||||
if let fallback = URL(string: "http://192.168.1.141:8080") {
|
||||
#if DEBUG
|
||||
print("[API] Invalid API_BASE_URL='\(raw)'. Falling back to \(fallback.absoluteString)")
|
||||
#endif
|
||||
|
||||
@@ -56,6 +56,7 @@ final class AddBooksViewModel: ObservableObject {
|
||||
results = try await booksService.searchByTitle(value, locales: "tr,en")
|
||||
errorMessage = nil
|
||||
} catch {
|
||||
guard !isIgnorable(error) else { return }
|
||||
errorMessage = error.localizedDescription
|
||||
}
|
||||
}
|
||||
@@ -69,6 +70,7 @@ final class AddBooksViewModel: ObservableObject {
|
||||
results = try await booksService.searchByISBN(isbn, locales: "tr,en")
|
||||
errorMessage = nil
|
||||
} catch {
|
||||
guard !isIgnorable(error) else { return }
|
||||
errorMessage = error.localizedDescription
|
||||
}
|
||||
}
|
||||
@@ -82,7 +84,22 @@ final class AddBooksViewModel: ObservableObject {
|
||||
results = try await booksService.filter(title: filterTitle, year: filterYear, locales: "tr,en")
|
||||
errorMessage = nil
|
||||
} catch {
|
||||
guard !isIgnorable(error) else { return }
|
||||
errorMessage = error.localizedDescription
|
||||
}
|
||||
}
|
||||
|
||||
private func isIgnorable(_ error: Error) -> Bool {
|
||||
if error is CancellationError {
|
||||
return true
|
||||
}
|
||||
|
||||
let nsError = error as NSError
|
||||
if nsError.domain == NSURLErrorDomain, nsError.code == NSURLErrorCancelled {
|
||||
return true
|
||||
}
|
||||
|
||||
let message = error.localizedDescription.lowercased()
|
||||
return message.contains("cancelled") || message.contains("vazgeç")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user