mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-14 11:26:24 +00:00
Fix export chat android (#324)
* Fix export chat button on Android * Fix export chat button on Android
This commit is contained in:
parent
9d80ca6fdb
commit
7c3293775b
@ -4,6 +4,7 @@ import { ExportIcon } from '../../../Icons';
|
|||||||
import KeyIcon from '@mui/icons-material/Key';
|
import KeyIcon from '@mui/icons-material/Key';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { saveAsJson } from '../../../../utils';
|
import { saveAsJson } from '../../../../utils';
|
||||||
|
import { systemClient } from '../../../../services/System';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
orderId: number;
|
orderId: number;
|
||||||
@ -16,6 +17,14 @@ const ChatBottom: React.FC<Props> = ({ orderId, setAudit, audit, createJsonFile
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const onPGPClick: () => void = () => {
|
||||||
|
if (window.ReactNativeWebView === undefined) {
|
||||||
|
saveAsJson('complete_log_chat_' + orderId + '.json', createJsonFile());
|
||||||
|
} else {
|
||||||
|
systemClient.copyToClipboard(JSON.stringify(createJsonFile()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Grid item xs={6}>
|
<Grid item xs={6}>
|
||||||
@ -41,12 +50,7 @@ const ChatBottom: React.FC<Props> = ({ orderId, setAudit, audit, createJsonFile
|
|||||||
enterNextDelay={2000}
|
enterNextDelay={2000}
|
||||||
title={t('Save full log as a JSON file (messages and credentials)')}
|
title={t('Save full log as a JSON file (messages and credentials)')}
|
||||||
>
|
>
|
||||||
<Button
|
<Button size='small' color='primary' variant='outlined' onClick={onPGPClick}>
|
||||||
size='small'
|
|
||||||
color='primary'
|
|
||||||
variant='outlined'
|
|
||||||
onClick={() => saveAsJson('complete_log_chat_' + orderId + '.json', createJsonFile())}
|
|
||||||
>
|
|
||||||
<div style={{ width: '1.4em', height: '1.4em' }}>
|
<div style={{ width: '1.4em', height: '1.4em' }}>
|
||||||
<ExportIcon sx={{ width: '0.8em', height: '0.8em' }} />
|
<ExportIcon sx={{ width: '0.8em', height: '0.8em' }} />
|
||||||
</div>{' '}
|
</div>{' '}
|
||||||
|
Loading…
Reference in New Issue
Block a user