Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Bugfixes #1143

Merged
merged 7 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Current Develop Branch

## v0.2.7 - Oct 7 2019
- [#1143](https://github.com/MetaMask/metamask-mobile/pull/1143): Minor bugfixes (#1143)

## v0.2.6 - Oct 4 2019
- [#1139](https://github.com/MetaMask/metamask-mobile/pull/1139): Fix onboarding carousel dimensions (#1139)

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 19
versionName "0.2.6"
versionCode 20
versionName "0.2.7"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
Expand Down
35 changes: 32 additions & 3 deletions app/components/Views/ChoosePassword/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ class ChoosePassword extends PureComponent {
* The action to update the lock time
* in the redux store
*/
setLockTime: PropTypes.func
setLockTime: PropTypes.func,
/**
* A string representing the selected address => account
*/
selectedAddress: PropTypes.string
};

state = {
Expand Down Expand Up @@ -206,10 +210,31 @@ class ChoosePassword extends PureComponent {
} else {
try {
this.setState({ loading: true });
const { KeyringController } = Engine.context;
const { KeyringController, PreferencesController } = Engine.context;
const mnemonic = await KeyringController.exportSeedPhrase('');
const seed = JSON.stringify(mnemonic).replace(/"/g, '');
// Preserve the selected address
const selectedAddress = this.props.selectedAddress;
// Preserve the keyring before restoring
const hdKeyring = KeyringController.state.keyrings[0];
// Preserve all the prefs
const prefs = PreferencesController.state;
const existingAccountCount = hdKeyring.accounts.length;
// Recreate keyring
await KeyringController.createNewVaultAndRestore(this.state.password, seed);
for (let i = 0; i < existingAccountCount - 1; i++) {
await KeyringController.addNewAccount();
}

// Set prefs again
await PreferencesController.update(prefs);

// Reselect previous selected account if still available
if (hdKeyring.accounts.includes(selectedAddress)) {
await PreferencesController.update({ selectedAddress });
} else {
await PreferencesController.update({ selectedAddress: hdKeyring[0] });
}

if (this.state.biometryType) {
const authOptions = {
Expand Down Expand Up @@ -518,12 +543,16 @@ class ChoosePassword extends PureComponent {
}
}

const mapStateToProps = state => ({
selectedAddress: state.engine.backgroundState.PreferencesController.selectedAddress
});

const mapDispatchToProps = dispatch => ({
passwordSet: () => dispatch(passwordSet()),
setLockTime: time => dispatch(setLockTime(time))
});

export default connect(
null,
mapStateToProps,
mapDispatchToProps
)(ChoosePassword);
7 changes: 7 additions & 0 deletions app/components/Views/ChoosePassword/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ describe('ChoosePassword', () => {
user: {
passwordSet: true,
seedphraseBackedUp: false
},
engine: {
backgroundState: {
PreferencesController: {
selectedAddress: '0xe7E125654064EEa56229f273dA586F10DF96B0a1'
}
}
}
};

Expand Down
6 changes: 3 additions & 3 deletions app/core/PaymentChannelsClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const {

// eslint-disable-next-line
const createInfuraProvider = require('eth-json-rpc-infura/src/createProvider');
const PUBLIC_URL = 'https://daicard.io';
const PUBLIC_URL = 'hub.connext.network';

const { hasPendingOps } = new Connext.Utils();
// Constants for channel max/min - this is also enforced on the hub
Expand Down Expand Up @@ -94,10 +94,10 @@ class PaymentChannelsClient {
const ethprovider = new EthQuery(infuraProvider);
switch (type) {
case 'rinkeby':
hubUrl = `${PUBLIC_URL}/api/rinkeby/hub`;
hubUrl = `https://rinkeby.${PUBLIC_URL}/api/hub`;
break;
case 'mainnet':
hubUrl = `${PUBLIC_URL}/api/mainnet/hub`;
hubUrl = `https://mainnet.${PUBLIC_URL}/api/hub`;
break;
default:
throw new Error(`Unrecognized network: ${type}`);
Expand Down
4 changes: 2 additions & 2 deletions ios/MetaMask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2537,7 +2537,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
"\"$(SRCROOT)/MetaMask\"",
);
MARKETING_VERSION = 0.2.6;
MARKETING_VERSION = 0.2.7;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -2605,7 +2605,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
"\"$(SRCROOT)/MetaMask\"",
);
MARKETING_VERSION = 0.2.6;
MARKETING_VERSION = 0.2.7;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metamask",
"version": "0.2.6",
"version": "0.2.7",
"private": true,
"scripts": {
"restart-packager-clean": "watchman watch-del-all && rm -rf $TMPDIR/react-* && yarn start -- --reset-cache",
Expand Down