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