mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
Fix navbar refactor bugs on native app
This commit is contained in:
parent
5c42b5da71
commit
c9749bde24
@ -65,13 +65,11 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
|
||||
const theme = useTheme();
|
||||
const history = useHistory();
|
||||
|
||||
const Router = window.NativeRobosats != null ? HashRouter : BrowserRouter;
|
||||
const basename = window.NativeRobosats != null ? window.location.pathname : '';
|
||||
const [page, setPage] = useState<Page>(
|
||||
window.location.pathname.split('/')[1] == ''
|
||||
? 'offers'
|
||||
: window.location.pathname.split('/')[1],
|
||||
);
|
||||
const Router = window.NativeRobosats === undefined ? BrowserRouter : HashRouter;
|
||||
const basename = window.NativeRobosats === undefined ? '' : window.location.pathname;
|
||||
const entryPage: Page | '' =
|
||||
window.NativeRobosats === undefined ? window.location.pathname.split('/')[1] : '';
|
||||
const [page, setPage] = useState<Page>(entryPage == '' ? 'offers' : entryPage);
|
||||
const [slideDirection, setSlideDirection] = useState<SlideDirection>({
|
||||
in: undefined,
|
||||
out: undefined,
|
||||
@ -166,7 +164,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
|
||||
? data.active_order_id
|
||||
: data.last_order_id
|
||||
? data.last_order_id
|
||||
: order,
|
||||
: null,
|
||||
);
|
||||
setRobot({
|
||||
...robot,
|
||||
|
@ -42,10 +42,7 @@ class UserGenPage extends Component {
|
||||
// Displays the existing one
|
||||
if (this.props.robot.nickname != null) {
|
||||
this.setState({ inputToken: this.props.robot.token });
|
||||
} else if (
|
||||
this.props.robot.token ||
|
||||
(window.NativeRobosats && systemClient.getCookie('robot_token'))
|
||||
) {
|
||||
} else if (this.props.robot.token) {
|
||||
this.setState({ inputToken: this.props.robot.token });
|
||||
this.getGeneratedUser(this.props.robot.token);
|
||||
} else {
|
||||
@ -117,10 +114,13 @@ class UserGenPage extends Component {
|
||||
pub_key: data.public_key,
|
||||
enc_priv_key: data.encrypted_private_key,
|
||||
copiedToken: data.found ? true : this.props.robot.copiedToken,
|
||||
});
|
||||
systemClient.setCookie('robot_token', token);
|
||||
systemClient.setCookie('pub_key', data.public_key.split('\n').join('\\'));
|
||||
systemClient.setCookie('enc_priv_key', data.encrypted_private_key.split('\n').join('\\'));
|
||||
}) &
|
||||
systemClient.setCookie('robot_token', token) &
|
||||
systemClient.setCookie('pub_key', data.public_key.split('\n').join('\\')) &
|
||||
systemClient.setCookie(
|
||||
'enc_priv_key',
|
||||
data.encrypted_private_key.split('\n').join('\\'),
|
||||
);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
@ -520,4 +520,4 @@ const EncryptedChat: React.FC<Props> = ({ orderId, userNick }: Props): JSX.Eleme
|
||||
);
|
||||
};
|
||||
|
||||
export default EncryptedChat;
|
||||
export default EncryptedChat;
|
||||
|
@ -20,11 +20,14 @@ export interface Robot {
|
||||
copiedToken: boolean;
|
||||
}
|
||||
|
||||
const pubKeyCookie = systemClient.getCookie('pub_key');
|
||||
const privKeyCookie = systemClient.getCookie('enc_priv_key');
|
||||
|
||||
export const defaultRobot: Robot = {
|
||||
nickname: null,
|
||||
token: systemClient.getCookie('robot_token') ?? null,
|
||||
pub_key: systemClient.getCookie('pub_key').split('\\').join('\n'),
|
||||
enc_priv_key: systemClient.getCookie('enc_priv_key').split('\\').join('\n'),
|
||||
pub_key: pubKeyCookie ? pubKeyCookie.split('\\').join('\n') : null,
|
||||
enc_priv_key: privKeyCookie ? privKeyCookie.split('\\').join('\n') : null,
|
||||
bitsEntropy: null,
|
||||
shannonEntropy: null,
|
||||
stealthInvoices: true,
|
||||
|
Loading…
Reference in New Issue
Block a user