From 17eb18ce6a7bf58b07cb4a7b9aa79a64ce55c38e Mon Sep 17 00:00:00 2001 From: balzack Date: Tue, 15 Nov 2022 13:30:14 -0800 Subject: [PATCH] request push permission on all login paths --- app/mobile/src/context/useAppContext.hook.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/mobile/src/context/useAppContext.hook.js b/app/mobile/src/context/useAppContext.hook.js index fa70038f..eaeb2804 100644 --- a/app/mobile/src/context/useAppContext.hook.js +++ b/app/mobile/src/context/useAppContext.hook.js @@ -86,20 +86,26 @@ export function useAppContext() { const access = await setLogin(username, server, password, getApplicatioName(), getVersion(), getDeviceId(), state.deviceToken, notifications) await store.actions.setSession({ ...access, server}); await setSession({ ...access, server }); + if (access.pushSupported) { + messaging().requestPermission().then(status => {}) + } }, access: async (server, token) => { const access = await setAccountAccess(server, token, getApplicationName(), getVersion(), getDeviceId(), state.deviceToken, notifications); await store.actions.setSession({ ...access, server}); await setSession({ ...access, server }); + if (access.pushSupported) { + messaging().requestPermission().then(status => {}) + } }, login: async (username, password) => { const acc = username.split('@'); const access = await setLogin(acc[0], acc[1], password, getApplicationName(), getVersion(), getDeviceId(), state.deviceToken, notifications) + await store.actions.setSession({ ...access, server: acc[1]}); + await setSession({ ...access, server: acc[1] }); if (access.pushSupported) { messaging().requestPermission().then(status => {}) } - await store.actions.setSession({ ...access, server: acc[1]}); - await setSession({ ...access, server: acc[1] }); }, logout: async () => { try {