Merge pull request #9969 from streetwriters/mobile/live-inbox-enabled

mobile: update inbox enabled setting on userFetched event
This commit is contained in:
Ammar Ahmed
2026-06-11 10:27:04 +05:00
committed by GitHub
3 changed files with 9 additions and 1 deletions

View File

@@ -728,6 +728,10 @@ export const useAppEvents = () => {
useEffect(() => {
const subscriptions = [
db.eventManager.subscribe(EVENTS.syncCheckStatus, onCheckSyncStatus),
db.eventManager.subscribe(EVENTS.userFetched, async () => {
const inboxEnabled = await db.user.hasInboxKeys();
useSettingStore.getState().setInboxEnabled(inboxEnabled);
}),
db.eventManager.subscribe(EVENTS.syncAborted, onSyncAborted),
db.eventManager.subscribe(EVENTS.appRefreshRequested, onSyncComplete),
db.eventManager.subscribe(EVENTS.userLoggedOut, onLogout),

View File

@@ -147,6 +147,7 @@ export interface SettingStore {
initialUrl: string | null;
refresh: () => void;
inboxEnabled: boolean;
setInboxEnabled: (inboxEnabled: boolean) => void;
}
const { width, height } = Dimensions.get("window");
@@ -265,5 +266,6 @@ export const useSettingStore = create<SettingStore>((set, get) => ({
inboxEnabled: await db.user.hasInboxKeys()
});
},
inboxEnabled: false
inboxEnabled: false,
setInboxEnabled: (inboxEnabled) => set({ inboxEnabled })
}));

View File

@@ -336,6 +336,8 @@ class UserManager {
}
async fetchUser(): Promise<User | undefined> {
this.keyManager.clearCache();
const oldUser = await this.getUser();
try {
const token = await this.tokenManager.getAccessToken();