diff --git a/frontend/src/components/Robots/RobotAvatar/index.tsx b/frontend/src/components/Robots/RobotAvatar/index.tsx index 4be6e900..a4822aac 100644 --- a/frontend/src/components/Robots/RobotAvatar/index.tsx +++ b/frontend/src/components/Robots/RobotAvatar/index.tsx @@ -15,6 +15,7 @@ interface Props { statusColor?: 'primary' | 'secondary' | 'default' | 'error' | 'info' | 'success' | 'warning'; orderType?: number; tooltip?: string; + tooltipPosition?: string; avatarClass?: string; onLoad?: () => void; } @@ -24,6 +25,7 @@ const RobotAvatar: React.FC = ({ orderType, statusColor, tooltip, + tooltipPosition = 'right', smooth = false, flipHorizontally = false, style = {}, @@ -124,7 +126,7 @@ const RobotAvatar: React.FC = ({ }; return tooltip ? ( - + {getAvatarWithBadges()} ) : ( diff --git a/frontend/src/components/UserGenPage.js b/frontend/src/components/UserGenPage.js index 187f0876..33f75393 100644 --- a/frontend/src/components/UserGenPage.js +++ b/frontend/src/components/UserGenPage.js @@ -51,8 +51,8 @@ class UserGenPage extends Component { }); } else if (window.NativeRobosats && systemClient.getCookie('robot_token')) { const token = systemClient.getCookie('robot_token'); - this.props.setAppState({ token }); - this.setState({ token, loadingRobot: false }); + this.setState({ token }); + this.getGeneratedUser(token); } else { const newToken = genBase62Token(36); this.setState({ @@ -245,6 +245,7 @@ class UserGenPage extends Component { width: `${201 * fontSizeFactor}px`, }} tooltip={t('This is your trading avatar')} + tooltipPosition='up' />
diff --git a/frontend/src/models/index.ts b/frontend/src/models/index.ts index bbc7a87c..efa8b176 100644 --- a/frontend/src/models/index.ts +++ b/frontend/src/models/index.ts @@ -1,5 +1,5 @@ -export { default as LimitList } from './Limit.model'; -export { Limit } from './Limit.model'; -export { default as Maker } from './Maker.model'; -export { defaultMaker as defaultMaker } from './Maker.model'; -export { default as Order } from './Order.model'; +export type { LimitList } from './Limit.model'; +export type { Limit } from './Limit.model'; +export type { Maker } from './Maker.model'; +export { defaultMaker } from './Maker.model'; +export type { Order } from './Order.model'; diff --git a/frontend/src/services/api/ApiNativeClient/index.ts b/frontend/src/services/api/ApiNativeClient/index.ts index 5c05cb37..f772876e 100644 --- a/frontend/src/services/api/ApiNativeClient/index.ts +++ b/frontend/src/services/api/ApiNativeClient/index.ts @@ -1,6 +1,5 @@ import { ApiClient } from '../api'; import { systemClient } from '../../System'; -import NativeRobosats from '../../Native'; class ApiNativeClient implements ApiClient { private assetsCache: { [path: string]: string } = {}; @@ -11,9 +10,9 @@ class ApiNativeClient implements ApiClient { 'Content-Type': 'application/json', }; - const sessionid = systemClient.getCookie('sessionid'); - if (sessionid) { - const robotToken = systemClient.getCookie('robot_token'); + const robotToken = systemClient.getCookie('robot_token'); + if (robotToken) { + const sessionid = systemClient.getCookie('sessionid'); const csrftoken = systemClient.getCookie('csrftoken'); const pubKey = systemClient.getCookie('pub_key'); diff --git a/mobile/App.tsx b/mobile/App.tsx index 61ddcd9b..e22dae38 100644 --- a/mobile/App.tsx +++ b/mobile/App.tsx @@ -37,9 +37,9 @@ const App = () => { }); }; - loadCookie('sessionid'); + EncryptedStorage.removeItem('sessionid'); + EncryptedStorage.removeItem('csrftoken'); loadCookie('robot_token'); - loadCookie('csrftoken'); loadCookie('pub_key'); loadCookie('enc_priv_key').then(() => injectMessageResolve(reponseId)); }; @@ -113,7 +113,14 @@ const App = () => { if (state.isInternetReachable) { try { daemonStatus = await torClient.daemon.getDaemonStatus(); - } catch {} + if (daemonStatus === 'NOTINIT') { + await torClient.reset(); + return sendTorStatus(); + } + } catch { + await torClient.reset(); + return sendTorStatus(); + } } injectMessage({ diff --git a/mobile/services/Tor/index.ts b/mobile/services/Tor/index.ts index 56643b91..dff620be 100644 --- a/mobile/services/Tor/index.ts +++ b/mobile/services/Tor/index.ts @@ -20,6 +20,12 @@ class TorClient { } }; + public reset: () => void = async () => { + console.log('Reset TOR'); + await this.daemon.stopIfRunning(); + await this.daemon.startIfNotStarted(); + }; + public get: (path: string, headers: object) => Promise = async (path, headers) => { return await new Promise(async (resolve, reject) => { try {