From 05acb376193b660e0404ea41b49c7290b9d1b7e9 Mon Sep 17 00:00:00 2001 From: Taras Filatov Date: Wed, 11 Mar 2026 13:44:10 +0000 Subject: [PATCH 1/2] fix(settings): restore preserved mobile push and base app UX Carry over the safe preserved frontend changes by uploading push Firebase credentials directly per app and by showing clearer chat context guidance when an admin is in the base app. --- src/actions.ts | 8 ++++++ src/http.ts | 6 +++++ src/pages/AppSettings/AppSettings.tsx | 1 - src/pages/AppSettings/MobileApp.tsx | 37 +++++++++++++++------------ src/pages/Chat.tsx | 23 ++++++++++++++--- 5 files changed, 55 insertions(+), 20 deletions(-) diff --git a/src/actions.ts b/src/actions.ts index e8ec527..81652ca 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -7,6 +7,7 @@ import { httpGetConfig, httpGetUsers, httpPostFile, + httpUploadPushFirebaseServiceAccount, httpResetPasswords, httpTokens, httpUpdateApp, @@ -166,6 +167,13 @@ export async function actionPostFile(file: File) { return httpPostFile(file); } +export async function actionUploadPushFirebaseServiceAccount( + appId: string, + file: File +) { + return httpUploadPushFirebaseServiceAccount(appId, file); +} + export async function actionGetUsers( appId: string, limit: number = 10, diff --git a/src/http.ts b/src/http.ts index 937235d..85469e6 100644 --- a/src/http.ts +++ b/src/http.ts @@ -207,6 +207,12 @@ export function httpPostFile(file: File) { return http.post('/files', fd); } +export function httpUploadPushFirebaseServiceAccount(appId: string, file: File) { + const fd = new FormData(); + fd.append('firebaseServiceAccount', file); + return http.post(`/push/firebase-service-account/${appId}`, fd); +} + export function httpGetUsers( appId: string, limit: number = 10, diff --git a/src/pages/AppSettings/AppSettings.tsx b/src/pages/AppSettings/AppSettings.tsx index a4d5cb1..78a2bbe 100644 --- a/src/pages/AppSettings/AppSettings.tsx +++ b/src/pages/AppSettings/AppSettings.tsx @@ -714,7 +714,6 @@ export default function AppSettings() { diff --git a/src/pages/AppSettings/MobileApp.tsx b/src/pages/AppSettings/MobileApp.tsx index e102a9a..e40db84 100644 --- a/src/pages/AppSettings/MobileApp.tsx +++ b/src/pages/AppSettings/MobileApp.tsx @@ -1,30 +1,35 @@ import { useRef } from 'react'; import { NavLink } from 'react-router-dom'; -import { actionPostFile } from '../../actions'; +import { toast } from 'react-toastify'; +import { actionUploadPushFirebaseServiceAccount } from '../../actions'; import { IconUpload } from '../../components/Icons/IconUpload'; interface Props { appId: string; - setGoogleServicesJson: (s: string) => void; primaryColor: string; } export function MobileApp({ appId, - setGoogleServicesJson, primaryColor, }: Props) { - const googleJsonRef = useRef(null); + const pushServiceAccountRef = useRef(null); - const onGoogleJsonRefChanges = (file: File | null) => { - if (!file) { - return; - } - - actionPostFile(file).then((resp) => { - setGoogleServicesJson(resp.data.results[0].location); - }); + const onPushServiceAccountChanges = (file: File | null) => { + if (!file) return; + actionUploadPushFirebaseServiceAccount(appId, file) + .then(() => { + toast.success('Push service account uploaded'); + }) + .catch((e) => { + const msg = + e?.response?.data?.error || + e?.response?.data?.details || + e?.message || + 'Failed to upload push service account'; + toast.error(String(msg)); + }); }; return ( @@ -108,20 +113,20 @@ export function MobileApp({ Push Notifications

- Follow this manual to set up your Firebase account. Extract and upload your service-account.json. This will enable your users to receive push notifications for chat messages they missed while being offline. + Follow this manual to set up your Firebase account. Upload your service-account.json here to enable push notifications for offline chat messages.

- onGoogleJsonRefChanges(e.target.files && e.target.files[0]) + onPushServiceAccountChanges(e.target.files && e.target.files[0]) } />