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

View File

@ -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'
/>
<br />
</Grid>

View File

@ -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';

View File

@ -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');

View File

@ -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({

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) => {
return await new Promise<object>(async (resolve, reject) => {
try {