Skip to content

Commit

Permalink
fix: server & chain fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
juanky201271 committed Aug 16, 2023
1 parent 9e310e8 commit c75ae70
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 28 deletions.
48 changes: 24 additions & 24 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ class MenuBuilder {
mainWindow.webContents.send("seed");
},
},
{
label: "&Import Private Keys",
click: () => {
mainWindow.webContents.send("import");
},
},
{
label: "&Export All Private Keys",
click: () => {
mainWindow.webContents.send("exportall");
},
},
//{
// label: "&Import Private Keys",
// click: () => {
// mainWindow.webContents.send("import");
// },
//},
//{
// label: "&Export All Private Keys",
// click: () => {
// mainWindow.webContents.send("exportall");
// },
//},
{ type: "separator" },
{
label: "&Pay URI",
Expand Down Expand Up @@ -184,18 +184,18 @@ class MenuBuilder {
mainWindow.webContents.send("seed");
},
},
{
label: "&Import Private Keys",
click: () => {
mainWindow.webContents.send("import");
},
},
{
label: "&Export All Private Keys",
click: () => {
mainWindow.webContents.send("exportall");
},
},
//{
// label: "&Import Private Keys",
// click: () => {
// mainWindow.webContents.send("import");
// },
//},
//{
// label: "&Export All Private Keys",
// click: () => {
// mainWindow.webContents.send("exportall");
// },
//},
{ type: "separator" },
{
label: "&Pay URI",
Expand Down
23 changes: 21 additions & 2 deletions src/components/loadingscreen/LoadingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,27 @@ class LoadingScreen extends Component<LoadingScreenProps & RouteComponentProps,
loadServer = async () => {
// Try to read the default server
const settings = await ipcRenderer.invoke("loadSettings");
let server = settings?.serveruri || Utils.ZCASH_COMMUNITY;
let chain_name: 'main' | 'test' | 'regtest' = settings?.serverchain_name || 'main';
console.log(settings);
let server: string, chain_name: 'main' | 'test' | 'regtest';
if (!settings) {
server = Utils.ZCASH_COMMUNITY;
chain_name = 'main';
await ipcRenderer.invoke("saveSettings", { key: "serveruri", value: server });
await ipcRenderer.invoke("saveSettings", { key: "serverchain_name", value: chain_name });
} else {
if (!settings.serveruri) {
server = Utils.ZCASH_COMMUNITY;
await ipcRenderer.invoke("saveSettings", { key: "serveruri", value: server });
} else {
server = settings.serveruri;
}
if (!settings.serverchain_name) {
chain_name = 'main';
await ipcRenderer.invoke("saveSettings", { key: "serverchain_name", value: chain_name });
} else {
chain_name = settings.serverchain_name;
}
}

const newstate = new LoadingScreenState();
Object.assign(newstate, this.state);
Expand Down
5 changes: 3 additions & 2 deletions src/components/serverselectmodal/ServerSelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export default function ServerSelectModal({ closeModal, openErrorModal }: ModalP
useEffect(() => {
(async () => {
const settings = await ipcRenderer.invoke("loadSettings");
const currServer: string = settings?.serveruri || "";
const currChain: 'main' | 'test' | 'regtest' | '' = settings?.serverchain_name || "";
console.log(settings);
const currServer: string = settings?.serveruri || Utils.ZCASH_COMMUNITY;
const currChain: 'main' | 'test' | 'regtest' | '' = settings?.serverchain_name || "main";
initialServerValue(currServer, currChain);
setServer(currServer);
setChain(currChain);
Expand Down

0 comments on commit c75ae70

Please sign in to comment.