Android minor fixes (#285)

* Android mino fixes

* Avatar tooltip position

* format
This commit is contained in:
KoalaSat 2022-10-15 12:00:21 +00:00 committed by GitHub
parent 57f9b6447d
commit 7c52c90866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 15 deletions

View File

@ -15,6 +15,7 @@ interface Props {
statusColor?: 'primary' | 'secondary' | 'default' | 'error' | 'info' | 'success' | 'warning'; statusColor?: 'primary' | 'secondary' | 'default' | 'error' | 'info' | 'success' | 'warning';
orderType?: number; orderType?: number;
tooltip?: string; tooltip?: string;
tooltipPosition?: string;
avatarClass?: string; avatarClass?: string;
onLoad?: () => void; onLoad?: () => void;
} }
@ -24,6 +25,7 @@ const RobotAvatar: React.FC<Props> = ({
orderType, orderType,
statusColor, statusColor,
tooltip, tooltip,
tooltipPosition = 'right',
smooth = false, smooth = false,
flipHorizontally = false, flipHorizontally = false,
style = {}, style = {},
@ -124,7 +126,7 @@ const RobotAvatar: React.FC<Props> = ({
}; };
return tooltip ? ( return tooltip ? (
<Tooltip placement='right' enterTouchDelay={0} title={tooltip}> <Tooltip placement={tooltipPosition} enterTouchDelay={0} title={tooltip}>
{getAvatarWithBadges()} {getAvatarWithBadges()}
</Tooltip> </Tooltip>
) : ( ) : (

View File

@ -51,8 +51,8 @@ class UserGenPage extends Component {
}); });
} else if (window.NativeRobosats && systemClient.getCookie('robot_token')) { } else if (window.NativeRobosats && systemClient.getCookie('robot_token')) {
const token = systemClient.getCookie('robot_token'); const token = systemClient.getCookie('robot_token');
this.props.setAppState({ token }); this.setState({ token });
this.setState({ token, loadingRobot: false }); this.getGeneratedUser(token);
} else { } else {
const newToken = genBase62Token(36); const newToken = genBase62Token(36);
this.setState({ this.setState({
@ -245,6 +245,7 @@ class UserGenPage extends Component {
width: `${201 * fontSizeFactor}px`, width: `${201 * fontSizeFactor}px`,
}} }}
tooltip={t('This is your trading avatar')} tooltip={t('This is your trading avatar')}
tooltipPosition='up'
/> />
<br /> <br />
</Grid> </Grid>

View File

@ -1,5 +1,5 @@
export { default as LimitList } from './Limit.model'; export type { LimitList } from './Limit.model';
export { Limit } from './Limit.model'; export type { Limit } from './Limit.model';
export { default as Maker } from './Maker.model'; export type { Maker } from './Maker.model';
export { defaultMaker as defaultMaker } from './Maker.model'; export { defaultMaker } from './Maker.model';
export { default as Order } from './Order.model'; export type { Order } from './Order.model';

View File

@ -1,6 +1,5 @@
import { ApiClient } from '../api'; import { ApiClient } from '../api';
import { systemClient } from '../../System'; import { systemClient } from '../../System';
import NativeRobosats from '../../Native';
class ApiNativeClient implements ApiClient { class ApiNativeClient implements ApiClient {
private assetsCache: { [path: string]: string } = {}; private assetsCache: { [path: string]: string } = {};
@ -11,9 +10,9 @@ class ApiNativeClient implements ApiClient {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}; };
const sessionid = systemClient.getCookie('sessionid'); const robotToken = systemClient.getCookie('robot_token');
if (sessionid) { if (robotToken) {
const robotToken = systemClient.getCookie('robot_token'); const sessionid = systemClient.getCookie('sessionid');
const csrftoken = systemClient.getCookie('csrftoken'); const csrftoken = systemClient.getCookie('csrftoken');
const pubKey = systemClient.getCookie('pub_key'); const pubKey = systemClient.getCookie('pub_key');

View File

@ -37,9 +37,9 @@ const App = () => {
}); });
}; };
loadCookie('sessionid'); EncryptedStorage.removeItem('sessionid');
EncryptedStorage.removeItem('csrftoken');
loadCookie('robot_token'); loadCookie('robot_token');
loadCookie('csrftoken');
loadCookie('pub_key'); loadCookie('pub_key');
loadCookie('enc_priv_key').then(() => injectMessageResolve(reponseId)); loadCookie('enc_priv_key').then(() => injectMessageResolve(reponseId));
}; };
@ -113,7 +113,14 @@ const App = () => {
if (state.isInternetReachable) { if (state.isInternetReachable) {
try { try {
daemonStatus = await torClient.daemon.getDaemonStatus(); daemonStatus = await torClient.daemon.getDaemonStatus();
} catch {} if (daemonStatus === 'NOTINIT') {
await torClient.reset();
return sendTorStatus();
}
} catch {
await torClient.reset();
return sendTorStatus();
}
} }
injectMessage({ injectMessage({

View File

@ -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<object> = async (path, headers) => { public get: (path: string, headers: object) => Promise<object> = async (path, headers) => {
return await new Promise<object>(async (resolve, reject) => { return await new Promise<object>(async (resolve, reject) => {
try { try {