Feedback
LaunchSwift includes a feedback form feature wired to POST /api/feedback.
ios/SwiftLaunch/Features/Feedback/FeedbackState.swift— request, draft, and submission stateios/SwiftLaunch/Features/Feedback/Models/FeedbackModels.swift—FeedbackCategory,SubmissionStatusios/SwiftLaunch/Features/Feedback/FeedbackAccessPolicy.swift— auth and submit guardsios/SwiftLaunch/Features/Feedback/Views/FeedbackView.swift— form UIbackend/src/routes/feedback.ts— feedback API route
FeedbackState API
Section titled “FeedbackState API”@MainActor@Observablefinal class FeedbackState { var feedbackText = "" var email = "" var category: FeedbackCategory = .general var submissionStatus: SubmissionStatus = .idle var isSubmitting = false
func submit() async func resetAfterDismissal() func preserveDraftForAuthRedirect()}FeedbackState also persists draft text/email/category to UserDefaults, with scope-aware behavior for guest vs authenticated sessions.
Categories and status types
Section titled “Categories and status types”enum FeedbackCategory: String, CaseIterable, Identifiable, Sendable { case general case bug case feature}
enum SubmissionStatus: Equatable, Sendable { case idle case error(String) case success}Access policy
Section titled “Access policy”FeedbackAccessPolicy requires authentication for feedback actions:
canUseFeedbackActions(isAuthenticated:)canSubmit(draft:isSubmitting:isAuthenticated:)
If signed out, FeedbackView prompts sign-in and redirects through AppRouter.
Backend endpoint
Section titled “Backend endpoint”backend/src/index.ts mounts feedbackRoutes under /api, so the route is:
| Method | Path | Auth |
|---|---|---|
POST | /api/feedback | Required (protectedRoute) |
Request body accepted by feedback.ts:
{ "category": "bug", "text": "The chat screen freezes when switching models", "email": "user@example.com", "deviceInfo": "iOS 18.2 on iPhone"}Notes:
deviceInfocan be either a string or an object; objects are JSON-stringified server-side.- With D1 available, feedback is inserted into the
feedbacktable. - Success response is
{ "success": true }with HTTP201.
Entry point from Settings
Section titled “Entry point from Settings”The current Settings screen links directly to FeedbackView via NavigationLink in:
ios/SwiftLaunch/Features/Settings/SettingsView.swift