Skip to content

Commit

Permalink
Merge pull request #293 from balance-io/develop
Browse files Browse the repository at this point in the history
Deploy v0.3.0 (4) [Master]
  • Loading branch information
jinchung committed Jan 18, 2019
2 parents d58f6cc + fd1cecb commit 71540e8
Show file tree
Hide file tree
Showing 127 changed files with 3,275 additions and 1,517 deletions.
10 changes: 10 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"env": {
"development": {
"plugins": [ ["transform-remove-console", { "exclude": ["disableYellowBox", "error", "info", "log"] }] ]
},
"production": {
"plugins": [
["transform-remove-console", { "exclude": ["error"] }]
]
}
},
"plugins": [
"babel-plugin-styled-components",
"date-fns",
Expand Down
12 changes: 10 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
"react-native",
"react-native-animation-linter"
],
"parserOptions": {
"ecmaFeatures": {
Expand All @@ -17,6 +18,7 @@
],
"rules" : {
"arrow-body-style": "warn",
"camelcase": ["error", {ignoreDestructuring: true}],
"class-methods-use-this": "off",
"no-console": "off",
"max-len": ["error", {"code": 160, "comments": 500}],
Expand All @@ -28,9 +30,15 @@
"no-plusplus": ["off"],
"no-underscore-dangle": ["off"],
"arrow-parens": ["off"],
"no-param-reassign": ["off"]
"no-param-reassign": ["off"],
"react-native-animation-linter/must-tear-down-animations": 2,
},
"globals": {
"fetch": false
},
"settings": {
"react": {
"version": "16.5.0"
}
}
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

### Removed

## [0.3.0-4](https://github.com/balance-io/balance-wallet/releases/tag/v0.3.0-4)

### Added
* Import seed phrase

### Changed
* Performance improvements
* Splash screen to be removed after successfully loaded wallet data
* Support for separate reducer changes for settings, assets, transactions, prices
* Support for promisified account refresh

## [0.3.0-3](https://github.com/balance-io/balance-wallet/releases/tag/v0.3.0-3)
### Changed
* Fix for toggle seed phrase button
Expand Down
2 changes: 1 addition & 1 deletion ios/BalanceWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2072,7 +2072,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\nexport FORCE_BUNDLING=true\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
shellScript = "export NODE_BINARY='node --max_old_space_size=2048'\nexport FORCE_BUNDLING=true\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
1DFACE34723C6B8DBBD5F804 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion ios/BalanceWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3</string>
<string>4</string>
<key>CodePushDeploymentKey</key>
<string>$(CODEPUSH_KEY)</string>
<key>ITSAppUsesNonExemptEncryption</key>
Expand Down
22 changes: 11 additions & 11 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ PODS:
- GoogleToolboxForMac/Logger (~> 2.1)
- Protobuf (~> 3.1)
- FLAnimatedImage (1.0.12)
- GoogleToolboxForMac/Defines (2.2.0)
- GoogleToolboxForMac/Logger (2.2.0):
- GoogleToolboxForMac/Defines (= 2.2.0)
- "GoogleToolboxForMac/NSData+zlib (2.2.0)":
- GoogleToolboxForMac/Defines (= 2.2.0)
- GoogleToolboxForMac/Defines (2.1.4)
- GoogleToolboxForMac/Logger (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSData+zlib (2.1.4)":
- GoogleToolboxForMac/Defines (= 2.1.4)
- nanopb (0.3.901):
- nanopb/decode (= 0.3.901)
- nanopb/encode (= 0.3.901)
Expand All @@ -52,12 +52,12 @@ PODS:
- React/RCTNetwork
- React/RCTNetwork (0.57.1):
- React/Core
- RNLanguages (3.0.1):
- RNLanguages (3.0.2):
- React
- RNReanimated (1.0.0-alpha.10):
- RNReanimated (1.0.0-alpha.11):
- React
- SDWebImage/Core (4.4.3)
- SDWebImage/GIF (4.4.3):
- SDWebImage/Core (4.4.2)
- SDWebImage/GIF (4.4.2):
- FLAnimatedImage (~> 1.0)
- SDWebImage/Core
- yoga (0.57.1.React)
Expand Down Expand Up @@ -112,15 +112,15 @@ SPEC CHECKSUMS:
FirebaseInstanceID: 4f7768a98c5c3c5bd9a4c9e431ea98dccc0a51f9
FirebaseMessaging: 94579ae655d817287f029ebfebd5b0811fbb3a51
FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
GoogleToolboxForMac: ff31605b7d66400dcec09bed5861689aebadda4d
GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
Protobuf: 6b0fc34ab8f2b7dbad2278a48be08a669427c59f
React: 1fe0eb13d90b625d94c3b117c274dcfd2e760e11
react-native-blur: c35c1f6c2c76db7108bde7ed343bd2b01d64e0c0
react-native-fast-image: cba3d9bf9c2cf8ddb643d887a686c53a5dd90a2c
RNLanguages: e3ae05ef105937645218272429dac0c3f7633451
RNReanimated: 45d9313b7a62318ed00d60a811937321e43e076e
SDWebImage: c5594f1a19c48d526d321e548902b56b479cd508
SDWebImage: 4170dae6332a915d44c918675d51dc1c4c06b45f
yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85

PODFILE CHECKSUM: 49f66978b10019df5c3f0971f9cb6e6bc610c256
Expand Down
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "BalanceWallet",
"version": "0.3.0-3",
"version": "0.3.0-4",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"install-pods": "cd ios && pod install && cd ..",
"ios": "react-native run-ios --simulator='iPhone X'",
"lint": "eslint ./src/ --ext .js",
"lint": "eslint './**/*.js'",
"nodeify": "./node_modules/.bin/rn-nodeify --install \"crypto\" --hack",
"postinstall": "rn-nodeify --install --hack"
},
Expand All @@ -18,7 +18,7 @@
"@tradle/react-native-http": "^2.0.0",
"assert": "^1.4.1",
"axios": "^0.18.0",
"balance-common": "^0.6.9",
"balance-common": "^0.6.15",
"browserify-zlib": "^0.1.4",
"buffer": "^4.9.1",
"chroma-js": "^1.3.7",
Expand All @@ -38,12 +38,14 @@
"inherits": "^2.0.3",
"lodash": "^4.17.11",
"path-browserify": "0.0.0",
"postcss": "^7.0.13",
"process": "^0.11.10",
"prop-types": "^15.6.1",
"punycode": "^1.4.1",
"querystring-es3": "^0.2.1",
"react": "^16.5.0",
"react-coin-icon": "^0.1.6",
"react-fast-compare": "^2.0.4",
"react-native": "0.57.1",
"react-native-actionsheet": "^2.4.2",
"react-native-blur": "^3.2.2",
Expand All @@ -56,6 +58,7 @@
"react-native-firebase": "^4.3.8",
"react-native-gesture-handler": "^1.0.7",
"react-native-haptic-feedback": "^1.2.0",
"react-native-indicators": "^0.13.0",
"react-native-iphone-x-helper": "^1.2.0",
"react-native-keychain": "^3.0.0",
"react-native-languages": "^3.0.0",
Expand Down Expand Up @@ -90,11 +93,13 @@
"recompose": "^0.30.0",
"redux": "^3.7.2",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"rn-nodeify": "^10.0.0",
"rn-walletconnect-wallet": "^0.7.24",
"stream-browserify": "^1.0.0",
"string_decoder": "^0.10.31",
"styled-components": "4.1.2",
"stylelint": "^9.10.0",
"svgs": "^4.0.0",
"timers-browserify": "^1.4.2",
"tty-browserify": "0.0.0",
Expand All @@ -103,25 +108,28 @@
"vm-browserify": "0.0.4"
},
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/core": "^7.2.2",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^22.4.3",
"babel-plugin-date-fns": "^0.2.1",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-styled-components": "^1.9.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react-native": "^3.2.1",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^5.11.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-react": "^7.12.1",
"eslint-plugin-react-native": "^3.5.0",
"eslint-plugin-react-native-animation-linter": "^0.1.2",
"jest": "^22.4.3",
"metro-react-native-babel-preset": "^0.50.0",
"react-test-renderer": "^16.2.0",
"schedule": "0.4.0"
},
"resolutions": {
"**/eslint-plugin-import": "2.14.0",
"**/resolve": "1.8.1"
},
"jest": {
Expand Down
91 changes: 52 additions & 39 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ import CodePush from 'react-native-code-push';
import firebase from 'react-native-firebase';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { accountInitializeState, accountUpdateAccountAddress, commonStorage } from 'balance-common';
import { commonStorage, settingsInitializeState, settingsUpdateAccountAddress } from 'balance-common';
import { AppRegistry, AlertIOS, AppState } from 'react-native';
import { compose, withProps } from 'recompact';
import { connect, Provider } from 'react-redux';
import { StackActions } from 'react-navigation';
import Piwik from 'react-native-matomo';
import { FlexItem } from './components/layout';
import OfflineBadge from './components/OfflineBadge';
import { withWalletConnectConnections } from './hoc';
import {
withAccountRefresh,
withTrackingDate,
withWalletConnectConnections,
} from './hoc';
import {
addTransactionToApprove,
addTransactionsToApprove,
Expand All @@ -28,18 +32,24 @@ import { walletInit } from './model/wallet';
import Routes from './screens/Routes';
import Navigation from './navigation';

if (process.env.NODE_ENV === 'development') {
console.log('process', process);
console.disableYellowBox = true;
}

class App extends Component {
static propTypes = {
accountInitializeState: PropTypes.func,
accountUpdateAccountAddress: PropTypes.func,
addTransactionsToApprove: PropTypes.func,
addTransactionToApprove: PropTypes.func,
getValidWalletConnectors: PropTypes.func,
refreshAccount: PropTypes.func,
settingsInitializeState: PropTypes.func,
settingsUpdateAccountAddress: PropTypes.func,
setWalletConnectors: PropTypes.func,
sortedWalletConnectors: PropTypes.arrayOf(PropTypes.object),
trackingDateInit: PropTypes.func,
transactionIfExists: PropTypes.func,
transactionsToApproveInit: PropTypes.func,
sortedWalletConnectors: PropTypes.arrayOf(PropTypes.object),
}

state = { appState: AppState.currentState }
Expand Down Expand Up @@ -92,38 +102,36 @@ class App extends Component {
const { callId, sessionId } = notificationOpen.notification.data;
this.onPushNotificationOpened(callId, sessionId, false);
});

await this.props.accountInitializeState();

walletInit()
.then(walletAddress => {
if (!walletAddress) { return; }
console.log('wallet address is', walletAddress);
this.props.accountUpdateAccountAddress(walletAddress, 'BALANCEWALLET');
this.props.transactionsToApproveInit();
walletConnectInitAllConnectors()
.then(allConnectors => {
this.props.setWalletConnectors(allConnectors);
firebase
.notifications()
.getInitialNotification()
.then(notificationOpen => {
if (!notificationOpen) {
this.fetchAllRequestsFromWalletConnectSessions();
}
});
})
.catch(error => {
console.log('Unable to init all WalletConnect sessions');
});
/*
*/
})
.catch(error => {
AlertIOS.alert('Error: Failed to initialize wallet.');
});
}

handleWalletConfig = async (seedPhrase) => {
try {
this.props.trackingDateInit();
const walletAddress = await walletInit(seedPhrase);
console.log('wallet address is', walletAddress);
this.props.settingsInitializeState();
this.props.settingsUpdateAccountAddress(walletAddress, 'BALANCEWALLET');
await this.props.refreshAccount();
this.props.transactionsToApproveInit();
try {
const allConnectors = await walletConnectInitAllConnectors();
if (allConnectors) {
this.props.setWalletConnectors(allConnectors);
}
} catch (error) {
console.log('Unable to init all WalletConnect sessions');
}
const notificationOpen = await firebase.notifications().getInitialNotification();
if (!notificationOpen) {
this.fetchAllRequestsFromWalletConnectSessions();
}
return walletAddress;
} catch (error) {
console.log('WALLET ERROR', error);
return AlertIOS.alert('Error: Failed to initialize wallet.');
}
};

handleAppStateChange = async (nextAppState) => {
if (this.state.appState.match(/unknown|background/) && nextAppState === 'active') {
Piwik.trackEvent('screen', 'view', 'app');
Expand Down Expand Up @@ -188,22 +196,27 @@ class App extends Component {
<Provider store={store}>
<FlexItem>
<OfflineBadge />
<Routes ref={this.handleNavigatorRef} />
<Routes
ref={this.handleNavigatorRef}
screenProps={{ handleWalletConfig: this.handleWalletConfig }}
/>
</FlexItem>
</Provider>
)
}

const AppWithRedux = compose(
withProps({ store }),
withAccountRefresh,
withTrackingDate,
withWalletConnectConnections,
connect(
null,
{
addTransactionToApprove,
addTransactionsToApprove,
accountInitializeState,
accountUpdateAccountAddress,
addTransactionToApprove,
settingsInitializeState,
settingsUpdateAccountAddress,
transactionIfExists,
transactionsToApproveInit,
},
Expand Down
Loading

0 comments on commit 71540e8

Please sign in to comment.