From ed59da1803d60b54ac22f12754788e5a74cbf224 Mon Sep 17 00:00:00 2001 From: balzack Date: Mon, 6 Mar 2023 23:05:03 -0800 Subject: [PATCH] reset tos on logout --- app/mobile/src/context/useAppContext.hook.js | 1 + app/mobile/src/context/useStoreContext.hook.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/mobile/src/context/useAppContext.hook.js b/app/mobile/src/context/useAppContext.hook.js index f13365ea..65c32387 100644 --- a/app/mobile/src/context/useAppContext.hook.js +++ b/app/mobile/src/context/useAppContext.hook.js @@ -147,6 +147,7 @@ export function useAppContext() { await clearSession(); access.current = null; await store.actions.clearSession(); + await store.actions.clearFirstRun(); updateState({ loggingOut: false }); }, remove: async () => { diff --git a/app/mobile/src/context/useStoreContext.hook.js b/app/mobile/src/context/useStoreContext.hook.js index d349eb08..737b0ad1 100644 --- a/app/mobile/src/context/useStoreContext.hook.js +++ b/app/mobile/src/context/useStoreContext.hook.js @@ -44,12 +44,15 @@ export function useStoreContext() { const dataId = `${guid}_profile`; await db.current.executeSql("INSERT OR REPLACE INTO app (key, value) values (?, ?);", [dataId, encodeObject(profile)]); }, - getFirstRun: async (guid) => { - const firstRun = await getAppValue(db.current, `${guid}_firstrun`, { set: true }); + getFirstRun: async () => { + const firstRun = await getAppValue(db.current, `firstrun`, { set: true }); return firstRun.set; }, setFirstRun: async () => { - await db.current.executeSql("INSERT OR REPLACE INTO app (key, value) values (?, ?);", ["firstrun", encodeObject({ set: false })]); + await db.current.executeSql("INSERT OR REPLACE INTO app (key, value) values (?, ?);", [`firstrun`, encodeObject({ set: false })]); + }, + clearFirstRun: async () => { + await db.current.executeSql("INSERT OR REPLACE INTO app (key, value) values (?, ?);", [`firstrun`, encodeObject({ set: true })]); }, getCardRequestStatus: async (guid) => { const dataId = `${guid}_card_status`;