From 9d3ac06234ec9e94236beae1377c61b9117348ee Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Tue, 31 Mar 2026 00:49:40 -0700 Subject: [PATCH] fix(mobile): use dynamic platform in feedback, add null coercion, add Content-Type on flush - settings.tsx: replace hardcoded platform: 'ios' with APP_PLATFORM from app-metadata - feedback-client.ts: add ?? '' null coercion on getAuthToken (matches broadcast/survey pattern) - offline-queue.ts: add Content-Type: application/json header on flush requests --- mobile/src/app/(tabs)/settings.tsx | 3 ++- mobile/src/lib/feedback-client.ts | 2 +- mobile/src/lib/offline-queue.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/src/app/(tabs)/settings.tsx b/mobile/src/app/(tabs)/settings.tsx index db53778..09e1c78 100644 --- a/mobile/src/app/(tabs)/settings.tsx +++ b/mobile/src/app/(tabs)/settings.tsx @@ -3,6 +3,7 @@ import { Alert, Pressable, ScrollView, StyleSheet, Text, TextInput, View } from import { router } from 'expo-router'; import { useAuthStore, type AuthState } from '../../store/auth-store'; import { getFeedbackClient } from '../../lib/feedback-client'; +import { APP_PLATFORM } from '../../lib/app-metadata'; import { colors } from '../../theme'; type FeedbackType = 'bug' | 'feature' | 'praise' | 'other'; @@ -27,7 +28,7 @@ export default function SettingsScreen() { type: feedbackType, title, body: feedbackBody.trim() || undefined, - platform: 'ios', + platform: APP_PLATFORM, }); setFeedbackTitle(''); setFeedbackBody(''); diff --git a/mobile/src/lib/feedback-client.ts b/mobile/src/lib/feedback-client.ts index 5464813..5f23845 100644 --- a/mobile/src/lib/feedback-client.ts +++ b/mobile/src/lib/feedback-client.ts @@ -8,7 +8,7 @@ export function getFeedbackClient(): FeedbackClient { if (!feedbackClient) { feedbackClient = createFeedbackClient({ baseUrl: API_CONFIG.platformBaseUrl, - getAuthToken: () => getAuthClient().getAccessToken(), + getAuthToken: () => getAuthClient().getAccessToken() ?? '', }); } diff --git a/mobile/src/lib/offline-queue.ts b/mobile/src/lib/offline-queue.ts index d8f63d8..0e3a307 100644 --- a/mobile/src/lib/offline-queue.ts +++ b/mobile/src/lib/offline-queue.ts @@ -64,6 +64,7 @@ export async function flushNoteQueue(): Promise<{ flushed: number; failed: numbe return noteOfflineQueue.flush(async (action, path, payload) => { await getApiClient().fetch(path, { method: action === 'create' ? 'POST' : 'PATCH', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), }); });