Skip to content

Commit cab1dca

Browse files
committed
Release 1.0.3
1 parent 5d1a450 commit cab1dca

8 files changed

Lines changed: 78 additions & 98 deletions

File tree

App.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './shim'
22
import React from 'react'
33
import { createStackNavigator, createBottomTabNavigator } from 'react-navigation'
4-
import { YellowBox, AppRegistry, AppState } from 'react-native'
4+
import { YellowBox, AppRegistry, AppState, NetInfo } from 'react-native'
55
import store from 'react-native-simple-store'
66

77
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader', 'Class RCTCxxModule']);
@@ -59,7 +59,8 @@ export default class App extends React.Component {
5959
global.port = 7403;
6060
global.ip = "13.57.248.201";
6161
global.ecl = new ElectrumCli(global.port, global.ip, 'tcp');
62-
global.version = "1.0.2";
62+
global.version = "1.0.3";
63+
global.connectionStatus = false;
6364

6465
global.ecl.connect().then(() => this.ping)
6566
}
@@ -82,9 +83,10 @@ export default class App extends React.Component {
8283
this.setState({appState: nextAppState});
8384
}
8485

85-
8686
componentDidMount() {
8787
AppState.addEventListener('change', this.handleAppStateChange);
88+
NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange);
89+
8890
this.ping();
8991
store.get("wallets").then((wallets) => {
9092
if (wallets != null) {
@@ -99,6 +101,18 @@ export default class App extends React.Component {
99101
})
100102
}
101103

104+
componentWillUnmount() {
105+
NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange);
106+
}
107+
108+
handleConnectivityChange = isConnected => {
109+
if (isConnected) {
110+
global.connectionStatus = isConnected;
111+
} else {
112+
global.connectionStatus = isConnected;
113+
}
114+
}
115+
102116
render() {
103117
return(
104118
<RootStack />

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ android {
101101
applicationId "com.microbitcoin"
102102
minSdkVersion 16
103103
targetSdkVersion 27
104-
versionCode 8
105-
versionName "1.0.2"
104+
versionCode 9
105+
versionName "1.0.3"
106106
ndk {
107107
abiFilters "armeabi-v7a", "x86"
108108
}

ios/MicroBitcoin.xcodeproj/project.pbxproj

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
};
66
objectVersion = 48;
77
objects = {
8+
89
/* Begin PBXBuildFile section */
910
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
1011
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -658,7 +659,6 @@
658659
2F5FB318715F431A963DF9D6 /* libRNCamera.a */,
659660
2DE49CEFB9E645789247D95B /* libReactNativePermissions.a */,
660661
7E444EE9E8A048D3B8B49959 /* libTcpSockets.a */,
661-
4AE96B0C591F44C0A02D542F /* libWorkers.a */,
662662
);
663663
name = "Recovered References";
664664
sourceTree = "<group>";
@@ -1440,9 +1440,7 @@
14401440
INFOPLIST_FILE = MicroBitcoinTests/Info.plist;
14411441
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
14421442
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1443-
LIBRARY_SEARCH_PATHS = (
1444-
"$(inherited)",
1445-
);
1443+
LIBRARY_SEARCH_PATHS = "$(inherited)";
14461444
OTHER_LDFLAGS = (
14471445
"-ObjC",
14481446
"-lc++",
@@ -1468,9 +1466,7 @@
14681466
INFOPLIST_FILE = MicroBitcoinTests/Info.plist;
14691467
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
14701468
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1471-
LIBRARY_SEARCH_PATHS = (
1472-
"$(inherited)",
1473-
);
1469+
LIBRARY_SEARCH_PATHS = "$(inherited)";
14741470
OTHER_LDFLAGS = (
14751471
"-ObjC",
14761472
"-lc++",
@@ -1573,9 +1569,7 @@
15731569
);
15741570
INFOPLIST_FILE = "MicroBitcoin-tvOS/Info.plist";
15751571
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1576-
LIBRARY_SEARCH_PATHS = (
1577-
"$(inherited)",
1578-
);
1572+
LIBRARY_SEARCH_PATHS = "$(inherited)";
15791573
OTHER_LDFLAGS = (
15801574
"-ObjC",
15811575
"-lc++",
@@ -1610,9 +1604,7 @@
16101604
);
16111605
INFOPLIST_FILE = "MicroBitcoin-tvOS/Info.plist";
16121606
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1613-
LIBRARY_SEARCH_PATHS = (
1614-
"$(inherited)",
1615-
);
1607+
LIBRARY_SEARCH_PATHS = "$(inherited)";
16161608
OTHER_LDFLAGS = (
16171609
"-ObjC",
16181610
"-lc++",
@@ -1646,9 +1638,7 @@
16461638
);
16471639
INFOPLIST_FILE = "MicroBitcoin-tvOSTests/Info.plist";
16481640
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1649-
LIBRARY_SEARCH_PATHS = (
1650-
"$(inherited)",
1651-
);
1641+
LIBRARY_SEARCH_PATHS = "$(inherited)";
16521642
OTHER_LDFLAGS = (
16531643
"-ObjC",
16541644
"-lc++",
@@ -1682,9 +1672,7 @@
16821672
);
16831673
INFOPLIST_FILE = "MicroBitcoin-tvOSTests/Info.plist";
16841674
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1685-
LIBRARY_SEARCH_PATHS = (
1686-
"$(inherited)",
1687-
);
1675+
LIBRARY_SEARCH_PATHS = "$(inherited)";
16881676
OTHER_LDFLAGS = (
16891677
"-ObjC",
16901678
"-lc++",

ios/MicroBitcoin/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>4</string>
24+
<string>5</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSAppTransportSecurity</key>

src/components/ImportKeyScreen.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default class openPasswordWalletScreen extends React.Component {
3232
import = () => {
3333
this.setState({key: this.state.key.trim()});
3434

35-
if(this.state.key != "" && this.state.key != null) {
35+
if(this.state.key != "" && this.state.key.length == 52) {
3636
let address = coinjs.wif2address(this.state.key).address;
3737

3838
if(this.state.walletUtils.wallet.addresses.external[address] == undefined) {
@@ -52,8 +52,10 @@ export default class openPasswordWalletScreen extends React.Component {
5252
} else {
5353
Alert.alert("Import WIF key", "This WIF key already exists in your wallet!");
5454
}
55-
} else {
55+
} else if(this.state.key == "") {
5656
Alert.alert("Import WIF key", "WIF key is empty!");
57+
} else if(this.state.key.length < 52) {
58+
Alert.alert("Import WIF key", "Too short WIF key!");
5759
}
5860

5961
}

src/components/MyWalletDetailsScreen.js

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
ActivityIndicator,
55
Platform,
66
BackHandler,
7-
NetInfo,
87
ScrollView,
98
StyleSheet,
109
Text,
@@ -28,15 +27,12 @@ export default class MyWalletDetailsScreen extends React.Component {
2827

2928
updatingBalance: false,
3029
loading: false,
31-
isConnected: false,
30+
isConnected: global.connectionStatus,
3231
walletUtils: new WalletUtils(this.props.navigation.getParam('wallet', null), this.props.navigation.getParam('password', null), global.ecl),
3332
appState: AppState.currentState
3433

3534
}
36-
37-
this.state.walletUtils.subscribeToAddresses();
38-
this.state.walletUtils.checkHistory();
39-
this.state.isCancelled = false;
35+
this.isCancelled = false;
4036

4137
const willFocusSubscription = this.props.navigation.addListener(
4238
'willFocus',
@@ -45,21 +41,6 @@ export default class MyWalletDetailsScreen extends React.Component {
4541
this.props.navigation.setParams({goBack: this.goBack})
4642
this.interval = setInterval(() => this.updateWallet(), 2000);
4743
this.isCancelled = false
48-
49-
NetInfo.isConnected.fetch().then(isConnected => {
50-
!this.isCancelled && this.setState({isConnected: isConnected})
51-
});
52-
53-
handleFirstConnectivityChange = (isConnected) => {
54-
!this.isCancelled && this.setState({isConnected: isConnected})
55-
}
56-
57-
NetInfo.isConnected.addEventListener(
58-
59-
'connectionChange',
60-
handleFirstConnectivityChange
61-
62-
)
6344
AppState.addEventListener('change', this.handleAppStateChange);
6445
}
6546
)
@@ -69,21 +50,24 @@ export default class MyWalletDetailsScreen extends React.Component {
6950
payload => {
7051
this.isCancelled = true
7152
clearInterval(this.interval);
72-
73-
NetInfo.isConnected.removeEventListener(
74-
75-
'connectionChange',
76-
handleFirstConnectivityChange
77-
78-
);
7953
AppState.removeEventListener('change', this.handleAppStateChange);
8054
}
8155
)
56+
}
8257

58+
componentDidMount() {
59+
!this.isCancelled && this.state.walletUtils.subscribeToAddresses();
60+
!this.isCancelled && this.state.walletUtils.checkHistory();
61+
}
62+
63+
componentWillUnmount() {
64+
this.isCancelled = true;
65+
global.ecl.onClose();
8366
}
8467

8568
updateWallet() {
86-
if(!this.isCancelled) this.setState({walletUtils: this.state.walletUtils});
69+
!this.isCancelled && this.setState({walletUtils: this.state.walletUtils});
70+
!this.isCancelled && this.setState({isConnected: global.connectionStatus});
8771
}
8872

8973
async updateBalance() {
@@ -131,13 +115,6 @@ export default class MyWalletDetailsScreen extends React.Component {
131115
if (!this.isCancelled) this.setState({appState: nextAppState});
132116
}
133117

134-
handleFirstConnectivityChange = (connectionInfo) => {
135-
console.log('First change, type: ' + connectionInfo.type + ', effectiveType: ' + connectionInfo.effectiveType);
136-
NetInfo.removeEventListener(
137-
'connectionChange',
138-
handleFirstConnectivityChange
139-
);
140-
}
141118

142119
render() {
143120

src/components/WalletSettingsScreen.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default class WalletSettingsScreen extends React.Component {
5151
for (var i = 0; i < res.length; i++) {
5252
if (res[i].id == this.state.walletUtils.wallet.id) {
5353
res[i].transactions = {}
54+
res[i].mempool = []
5455
this.setState({wallet: res[i]})
5556
break
5657
}

0 commit comments

Comments
 (0)