diff --git a/frontend/src/components/App.js b/frontend/src/components/App.js
index 7da43b3e..853cbbc9 100644
--- a/frontend/src/components/App.js
+++ b/frontend/src/components/App.js
@@ -5,6 +5,7 @@ import { CssBaseline, IconButton, Link } from '@mui/material';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import UnsafeAlert from './UnsafeAlert';
import { LearnDialog } from './Dialogs';
+import TorConnection from './TorConnection';
import { I18nextProvider } from 'react-i18next';
import i18n from './i18n';
@@ -16,6 +17,7 @@ import SchoolIcon from '@mui/icons-material/School';
import ZoomOutIcon from '@mui/icons-material/ZoomOut';
import ZoomInIcon from '@mui/icons-material/ZoomIn';
import SettingsIcon from '@mui/icons-material/Settings';
+import { systemClient } from '../services/System';
export default class App extends Component {
constructor(props) {
@@ -102,6 +104,7 @@ export default class App extends Component {
open={this.state.openLearn}
onClose={() => this.setState({ openLearn: false })}
/>
+
- await copyToClipboard(props.value)}>
+ systemClient.copyToClipboard(props.value)}>
diff --git a/frontend/src/components/Dialogs/Profile.tsx b/frontend/src/components/Dialogs/Profile.tsx
index 0d75dd07..95a57aa3 100644
--- a/frontend/src/components/Dialogs/Profile.tsx
+++ b/frontend/src/components/Dialogs/Profile.tsx
@@ -37,7 +37,7 @@ import EmojiEventsIcon from '@mui/icons-material/EmojiEvents';
import { UserNinjaIcon, BitcoinIcon } from '../Icons';
import { getCookie } from '../../utils/cookies';
-import { copyToClipboard } from '../../utils/clipboard';
+import { systemClient } from '../../services/System';
import { getWebln } from '../../utils/webln';
import RobotAvatar from '../Robots/RobotAvatar';
@@ -101,13 +101,13 @@ const ProfileDialog = ({
const robotToken = getCookie('robot_token');
if (robotToken) {
- copyToClipboard(robotToken);
+ systemClient.copyToClipboard(robotToken);
setAppState({ copiedToken: true });
}
};
const copyReferralCodeHandler = () => {
- copyToClipboard(`http://${host}/ref/${referralCode}`);
+ systemClient.copyToClipboard(`http://${host}/ref/${referralCode}`);
};
const handleWeblnInvoiceClicked = async (e: any) => {
diff --git a/frontend/src/components/EncryptedChat.js b/frontend/src/components/EncryptedChat.js
index 675f49d0..c1e53d18 100644
--- a/frontend/src/components/EncryptedChat.js
+++ b/frontend/src/components/EncryptedChat.js
@@ -18,9 +18,9 @@ import ReconnectingWebSocket from 'reconnecting-websocket';
import { encryptMessage, decryptMessage } from '../utils/pgp';
import { getCookie } from '../utils/cookies';
import { saveAsJson } from '../utils/saveFile';
-import { copyToClipboard } from '../utils/clipboard';
import { AuditPGPDialog } from './Dialogs';
import RobotAvatar from './Robots/RobotAvatar';
+import { systemClient } from '../services/System';
// Icons
import CheckIcon from '@mui/icons-material/Check';
@@ -336,7 +336,7 @@ class Chat extends Component {
- copyToClipboard(
+ systemClient.copyToClipboard(
this.state.showPGP[props.index]
? props.message.encryptedMessage
: props.message.plainTextMessage,
diff --git a/frontend/src/components/Icons/Tor.tsx b/frontend/src/components/Icons/Tor.tsx
new file mode 100644
index 00000000..42d6a567
--- /dev/null
+++ b/frontend/src/components/Icons/Tor.tsx
@@ -0,0 +1,10 @@
+import React, { Component } from 'react';
+import { SvgIcon } from '@mui/material';
+
+export default function TorIcon(props) {
+ return (
+
+
+
+ );
+}
diff --git a/frontend/src/components/Icons/index.ts b/frontend/src/components/Icons/index.ts
index 984804d7..df1cfa2c 100644
--- a/frontend/src/components/Icons/index.ts
+++ b/frontend/src/components/Icons/index.ts
@@ -14,6 +14,7 @@ export { default as SellSatsIcon } from './SellSats';
export { default as SendReceiveIcon } from './SendReceive';
export { default as ExportIcon } from './Export';
export { default as UserNinjaIcon } from './UserNinja';
+export { default as TorIcon } from './Tor';
// Some Flags missing on react-flags
export { default as BasqueCountryFlag } from './BasqueCountryFlag';
diff --git a/frontend/src/components/MakerPage.js b/frontend/src/components/MakerPage.js
index 4c68d317..ab193882 100644
--- a/frontend/src/components/MakerPage.js
+++ b/frontend/src/components/MakerPage.js
@@ -45,7 +45,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { getCookie } from '../utils/cookies';
import { pn } from '../utils/prettyNumbers';
-import { copyToClipboard } from '../utils/clipboard';
+import { systemClient } from '../services/System';
class MakerPage extends Component {
defaultCurrency = 1;
@@ -924,7 +924,7 @@ class MakerPage extends Component {
open={this.state.openStoreToken}
onClose={() => this.setState({ openStoreToken: false })}
onClickCopy={() =>
- copyToClipboard(getCookie('robot_token')) &
+ systemClient.copyToClipboard(getCookie('robot_token')) &
this.props.setAppState({ copiedToken: true })
}
copyIconColor={this.props.copiedToken ? 'inherit' : 'primary'}
diff --git a/frontend/src/components/OrderPage.js b/frontend/src/components/OrderPage.js
index 75fd0f35..f7a73147 100644
--- a/frontend/src/components/OrderPage.js
+++ b/frontend/src/components/OrderPage.js
@@ -52,7 +52,7 @@ import { SendReceiveIcon } from './Icons';
import { getCookie } from '../utils/cookies';
import { pn } from '../utils/prettyNumbers';
-import { copyToClipboard } from '../utils/clipboard';
+import { systemClient } from '../services/System';
import { getWebln } from '../utils/webln';
import { apiClient } from '../services/api';
import RobotAvatar from './Robots/RobotAvatar';
@@ -527,7 +527,8 @@ class OrderPage extends Component {
open={this.state.openStoreToken}
onClose={() => this.setState({ openStoreToken: false })}
onClickCopy={() =>
- copyToClipboard(getCookie('robot_token')) & this.props.setAppState({ copiedToken: true })
+ systemClient.copyToClipboard(getCookie('robot_token')) &
+ this.props.setAppState({ copiedToken: true })
}
copyIconColor={this.props.copiedToken ? 'inherit' : 'primary'}
onClickBack={() => this.setState({ openStoreToken: false })}
diff --git a/frontend/src/components/TorConnection.tsx b/frontend/src/components/TorConnection.tsx
new file mode 100644
index 00000000..6b0ed2d5
--- /dev/null
+++ b/frontend/src/components/TorConnection.tsx
@@ -0,0 +1,80 @@
+import React, { useEffect, useState } from 'react';
+import { Box, CircularProgress, Tooltip } from '@mui/material';
+import { TorIcon } from './Icons';
+import { useTranslation } from 'react-i18next';
+
+const TorConnection = (): JSX.Element => {
+ const [torStatus, setTorStatus] = useState('NOTINIT');
+ const { t } = useTranslation();
+
+ useEffect(() => {
+ window.addEventListener('torStatus', (event) => {
+ setTorStatus(event?.detail);
+ });
+ }, []);
+
+ if (window?.NativeRobosats && (torStatus === 'NOTINIT' || torStatus === 'STARTING')) {
+ return (
+
+
+
+
+
+
+
+
+ );
+ } else if (window?.NativeRobosats && (torStatus === '"Done"' || torStatus === 'DONE')) {
+ return (
+
+
+
+
+
+ );
+ } else if (true) {
+ return (
+
+
+
+
+
+ );
+ }
+};
+
+export default TorConnection;
diff --git a/frontend/src/components/TradeBox.js b/frontend/src/components/TradeBox.js
index 7c91be18..de378a43 100644
--- a/frontend/src/components/TradeBox.js
+++ b/frontend/src/components/TradeBox.js
@@ -32,7 +32,7 @@ import Countdown, { zeroPad } from 'react-countdown';
import Chat from './EncryptedChat';
import TradeSummary from './TradeSummary';
import MediaQuery from 'react-responsive';
-import { copyToClipboard } from '../utils/clipboard';
+import { systemClient } from '../services/System';
import { apiClient } from '../services/api';
// Icons
@@ -286,7 +286,7 @@ class TradeBox extends Component {
size='small'
color='inherit'
onClick={() => {
- copyToClipboard(this.props.data.bond_invoice);
+ systemClient.copyToClipboard(this.props.data.bond_invoice);
}}
align='center'
>
@@ -420,7 +420,7 @@ class TradeBox extends Component {
size='small'
color='inherit'
onClick={() => {
- copyToClipboard(this.props.data.escrow_invoice);
+ systemClient.copyToClipboard(this.props.data.escrow_invoice);
}}
align='center'
>
@@ -1549,7 +1549,7 @@ class TradeBox extends Component {
{
- copyToClipboard(this.props.data.txid);
+ systemClient.copyToClipboard(this.props.data.txid);
}}
>
diff --git a/frontend/src/components/UserGenPage.js b/frontend/src/components/UserGenPage.js
index 7cf45728..9cc6fcdf 100644
--- a/frontend/src/components/UserGenPage.js
+++ b/frontend/src/components/UserGenPage.js
@@ -26,7 +26,7 @@ import { genBase62Token, tokenStrength } from '../utils/token';
import { genKey } from '../utils/pgp';
import { getCookie, writeCookie, deleteCookie } from '../utils/cookies';
import { saveAsJson } from '../utils/saveFile';
-import { copyToClipboard } from '../utils/clipboard';
+import { systemClient } from '../services/System';
import { apiClient } from '../services/api/index';
import RobotAvatar from './Robots/RobotAvatar';
@@ -321,7 +321,7 @@ class UserGenPage extends Component {
!(getCookie('robot_token') === this.state.token))
}
onClick={() =>
- copyToClipboard(getCookie('robot_token')) &
+ systemClient.copyToClipboard(getCookie('robot_token')) &
this.props.setAppState({ copiedToken: true })
}
>
diff --git a/frontend/src/services/Native/index.d.ts b/frontend/src/services/Native/index.d.ts
index 98a96e5b..48f57049 100644
--- a/frontend/src/services/Native/index.d.ts
+++ b/frontend/src/services/Native/index.d.ts
@@ -20,7 +20,14 @@ export interface NativeWebViewMessageHttp {
body?: object;
}
-export declare type NativeWebViewMessage = NativeWebViewMessageHttp;
+export interface NativeWebViewMessageSystem {
+ id?: number;
+ category: 'system';
+ type: 'torStatus' | 'copyToClipboardString';
+ detail: string;
+}
+
+export declare type NativeWebViewMessage = NativeWebViewMessageHttp | NativeWebViewMessageSystem;
export interface NativeRobosatsPromise {
resolve: (value: object | PromiseLike