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:
@@ -28,7 +28,8 @@ services:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./:/app
|
||||
command: npm run dev
|
||||
- api-node_modules:/app/node_modules
|
||||
command: sh -c "npm install && npm run dev"
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
@@ -63,3 +64,4 @@ services:
|
||||
volumes:
|
||||
postgres-data:
|
||||
frontend-node_modules:
|
||||
api-node_modules:
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>Bookibra.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -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