Skip to content

Commit

Permalink
Merge pull request #243 from balance-io/develop
Browse files Browse the repository at this point in the history
Deploy v0.2.1-3 [Master]
  • Loading branch information
jinchung committed Dec 12, 2018
2 parents 5e9f594 + e211ed1 commit 932481d
Show file tree
Hide file tree
Showing 41 changed files with 1,219 additions and 1,259 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/)

## [Unreleased]

### Added

### Changed

### Removed

## [0.2.1-3](https://github.com/balance-io/balance-wallet/releases/tag/v0.2.1-3)
### Added
* NFT attributes page
* Offline status indicator
* Support for message signing via WalletConnect
* Piwik support
* Storing 'hide assets' selection
* Grouping WalletConnect sessions view by dapp name
* Clearing out notifications once app opened

### Changed
* Fixed network spinner issue for older iPhones
* Fixed Add Funds flashing at app loading
* Better camera handling for overall app performance
* Navigation fixes
54 changes: 0 additions & 54 deletions ios/BalanceWallet-tvOS/Info.plist

This file was deleted.

24 changes: 0 additions & 24 deletions ios/BalanceWallet-tvOSTests/Info.plist

This file was deleted.

670 changes: 51 additions & 619 deletions ios/BalanceWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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>1</string>
<string>3</string>
<key>CodePushDeploymentKey</key>
<string>$(CODEPUSH_KEY)</string>
<key>ITSAppUsesNonExemptEncryption</key>
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BalanceWallet",
"version": "0.2.2",
"version": "0.2.1-3",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
Expand All @@ -19,7 +19,8 @@
"@tradle/react-native-http": "^2.0.0",
"assert": "^1.4.1",
"axios": "^0.18.0",
"balance-common": "0.5.28",
"balance-common": "^0.6.6",
"react-native-matomo": "git+https://github.com/BonifyByForteil/react-native-matomo.git",
"browserify-zlib": "^0.1.4",
"buffer": "^4.9.1",
"chroma-js": "^1.3.7",
Expand Down
60 changes: 35 additions & 25 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import firebase from 'react-native-firebase';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { accountInitializeState, accountUpdateAccountAddress, commonStorage } from 'balance-common';
import { AppRegistry, AlertIOS, AppState } from 'react-native';
import { AppRegistry, AlertIOS, AppState, View } from 'react-native';
import { compose, withProps } from 'recompact';
import { connect, Provider } from 'react-redux';
import { NavigationActions } from 'react-navigation';
import Piwik from 'react-native-matomo';
import styled from 'styled-components';
import OfflineBadge from './components/OfflineBadge';
import { withWalletConnectConnections } from './hoc';
import {
addTransactionToApprove,
Expand All @@ -17,14 +20,18 @@ import {
} from './redux/transactionsToApprove';
import {
walletConnectInitAllConnectors,
walletConnectGetAllTransactions,
walletConnectGetTransaction,
walletConnectGetAllRequests,
walletConnectGetRequest,
} from './model/walletconnect';
import store from './redux/store';
import { walletInit } from './model/wallet';
import Routes from './screens/Routes';
import Navigation from './navigation';

const Container = styled(View)`
flex: 1;
`;

class App extends Component {
static propTypes = {
accountInitializeState: PropTypes.func,
Expand All @@ -35,14 +42,15 @@ class App extends Component {
setWalletConnectors: PropTypes.func,
transactionIfExists: PropTypes.func,
transactionsToApproveInit: PropTypes.func,
walletConnectors: PropTypes.arrayOf(PropTypes.object),
sortedWalletConnectors: PropTypes.arrayOf(PropTypes.object),
}

state = { appState: AppState.currentState }

navigatorRef = null

componentDidMount() {
Piwik.initTracker('https://matomo.balance.io/piwik.php', 2);
AppState.addEventListener('change', this.handleAppStateChange);
firebase.messaging().getToken()
.then(fcmToken => {
Expand All @@ -67,8 +75,8 @@ class App extends Component {
const navState = get(this.navigatorRef, 'state.nav');
const route = Navigation.getActiveRouteName(navState);
const { callId, sessionId } = notification.data;
if (route === 'ConfirmTransaction') {
this.fetchAndAddTransaction(callId, sessionId)
if (route === 'ConfirmRequest') {
this.fetchAndAddWalletConnectRequest(callId, sessionId)
.then(transaction => {
const localNotification = new firebase.notifications.Notification()
.setTitle(notification.title)
Expand Down Expand Up @@ -104,7 +112,7 @@ class App extends Component {
.getInitialNotification()
.then(notificationOpen => {
if (!notificationOpen) {
this.fetchAllTransactionsFromWalletConnectSessions();
this.fetchAllRequestsFromWalletConnectSessions();
}
});
})
Expand All @@ -120,39 +128,38 @@ class App extends Component {
}

handleAppStateChange = async (nextAppState) => {
if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
this.fetchAllTransactionsFromWalletConnectSessions();
if (this.state.appState.match(/unknown|background/) && nextAppState === 'active') {
Piwik.trackEvent('screen', 'view', 'app');
this.fetchAllRequestsFromWalletConnectSessions();
}
this.setState({ appState: nextAppState });
}

componentWillUnmount() {
AppState.removeEventListener('change', this.handleAppStateChange);
this.notificationDisplayedListener();
this.notificationListener();
this.notificationOpenedListender();
this.notificationOpenedListener();
this.onTokenRefreshListener();
}

handleNavigatorRef = (navigatorRef) => { this.navigatorRef = navigatorRef; }

handleOpenConfirmTransactionModal = (transactionDetails) => {
if (!this.navigatorRef) return;

const action = NavigationActions.navigate({
routeName: 'ConfirmTransaction',
routeName: 'ConfirmRequest',
params: { transactionDetails },
});

Navigation.handleAction(this.navigatorRef, action);
}

fetchAllTransactionsFromWalletConnectSessions = async () => {
fetchAllRequestsFromWalletConnectSessions = async () => {
const allConnectors = this.props.getValidWalletConnectors();
if (!isEmpty(allConnectors)) {
const allTransactions = await walletConnectGetAllTransactions(allConnectors);
if (!isEmpty(allTransactions)) {
this.props.addTransactionsToApprove(allTransactions);
const allRequests = await walletConnectGetAllRequests(allConnectors);
if (!isEmpty(allRequests)) {
this.props.addTransactionsToApprove(allRequests);
await firebase.notifications().removeAllDeliveredNotifications();
}
}
}
Expand All @@ -162,7 +169,7 @@ class App extends Component {
if (existingTransaction) {
this.handleOpenConfirmTransactionModal(existingTransaction);
} else {
const transaction = await this.fetchAndAddTransaction(callId, sessionId);
const transaction = await this.fetchAndAddWalletConnectRequest(callId, sessionId);
if (transaction) {
this.handleOpenConfirmTransactionModal(transaction);
} else {
Expand All @@ -171,18 +178,21 @@ class App extends Component {
}
}

fetchAndAddTransaction = async (callId, sessionId) => {
const walletConnector = this.props.walletConnectors.find(({ _sessionId }) => (_sessionId === sessionId));
const transactionDetails = await walletConnectGetTransaction(callId, walletConnector);
if (!transactionDetails) return null;
fetchAndAddWalletConnectRequest = async (callId, sessionId) => {
const walletConnector = this.props.sortedWalletConnectors.find(({ _sessionId }) => (_sessionId === sessionId));
const callData = await walletConnectGetRequest(callId, walletConnector);
if (!callData) return null;

const { callData, dappName } = transactionDetails;
const { dappName } = walletConnector;
return this.props.addTransactionToApprove(sessionId, callId, callData, dappName);
}

render = () => (
<Provider store={store}>
<Routes ref={this.handleNavigatorRef} />
<Container>
<OfflineBadge />
<Routes ref={this.handleNavigatorRef} />
</Container>
</Provider>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppVersionStamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ const Container = styled(Monospace).attrs({
text-align: center;
`;

const AppVersionStamp = props => <Container {...props}>Balance v0.2.2</Container>;
const AppVersionStamp = props => <Container {...props}>Balance v0.2.1 (3)</Container>;

export default AppVersionStamp;
62 changes: 62 additions & 0 deletions src/components/MessageSigningSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import PropTypes from 'prop-types';
import React from 'react';
import lang from 'i18n-js';
import styled from 'styled-components';
import { BlockButton } from '../components/buttons';
import { Column } from '../components/layout';
import {
Smallcaps,
Text,
} from '../components/text';
import { withSafeAreaViewInsetValues } from '../hoc';
import { borders, colors, fonts, padding, position } from '../styles';

const Message = styled(Text).attrs({ size: 'lmedium' })`
color: ${colors.alpha(colors.blueGreyDark, 0.6)}
margin-top: 5;
`;

const MessageRow = styled(Column)`
${padding(19, 19, 18)}
flex-shrink: 0;
`;

const BottomSheet = styled(Column).attrs({ justify: 'space-between' })`
${borders.buildRadius('top', 15)}
background-color: ${colors.white};
flex: 0;
min-height: ${({ bottomInset }) => (bottomInset + 236)};
padding-bottom: ${({ bottomInset }) => bottomInset};
width: 100%;
`;

const SendButtonContainer = styled.View`
${padding(7, 15, 14)}
flex-shrink: 0;
`;

const MessageSigningSection = ({
message,
onSignMessage,
safeAreaInset,
}) => (
<BottomSheet bottomInset={safeAreaInset.bottom}>
<MessageRow>
<Smallcaps>{lang.t('wallet.message_signing.message')}</Smallcaps>
<Message>{message}</Message>
</MessageRow>
<SendButtonContainer>
<BlockButton onPress={onSignMessage}>
{lang.t('wallet.message_signing.sign')}
</BlockButton>
</SendButtonContainer>
</BottomSheet>
);

MessageSigningSection.propTypes = {
message: PropTypes.string,
onSignMessage: PropTypes.func,
safeAreaInset: PropTypes.object,
};

export default withSafeAreaViewInsetValues(MessageSigningSection);
Loading

0 comments on commit 932481d

Please sign in to comment.