feat: add iOS support and harden receipt scanning
This commit is contained in:
30
app/ios/ScanReceipts/Networking/APIEnvironment.swift
Normal file
30
app/ios/ScanReceipts/Networking/APIEnvironment.swift
Normal file
@@ -0,0 +1,30 @@
|
||||
import Foundation
|
||||
|
||||
/// Which backend the app talks to. All three point at the *same* Next.js API
|
||||
/// described in `app/ios/README.md` — there is no separate mobile backend.
|
||||
enum APIEnvironment {
|
||||
case production
|
||||
case local
|
||||
|
||||
var baseURL: URL {
|
||||
switch self {
|
||||
case .production:
|
||||
// TODO: swap for the real production domain before release.
|
||||
return URL(string: "https://scan-receipts.app")!
|
||||
case .local:
|
||||
// Matches `dev-verify` in the web repo's .claude/launch.json (port
|
||||
// 3901) so the app can be pointed at a live local backend without
|
||||
// colliding with the docker-compose stack on 3000. Only reachable
|
||||
// from an iOS Simulator on the same machine, not a physical device.
|
||||
return URL(string: "http://localhost:3901")!
|
||||
}
|
||||
}
|
||||
|
||||
static var current: APIEnvironment {
|
||||
#if DEBUG
|
||||
return .local
|
||||
#else
|
||||
return .production
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user