From cedb7ff88583daee0937c4fbeec51de892cbe6f4 Mon Sep 17 00:00:00 2001 From: balzack Date: Mon, 6 Jan 2025 16:16:40 -0800 Subject: [PATCH] dismiss disconnected message --- app/client/mobile/src/StagingFiles.ts | 10 +++++++++- .../mobile/src/conversation/Conversation.tsx | 4 +++- app/client/mobile/src/session/Session.tsx | 15 +++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/client/mobile/src/StagingFiles.ts b/app/client/mobile/src/StagingFiles.ts index 697b6156..687d5331 100644 --- a/app/client/mobile/src/StagingFiles.ts +++ b/app/client/mobile/src/StagingFiles.ts @@ -25,9 +25,11 @@ export class StagingFiles implements Staging { } public async write(): Promise<{ setData: (data: string)=>Promise, getUrl: ()=>Promise, close: ()=>Promise }> { + let set = false; let extension = ''; const path = RNFS.DocumentDirectoryPath + `/dbTmp_${Date.now()}` const setData = async (data: string) => { + set = true; await RNFS.appendFile(path, data, 'base64'); } const getUrl = async () => { @@ -45,7 +47,13 @@ export class StagingFiles implements Staging { return `file://${path}${extension}` } const close = async () => { - await RNFS.unlink(`${path}${extension}`); + if (set) { + try { + await RNFS.unlink(`${path}${extension}`); + } catch (err) { + console.log(err); + } + } } return { setData, getUrl, close }; } diff --git a/app/client/mobile/src/conversation/Conversation.tsx b/app/client/mobile/src/conversation/Conversation.tsx index b3d0e884..2be633a8 100644 --- a/app/client/mobile/src/conversation/Conversation.tsx +++ b/app/client/mobile/src/conversation/Conversation.tsx @@ -204,6 +204,9 @@ export function Conversation({close}: {close: ()=>void}) { )} + { state.detailSet && ( + + )} { state.detailSet && state.host && ( )} @@ -213,7 +216,6 @@ export function Conversation({close}: {close: ()=>void}) { { state.detailSet && state.sealed && ( )} - {}} /> diff --git a/app/client/mobile/src/session/Session.tsx b/app/client/mobile/src/session/Session.tsx index 1211b630..7f6c0dc0 100644 --- a/app/client/mobile/src/session/Session.tsx +++ b/app/client/mobile/src/session/Session.tsx @@ -1,5 +1,5 @@ import React, {useState, useCallback} from 'react'; -import {SafeAreaView, View, useColorScheme} from 'react-native'; +import {SafeAreaView, Pressable, View, useColorScheme} from 'react-native'; import {styles} from './Session.styled'; import {IconButton, Surface, Text, Icon} from 'react-native-paper'; import {Settings} from '../settings/Settings'; @@ -32,6 +32,7 @@ export function Session() { const scheme = useColorScheme(); const [tab, setTab] = useState('content'); const [textCard, setTextCard] = useState({ cardId: null} as {cardId: null|string}); + const [dismissed, setDismissed] = useState(false); const sessionNav = {strings: state.strings}; const showContent = {display: tab === 'content' ? 'flex' : 'none'}; @@ -43,6 +44,13 @@ export function Session() { setTab('content') } + const dismiss = () => { + setDismissed(true); + setTimeout(() => { + setDismissed(false); + }, 60000); + } + return ( {state.layout !== 'large' && ( @@ -151,11 +159,14 @@ export function Session() { )} - { state.disconnected && ( + { state.disconnected && !dismissed && ( { state.strings.disconnected } + + + )}