Skip to content

Commit

Permalink
[DDW-414] Converting to plain JS Objects any argument passed via ipc
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmain committed Jun 8, 2021
2 parents 2f2efcb + cc75088 commit f284458
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 26 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Expand Up @@ -15,6 +15,7 @@
<PROJECT_ROOT>/state-cluster/.*
<PROJECT_ROOT>/utils/js-launcher/.*
<PROJECT_ROOT>/tests-report/.*
<PROJECT_ROOT>/node_modules/.cache

[include]

Expand Down
12 changes: 2 additions & 10 deletions source/renderer/app/components/widgets/forms/FileUploadWidget.js
Expand Up @@ -6,6 +6,7 @@ import path from 'path';
import { showOpenDialogChannel } from '../../../ipc/show-file-dialog-channels';
import attachIcon from '../../../assets/images/attach-ic.inline.svg';
import styles from './FileUploadWidget.scss';
import type { FileDialogRequestParams } from '../../../../../common/types/file-dialog.types';

type Props = {
label: string,
Expand All @@ -15,19 +16,10 @@ type Props = {
acceptedFileTypes: Array<string>,
};

type openDialogChannelFilterType = {
name: string,
extensions: string[],
};
type openDialogChannelType = {
defaultPath: string,
filters: openDialogChannelFilterType[],
};

@observer
export default class FileUploadWidget extends Component<Props> {
onOpen = async () => {
const params: openDialogChannelType = {
const params: FileDialogRequestParams = {
filters: [
{
name: 'file-upload',
Expand Down
2 changes: 1 addition & 1 deletion source/renderer/app/containers/wallet/WalletReceivePage.js
Expand Up @@ -95,7 +95,7 @@ export default class WalletReceivePage extends Component<Props, State> {
this.props.actions.walletSettings.toggleShowUsedAddresses.trigger();
};

getAddressAndFilepath = async (fileExtension: ?string = 'pdf') => {
getAddressAndFilepath = async (fileExtension: string = 'pdf') => {
const { addressToShare } = this.state;
const { activeWallet } = this;
const { intl } = this.context;
Expand Down
Expand Up @@ -7,19 +7,10 @@ import { showSaveDialogChannel } from '../../../../ipc/show-file-dialog-channels
import InstructionsDialog from '../../../../components/wallet/paper-wallet-certificate/InstructionsDialog';
import type { InjectedDialogContainerProps } from '../../../../types/injectedPropsType';
import { generateFileNameWithTimestamp } from '../../../../../../common/utils/files';
import type { FileDialogRequestParams } from '../../../../../../common/types/file-dialog.types';

type Props = InjectedDialogContainerProps;

type pdfType = 'pdf';
type saveDialogChannelFilterType = {
name: string,
extensions: pdfType[],
};
type saveDialogChannelType = {
defaultPath: string,
filters: saveDialogChannelFilterType[],
};

@inject('stores', 'actions')
@observer
export default class InstructionsDialogContainer extends Component<Props> {
Expand Down Expand Up @@ -48,7 +39,7 @@ export default class InstructionsDialogContainer extends Component<Props> {
});
const { desktopDirectoryPath } = this.props.stores.profile;
const defaultPath: string = path.join(desktopDirectoryPath, `${name}.pdf`);
const params: saveDialogChannelType = {
const params: FileDialogRequestParams = {
defaultPath,
filters: [
{
Expand Down
2 changes: 1 addition & 1 deletion source/renderer/app/stores/WalletMigrationStore.js
Expand Up @@ -511,7 +511,7 @@ export default class WalletMigrationStore extends Store {
}

@computed get exportedWalletsData(): Array<ExportedWalletData> {
return this.exportedWallets.map((wallet: ExportedWalletData) => ({
return this.exportedWallets.map((wallet) => ({
id: wallet.id,
name: wallet.name,
hasPassword: !wallet.isEmptyPassphrase,
Expand Down
8 changes: 5 additions & 3 deletions yarn2nix.nix
Expand Up @@ -32,14 +32,16 @@ let
};
newPackagePath = builtins.toFile "package.json" (builtins.toJSON newPackage);
windowsElectronVersion = "13.1.0";
electronPath = "https://github.com/electron/electron/releases/download/v${windowsElectronVersion}";
windowsElectron = fetchurl {
url = "https://github.com/electron/electron/releases/download/v${windowsElectronVersion}/electron-v${windowsElectronVersion}-win32-x64.zip";
url = "${electronPath}/electron-v${windowsElectronVersion}-win32-x64.zip";
sha256 = "dea5e784471828dedb294801f0d35a11459b2a940b6b60ed80c2c19eccd4d8f2";
};
electronPathHash = builtins.hashString "sha256" electronPath;
electron-cache = runCommand "electron-cache" {} ''
# newer style
mkdir -p $out/1b59b9d597244fba44a70d503e66a7c53bd89d9f254d93edc3be03fd366152ac/
ln -sv ${windowsElectron} $out/1b59b9d597244fba44a70d503e66a7c53bd89d9f254d93edc3be03fd366152ac/electron-v${windowsElectronVersion}-win32-x64.zip
mkdir -p $out/${electronPathHash}/
ln -sv ${windowsElectron} $out/${electronPathHash}/electron-v${windowsElectronVersion}-win32-x64.zip
'';
electron-gyp = fetchurl {
url = "https://www.electronjs.org/headers/v13.1.0/node-v13.1.0-headers.tar.gz";
Expand Down

0 comments on commit f284458

Please sign in to comment.