Skip to content

Commit

Permalink
Merge pull request #1287 from nos/develop
Browse files Browse the repository at this point in the history
[RELEASE] 0.6.2
  • Loading branch information
Maurice Dalderup authored Jan 5, 2020
2 parents cba0135 + 66a8d40 commit dce4b66
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 12 deletions.
101 changes: 101 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "https://www.github.com/nos/client",
"author": "nOS",
"homepage": "https://nos.io",
"version": "0.6.0",
"version": "0.6.2",
"private": true,
"main": "dist/main/main.js",
"license": "MIT",
Expand Down
29 changes: 26 additions & 3 deletions src/renderer/account/components/Management/Wallet/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import styles from './Wallet.scss';
import EncryptedInput from '../EncryptedInput';

export default class Wallet extends React.PureComponent {
labelRef = React.createRef();

static propTypes = {
className: string,
wallet: walletShape.isRequired,
Expand All @@ -28,7 +30,8 @@ export default class Wallet extends React.PureComponent {
account: accountShape.isRequired,
confirm: func.isRequired,
changeActiveWallet: func.isRequired,
updateWallet: func.isRequired
updateWallet: func.isRequired,
showErrorToast: func.isRequired
};

static defaultProps = {
Expand Down Expand Up @@ -84,6 +87,10 @@ export default class Wallet extends React.PureComponent {
contentEditable="true"
onBlur={this.handleChangeLabel}
suppressContentEditableWarning="true"
onKeyPress={this.validateLabel}
role="textbox"
tabIndex={0}
ref={this.labelRef}
>
{wallet.walletLabel || 'Wallet'}
</div>
Expand Down Expand Up @@ -131,9 +138,16 @@ export default class Wallet extends React.PureComponent {

handleChangeLabel = (e) => {
const { wallet, account, updateWallet } = this.props;

const newLabel = e.target.textContent;
if (newLabel.length > 31) {
e.preventDefault();
return;
}

const newWallet = {
...wallet,
walletLabel: e.target.innerHTML
walletLabel: newLabel
};

updateWallet({ account, wallet: newWallet });
Expand All @@ -142,7 +156,6 @@ export default class Wallet extends React.PureComponent {
handleSetPrimary = () => {
const { wallet, account, passphrase, changeActiveWallet, setPassphrase } = this.props;
const { walletId } = wallet;

changeActiveWallet({ account, passphrase, walletId });
setPassphrase('');
};
Expand All @@ -151,6 +164,16 @@ export default class Wallet extends React.PureComponent {
this.props.setPassphrase(event.target.value);
};

validateLabel = (e) => {
if (e.target.textContent.length > 30) {
e.preventDefault();
return this.props.showErrorToast('Wallet label cannot be longer than 30 characters.');
} else if (e.key === 'Enter') {
e.preventDefault();
this.labelRef.current.blur();
}
};

showConfirm = () => {
const { account, setPassphrase, confirm, wallet } = this.props;
const { secretWord, activeWalletId } = account;
Expand Down
9 changes: 7 additions & 2 deletions src/renderer/auth/actions/authActions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { createActions } from 'spunky';
import { omit } from 'lodash';

import { getActiveWalletForAccount } from 'shared/wallet/WalletHelpers';
import Wallet from 'shared/wallet';
import { ID as ACCOUNT_ID } from 'auth/actions/accountActions';
import { updateStorage } from 'shared/lib/storage';

export const ID = 'auth';

Expand All @@ -21,12 +24,14 @@ const authenticate = async ({ account, passphrase }) => {
};
};

const changeActiveWallet = ({ account, passphrase, walletId }) => {
const changeActiveWallet = async ({ account, passphrase, walletId }) => {
const updatedAccount = {
...account,
...omit(account, 'wallet'),
activeWalletId: walletId
};

await updateStorage(ACCOUNT_ID, account.accountLabel, updatedAccount);

return authenticate({ account: updatedAccount, passphrase });
};

Expand Down
7 changes: 6 additions & 1 deletion src/renderer/auth/actions/walletActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export const importWalletActions = createActions(
// Setter - Update Wallet
export const updateWalletActions = createActions(ID, ({ account, wallet }) => async () => {
const { accountLabel } = account;
await storeWalletForAccount({ accountLabel, wallet, update: true });
await storeWalletForAccount({
accountLabel,
wallet,
update: true,
omitItems: !wallet.isImport
});
return getWalletsForAccount({ accountLabel });
});
2 changes: 1 addition & 1 deletion src/renderer/browser/values/browserValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export const EXTERNAL = 1;

export const APPSTORE = 'App Store';
export const ACCOUNT = 'Account';
export const EXCHANGE = 'https://exchange.nash.io/';
export const EXCHANGE = 'https://switcheo.exchange/markets/NOS_NEO';
export const SETTINGS = 'Settings';
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class Navigation extends React.PureComponent {
};

render() {
const matchExchange = (url) => /https:\/\/exchange\.nash\.io.+/i.test(url);
const matchExchange = (url) => /https:\/\/switcheo\.exchange.+/i.test(url);
const { authenticated } = this.props;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
flex: 0 1 330px;
}

img {
overflow: hidden;
}

.newTab {
align-self: center;
min-width: 16px;
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/shared/images/icons/exchange.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dce4b66

Please sign in to comment.