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
13 changes: 9 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Cowtail.xcodeproj/
.build/
Packages/
Package.resolved
OpenAPITools/Sources/CowtailGeneratedAPI/GeneratedSources/
OpenAPITools/Sources/CowtailGeneratedAPI/openapi.json

# Fastlane
fastlane/report.xml
Expand Down
43 changes: 43 additions & 0 deletions ios/CowtailApp/Resources/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Cowtail</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CowtailAlertWriteURL</key>
<string>$(COWTAIL_ALERT_WRITE_URL)</string>
<key>CowtailConvexQueryURL</key>
<string>$(COWTAIL_CONVEX_QUERY_URL)</string>
<key>CowtailHealthSummaryURL</key>
<string>$(COWTAIL_HEALTH_SUMMARY_URL)</string>
<key>CowtailPublicSiteURL</key>
<string>$(COWTAIL_PUBLIC_SITE_URL)</string>
<key>CowtailPushRegistrationURL</key>
<string>$(COWTAIL_PUSH_REGISTRATION_URL)</string>
<key>CowtailPushUnregistrationURL</key>
<string>$(COWTAIL_PUSH_UNREGISTRATION_URL)</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
</dict>
<key>UILaunchScreen</key>
<dict/>
</dict>
</plist>
19 changes: 19 additions & 0 deletions ios/CowtailApp/Sources/App/AppConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ enum AppConfig {
return URL(string: string)
}

static func baseURL(for endpointURL: URL, droppingLastPathComponents count: Int) -> URL {
precondition(count >= 0, "Path component count must be nonnegative")

var result = endpointURL
for _ in 0..<count {
result.deleteLastPathComponent()
}

guard var components = URLComponents(url: result, resolvingAgainstBaseURL: false) else {
return result
}

if components.path.count > 1, components.path.hasSuffix("/") {
components.path.removeLast()
}

return components.url ?? result
}

private static func requiredURL(_ key: String) -> URL {
guard
let value = Bundle.main.object(forInfoDictionaryKey: key) as? String,
Expand Down
9 changes: 9 additions & 0 deletions ios/CowtailApp/Sources/App/CowtailStore.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import OSLog

@MainActor
final class CowtailStore: ObservableObject {
Expand All @@ -14,6 +15,10 @@ final class CowtailStore: ObservableObject {
@Published var errorMessage: String?

private let api: CowtailAPI
private let logger = Logger(
subsystem: Bundle.main.bundleIdentifier ?? "Cowtail",
category: "store"
)
private var hasLoaded = false

init(
Expand Down Expand Up @@ -64,13 +69,15 @@ final class CowtailStore: ObservableObject {
didLoadAlerts = true
} catch {
guard !isCancellation(error) else { return }
logger.error("refresh alerts failed: \(String(describing: error), privacy: .public)")
errorMessage = error.localizedDescription
}

do {
health = try await healthTask
} catch {
guard !isCancellation(error) else { return }
logger.error("refresh health failed: \(String(describing: error), privacy: .public)")
healthErrorMessage = error.localizedDescription
}

Expand All @@ -89,6 +96,7 @@ final class CowtailStore: ObservableObject {
fixesByAlertID[alertID] = try await api.fetchFixes(alertIDs: [alertID])
} catch {
guard !isCancellation(error) else { return }
logger.error("loadFixes failed for \(alertID, privacy: .public): \(String(describing: error), privacy: .public)")
errorMessage = error.localizedDescription
}
}
Expand Down Expand Up @@ -125,6 +133,7 @@ final class CowtailStore: ObservableObject {
alertCacheByID[alert.id] = alert
} catch {
guard !isCancellation(error) else { return }
logger.error("loadAlert failed for \(alertID, privacy: .public): \(String(describing: error), privacy: .public)")
alertLoadErrors[alertID] = error.localizedDescription
}
}
Expand Down
Loading