mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-05 14:00:09 +00:00
Fix Robot token not loading to android (#313)
* Fix Robot token not loading to android * Redo Maker
This commit is contained in:
parent
3d4908c43c
commit
5ae1f8ca18
4
frontend/package-lock.json
generated
4
frontend/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
||||||
|
@ -20,7 +20,6 @@ import {
|
|||||||
Settings,
|
Settings,
|
||||||
Favorites,
|
Favorites,
|
||||||
defaultMaker,
|
defaultMaker,
|
||||||
defaultRobot,
|
|
||||||
defaultInfo,
|
defaultInfo,
|
||||||
Coordinator,
|
Coordinator,
|
||||||
} from '../models';
|
} from '../models';
|
||||||
@ -56,7 +55,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
|
|||||||
list: [],
|
list: [],
|
||||||
loading: true,
|
loading: true,
|
||||||
});
|
});
|
||||||
const [robot, setRobot] = useState<Robot>(defaultRobot);
|
const [robot, setRobot] = useState<Robot>(new Robot());
|
||||||
const [maker, setMaker] = useState<Maker>(defaultMaker);
|
const [maker, setMaker] = useState<Maker>(defaultMaker);
|
||||||
const [info, setInfo] = useState<Info>(defaultInfo);
|
const [info, setInfo] = useState<Info>(defaultInfo);
|
||||||
const [coordinators, setCoordinators] = useState<Coordinator[]>(defaultCoordinators);
|
const [coordinators, setCoordinators] = useState<Coordinator[]>(defaultCoordinators);
|
||||||
|
@ -1,46 +1,29 @@
|
|||||||
import { systemClient } from '../services/System';
|
import { systemClient } from '../services/System';
|
||||||
|
|
||||||
export interface Robot {
|
class Robot {
|
||||||
nickname: string | null;
|
constructor() {
|
||||||
token: string | null;
|
this.token = systemClient.getCookie('robot_token') ?? undefined;
|
||||||
pubKey: string | null;
|
this.pubKey = systemClient.getCookie('pub_key') ?? undefined;
|
||||||
encPrivKey: string | null;
|
this.encPrivKey = systemClient.getCookie('enc_priv_key') ?? undefined;
|
||||||
bitsEntropy: number | null;
|
}
|
||||||
shannonEntropy: number | null;
|
|
||||||
stealthInvoices: boolean;
|
public nickname?: string;
|
||||||
activeOrderId: number | null;
|
public token?: string;
|
||||||
lastOrderId: number | null;
|
public pubKey?: string;
|
||||||
earnedRewards: number;
|
public encPrivKey?: string;
|
||||||
referralCode: string;
|
public bitsEntropy?: number;
|
||||||
tgEnabled: boolean;
|
public shannonEntropy?: number;
|
||||||
tgBotName: string;
|
public stealthInvoices: boolean = true;
|
||||||
tgToken: string;
|
public activeOrderId?: number;
|
||||||
loading: boolean;
|
public lastOrderId?: number;
|
||||||
avatarLoaded: boolean;
|
public earnedRewards: number = 0;
|
||||||
copiedToken: boolean;
|
public referralCode: string = '';
|
||||||
|
public tgEnabled: boolean = false;
|
||||||
|
public tgBotName: string = 'unknown';
|
||||||
|
public tgToken: string = 'unknown';
|
||||||
|
public loading: boolean = false;
|
||||||
|
public avatarLoaded: boolean = false;
|
||||||
|
public copiedToken: boolean = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
|
||||||
pubKey: pubKeyCookie ? pubKeyCookie.split('\\').join('\n') : null,
|
|
||||||
encPrivKey: privKeyCookie ? privKeyCookie.split('\\').join('\n') : null,
|
|
||||||
bitsEntropy: null,
|
|
||||||
shannonEntropy: null,
|
|
||||||
stealthInvoices: true,
|
|
||||||
activeOrderId: null,
|
|
||||||
lastOrderId: null,
|
|
||||||
earnedRewards: 0,
|
|
||||||
referralCode: '',
|
|
||||||
tgEnabled: false,
|
|
||||||
tgBotName: 'unknown',
|
|
||||||
tgToken: 'unknown',
|
|
||||||
loading: false,
|
|
||||||
avatarLoaded: false,
|
|
||||||
copiedToken: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Robot;
|
export default Robot;
|
||||||
|
@ -36,7 +36,8 @@ export const baseSettings: Settings = {
|
|||||||
? 'dark'
|
? 'dark'
|
||||||
: 'light',
|
: 'light',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
language: i18n.resolvedLanguage == null ? 'en' : i18n.resolvedLanguage.substring(0, 2),
|
language:
|
||||||
|
i18n.resolvedLanguage == null ? 'en' : (i18n.resolvedLanguage.substring(0, 2) as Language),
|
||||||
freezeViewports: false,
|
freezeViewports: false,
|
||||||
network: undefined,
|
network: undefined,
|
||||||
coordinator: undefined,
|
coordinator: undefined,
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
|
import Robot from './Robot.model';
|
||||||
|
|
||||||
export type { LimitList } from './Limit.model';
|
export type { LimitList } from './Limit.model';
|
||||||
export type { Limit } from './Limit.model';
|
export type { Limit } from './Limit.model';
|
||||||
export type { Maker } from './Maker.model';
|
|
||||||
export type { Order } from './Book.model';
|
export type { Order } from './Book.model';
|
||||||
export type { Book } from './Book.model';
|
export type { Book } from './Book.model';
|
||||||
export type { Robot } from './Robot.model';
|
|
||||||
export type { Info } from './Info.model';
|
export type { Info } from './Info.model';
|
||||||
export type { Settings } from './Settings.model';
|
export type { Settings } from './Settings.model';
|
||||||
export type { Language } from './Settings.model';
|
export type { Language } from './Settings.model';
|
||||||
export type { Favorites } from './Favorites.model';
|
export type { Favorites } from './Favorites.model';
|
||||||
export type { Coordinator } from './Coordinator.model';
|
export type { Coordinator } from './Coordinator.model';
|
||||||
|
export type { Maker } from './Maker.model';
|
||||||
|
export { Robot };
|
||||||
|
|
||||||
export { defaultMaker } from './Maker.model';
|
export { defaultMaker } from './Maker.model';
|
||||||
export { defaultRobot } from './Robot.model';
|
|
||||||
export { defaultSettings } from './Settings.default.basic';
|
export { defaultSettings } from './Settings.default.basic';
|
||||||
export { defaultInfo } from './Info.model';
|
export { defaultInfo } from './Info.model';
|
||||||
|
@ -13,7 +13,6 @@ import {
|
|||||||
Settings,
|
Settings,
|
||||||
Favorites,
|
Favorites,
|
||||||
defaultMaker,
|
defaultMaker,
|
||||||
defaultRobot,
|
|
||||||
defaultInfo,
|
defaultInfo,
|
||||||
} from '../models';
|
} from '../models';
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
|
|||||||
list: [],
|
list: [],
|
||||||
loading: true,
|
loading: true,
|
||||||
});
|
});
|
||||||
const [robot, setRobot] = useState<Robot>(defaultRobot);
|
const [robot, setRobot] = useState<Robot>(new Robot());
|
||||||
const [maker, setMaker] = useState<Maker>(defaultMaker);
|
const [maker, setMaker] = useState<Maker>(defaultMaker);
|
||||||
const [info, setInfo] = useState<Info>(defaultInfo);
|
const [info, setInfo] = useState<Info>(defaultInfo);
|
||||||
const [fav, setFav] = useState<Favorites>({ type: null, currency: 0 });
|
const [fav, setFav] = useState<Favorites>({ type: null, currency: 0 });
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { systemClient } from '../System';
|
|
||||||
import { NativeRobosatsPromise, NativeWebViewMessage, NativeWebViewMessageSystem } from './index.d';
|
import { NativeRobosatsPromise, NativeWebViewMessage, NativeWebViewMessageSystem } from './index.d';
|
||||||
|
|
||||||
class NativeRobosats {
|
class NativeRobosats {
|
||||||
|
4
mobile/package-lock.json
generated
4
mobile/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "robosats",
|
"name": "robosats",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "robosats",
|
"name": "robosats",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native-clipboard/clipboard": "^1.11.1",
|
"@react-native-clipboard/clipboard": "^1.11.1",
|
||||||
"@react-native-community/netinfo": "^9.3.4",
|
"@react-native-community/netinfo": "^9.3.4",
|
||||||
|
Loading…
Reference in New Issue
Block a user