Added whisper status indicator

This commit is contained in:
Richard Ramos 2018-04-25 20:11:15 -04:00
parent baffdb8f3b
commit 3b13a2c80c
1 changed files with 23 additions and 3 deletions

View File

@ -21,10 +21,30 @@ class App extends React.Component {
}
componentDidMount(){
// TODO Verify if whisper & swarm/ipfs are available
let _this = this;
setTimeout(() => {
if (EmbarkJS.isNewWeb3()) {
EmbarkJS.Messages.Providers.whisper.getWhisperVersion(function(err, version){
if(!err)
_this.setState({whisperEnabled: true})
else
console.log(err);
});
} else {
if (EmbarkJS.Messages.providerName === 'whisper') {
EmbarkJS.Messages.getWhisperVersion(function(err, version) {
if(!err)
_this.setState({whisperEnabled: true})
else
console.log(err);
});
}
}
}, 500);
this.setState({
whisperEnabled: false,
storageEnabled: false
storageEnabled: true
});
}