Android fixed turtle mode (#323)

This commit is contained in:
KoalaSat 2022-11-15 09:27:39 +00:00 committed by GitHub
parent 84997de94f
commit 9f66221273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 33 deletions

View File

@ -169,9 +169,13 @@ const EncryptedTurtleChat: React.FC<Props> = ({
apiClient apiClient
.post(baseUrl, `/api/chat`, { .post(baseUrl, `/api/chat`, {
PGP_message: value, PGP_message: value,
offset: lastIndex
}) })
.then((response) => { .then((response) => {
if (response) onMessage(response as ServerMessage); if (response) {
setPeerConnected(response.peer_connected);
setServerMessages(response.messages);
}
}) })
.finally(() => { .finally(() => {
setWaitingEcho(false); setWaitingEcho(false);
@ -188,9 +192,13 @@ const EncryptedTurtleChat: React.FC<Props> = ({
.post(baseUrl, `/api/chat/`, { .post(baseUrl, `/api/chat/`, {
PGP_message: encryptedMessage.toString().split('\n').join('\\'), PGP_message: encryptedMessage.toString().split('\n').join('\\'),
order_id: orderId, order_id: orderId,
offset: lastIndex
}) })
.then((response) => { .then((response) => {
if (response) onMessage(response as ServerMessage); if (response) {
setPeerConnected(response.peer_connected);
setServerMessages(response.messages);
}
}) })
.finally(() => { .finally(() => {
setWaitingEcho(false); setWaitingEcho(false);

View File

@ -74,7 +74,7 @@ class TradeBox extends Component {
badInvoice: false, badInvoice: false,
badAddress: false, badAddress: false,
badStatement: false, badStatement: false,
turtleMode: false, turtleMode: window.ReactNativeWebView !== undefined
}; };
} }
@ -1434,38 +1434,40 @@ class TradeBox extends Component {
{/* Make confirmation sound for Chat Open. */} {/* Make confirmation sound for Chat Open. */}
{this.Sound('locked-invoice')} {this.Sound('locked-invoice')}
<Grid item xs={12} align='center'> <Grid item xs={12} align='center'>
<div {window.ReactNativeWebView === undefined ? (
style={{ <div
display: 'flex', style={{
justifyContent: 'flex-end', display: 'flex',
position: 'relative', justifyContent: 'flex-end',
right: '0em', position: 'relative',
top: '0em', right: '0em',
height: '0em', top: '0em',
}} height: '0em',
> }}
<Tooltip
enterTouchDelay={0}
placement='top'
title={t('Activate turtle mode (Use it when the connection is slow)')}
> >
<div <Tooltip
style={{ enterTouchDelay={0}
display: 'flex', placement='top'
width: '4em', title={t('Activate turtle mode (Use it when the connection is slow)')}
height: '1.1em',
}}
> >
<Switch <div
size='small' style={{
disabled={false} display: 'flex',
checked={this.state.turtleMode} width: '4em',
onChange={() => this.setState({ turtleMode: !this.state.turtleMode })} height: '1.1em',
/> }}
<WifiTetheringErrorIcon sx={{ color: 'text.secondary' }} /> >
</div> <Switch
</Tooltip> size='small'
</div> disabled={false}
checked={this.state.turtleMode}
onChange={() => this.setState({ turtleMode: !this.state.turtleMode })}
/>
<WifiTetheringErrorIcon sx={{ color: 'text.secondary' }} />
</div>
</Tooltip>
</div>
) : <></>}
<Typography variant='subtitle1'> <Typography variant='subtitle1'>
<b> <b>
{' '} {' '}