Skip to content

Commit

Permalink
fix macosx icon
Browse files Browse the repository at this point in the history
fix qrcode scanner for desktop
show error when can not create wallet
  • Loading branch information
minotaur committed Feb 24, 2022
1 parent 6cdacc4 commit 743d811
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
Binary file added electron/assets/appIcon.icns
Binary file not shown.
5 changes: 3 additions & 2 deletions electron/electron-builder.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
},
"mac": {
"category": "your.app.category.type",
"target": "dmg"
"target": "dmg",
"icon": "assets/appIcon.icns"
},
"linux": {
"target": "AppImage",
"target": "AppImage"
}
}
4 changes: 2 additions & 2 deletions electron/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ if (electronIsDev) {
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
// if (process.platform !== 'darwin') {
app.quit();
}
// }
});

// When the dock icon is clicked.
Expand Down
8 changes: 4 additions & 4 deletions electron/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ export class ElectronCapacitorApp {
this.MainWindow.show();
}
setTimeout(() => {
if (electronIsDev) {
// if (electronIsDev) {
this.MainWindow.webContents.openDevTools();
}
// }
CapElectronEventEmitter.emit('CAPELECTRON_DeeplinkListenerInitialized', '');
}, 400);
});
Expand All @@ -229,8 +229,8 @@ export function setupContentSecurityPolicy(customScheme: string): void {
...details.responseHeaders,
'Content-Security-Policy': [
electronIsDev
? `default-src ${customScheme}://* 'unsafe-inline' devtools://* 'unsafe-eval' data:; connect-src http: https: ${customScheme}://* 'unsafe-inline' devtools://*`
: `default-src ${customScheme}://* 'unsafe-inline' data:; connect-src http: https: ${customScheme}://* 'unsafe-inline'; script-src 'self' 'unsafe-eval' 'unsafe-inline'`,
? `default-src ${customScheme}://* 'unsafe-inline' devtools://* 'unsafe-eval' data:; connect-src http: https: ${customScheme}://* 'unsafe-inline' devtools://* blob:`
: `default-src ${customScheme}://* 'unsafe-inline' data:; connect-src http: https: ${customScheme}://* 'unsafe-inline'; script-src 'self' 'unsafe-eval' 'unsafe-inline' blob:`,
],
},
});
Expand Down
7 changes: 4 additions & 3 deletions src/api/qrcode/QrCodeReader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ interface PropsType {


const QrCodeReader = (props: PropsType) => {
if (Capacitor.getPlatform() === "web") {
return <QrCodeReaderWeb handleScan={props.success} handleError={props.fail} />;
const platform = Capacitor.getPlatform()
if (platform === "android" || platform === "ios") {
return <QrCodeReaderCapacitor handleScan={props.success} handleError={props.fail} />;
}
return <QrCodeReaderCapacitor handleScan={props.success} handleError={props.fail} />;
return <QrCodeReaderWeb handleScan={props.success} handleError={props.fail} />;
};

export default QrCodeReader;
3 changes: 3 additions & 0 deletions src/api/wallet-add/WalletCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import WalletName from "./WalletName";
import WalletTypeSelect from "./elements/WalletTypeSelect";
import { NETWORK_TYPES } from "../../config/network_type";
import WalletPassword from "./WalletPassword";
import { show_notification } from "../../utils/utils";

interface PropsType extends RouteComponentProps {
back: () => any;
Expand Down Expand Up @@ -71,6 +72,8 @@ class WalletCreate extends React.Component<PropsType, StateType> {
).then(() => {
this.props.history.goBack();
this.setState({ saving: false });
}).catch(exp => {
show_notification(exp)
});
}
};
Expand Down
3 changes: 3 additions & 0 deletions src/api/wallet-add/readonly/ReadOnlyWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import WalletName from "../WalletName";
import { withRouter } from "react-router-dom";
import ReadOnlyWalletAddress from "./ReadOnlyWalletAddress";
import * as walletActions from '../../../action/wallet';
import { show_notification } from "../../../utils/utils";

class ReadOnlyWallet extends WalletCreate {
steps = [
Expand Down Expand Up @@ -32,6 +33,8 @@ class ReadOnlyWallet extends WalletCreate {
walletActions.createReadOnlyWallet(this.state.name, this.state.mnemonic, this.state.network_type).then(() => {
this.props.history.goBack();
this.setState({ saving: false });
}).catch(exp => {
show_notification(exp)
});
}
};
Expand Down

0 comments on commit 743d811

Please sign in to comment.