Merge pull request #619 from matiu/feature/video-as-an-option

Feature/video as an option
This commit is contained in:
Gustavo Maximiliano Cortez 2014-06-09 16:26:31 -03:00
commit fabc8aac85
7 changed files with 43 additions and 25 deletions

View file

@ -43,19 +43,26 @@ var defaultConfig = {
'iceServers': [ 'iceServers': [
// Pass in STUN and TURN servers for maximum network compatibility // Pass in STUN and TURN servers for maximum network compatibility
{ {
url: 'stun:stun.l.google.com:19302' url: 'stun:162.242.219.26'
}, { }, {
url: 'stun:stun1.l.google.com:19302' url: 'turn:162.242.219.26',
}, { username: 'bitcore',
url: 'stun:stun2.l.google.com:19302' credential: 'bitcore',
}, {
url: 'stun:stun3.l.google.com:19302'
}, {
url: 'stun:stun4.l.google.com:19302'
}, {
url: 'stun:stunserver.org'
} }
// Options fot TURN servers with p2p communications are not possible. // {
// url: 'stun:stun.l.google.com:19302'
// }, {
// url: 'stun:stun1.l.google.com:19302'
// }, {
// url: 'stun:stun2.l.google.com:19302'
// }, {
// url: 'stun:stun3.l.google.com:19302'
// }, {
// url: 'stun:stun4.l.google.com:19302'
// }, {
// url: 'stun:stunserver.org'
// }
// // Options fot TURN servers with p2p communications are not possible.
// { // {
// url: 'turn:numb.viagenie.ca', // url: 'turn:numb.viagenie.ca',
// credential: 'muazkh', // credential: 'muazkh',
@ -104,7 +111,6 @@ var defaultConfig = {
// theme list // theme list
themes: ['default'], themes: ['default'],
disableVideo: 1,
verbose: 1, verbose: 1,
}; };

View file

@ -54,11 +54,11 @@ html, body {height: 100%;}
} }
.bottom-copay { .bottom-copay {
width: 56px; width: 50px;
text-align: center; text-align: center;
position: relative; position: relative;
float: right; float: right;
margin-left: 15px; margin-left: 20px;
/* height: 551px; */ /* height: 551px; */
} }

View file

@ -150,7 +150,7 @@
<div id="footer" data-ng-controller="FooterController" ng-class="{'footer-home': !$root.wallet}"> <div id="footer" data-ng-controller="FooterController" ng-class="{'footer-home': !$root.wallet}">
<link rel="stylesheet" ng-href="{{theme}}"> <link rel="stylesheet" ng-href="{{theme}}">
<div ng-show="!$root.wallet"> <div ng-show="!$root.wallet">
<div class="large-12 columns text-right"> <div class="large-12 columns text-left">
Copay Copay
<small>v{{version}}</small> <small>v{{version}}</small>
</div> </div>
@ -163,14 +163,18 @@
<div class="size-12 m10t"> <div class="size-12 m10t">
{{$root.wallet.requiredCopayers}}-of-{{$root.wallet.totalCopayers}} wallet {{$root.wallet.requiredCopayers}}-of-{{$root.wallet.totalCopayers}} wallet
</div> </div>
<div class="text-gray size-12" style="margin-top:5px">
Copay v{{version}}
</div>
<div class="size-12 m10t" ng-if="themes.length > 1"> <div class="size-12 m10t" ng-if="themes.length > 1">
<a class="size-12" ng-click="change_theme(th)" ng-repeat="th in themes">{{th}} {{$last ? '' : '&middot; '}}</a> <a class="size-12" ng-click="change_theme(th)" ng-repeat="th in themes">{{th}} {{$last ? '' : '&middot; '}}</a>
</div> </div>
</div> </div>
<div class="large-9 medium-9 small-9 columns"> <div class="large-9 medium-9 small-9 columns">
<a href="#/addresses" > </a> <a href="#/addresses" > </a>
<div class="bottom-copay" <!-- <div class="bottom&#45;copay" ng&#45;repeat="c in $root.wallet.getRegisteredPeerIds()" class="has&#45;tip" tooltip&#45;popup&#45;delay="1000" tooltip&#45;placement="top" tooltip="{{c.nick}}"> -->
ng-repeat="c in $root.wallet.getRegisteredPeerIds()" class="has-tip" tooltip-popup-delay="1000" tooltip-placement="top" tooltip="{{c.nick}}"> <div class="bottom-copay" ng-repeat="c in $root.wallet.getRegisteredPeerIds()">
<video ng-if="$root.videoInfo[c.peerId]" <video ng-if="$root.videoInfo[c.peerId]"
avatar peer="{{c}}" avatar peer="{{c}}"
autoplay autoplay
@ -182,6 +186,9 @@
ng-class="($root.wallet.getOnlinePeerIDs().indexOf(c.peerId) != -1) ? 'online' : 'offline'" ng-class="($root.wallet.getOnlinePeerIDs().indexOf(c.peerId) != -1) ? 'online' : 'offline'"
src="./img/satoshi.gif" src="./img/satoshi.gif"
/> />
<div class="size-12 text-center text-gray" stype="margin-top:4px">
{{c.nick || 'NN'}}
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -17,6 +17,8 @@ angular.module('copayApp.controllers').controller('FooterController', function($
$scope.version = copay.version; $scope.version = copay.version;
$scope.getVideoURL = function(copayer) { $scope.getVideoURL = function(copayer) {
if (config.disableVideo) return;
var vi = $rootScope.videoInfo[copayer] var vi = $rootScope.videoInfo[copayer]
if (!vi) return; if (!vi) return;

View file

@ -131,8 +131,10 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
}; };
Wallet.prototype._handleData = function(senderId, data, isInbound) { Wallet.prototype._handleData = function(senderId, data, isInbound) {
// TODO check message signature // TODO check message signature
if (this.id !== data.walletId) {
if (data.type !== 'walletId' && this.id !== data.walletId) {
this.emit('badMessage', senderId); this.emit('badMessage', senderId);
this.log('badMessage FROM:', senderId); //TODO this.log('badMessage FROM:', senderId); //TODO
return; return;
@ -569,7 +571,7 @@ Wallet.prototype.getBalance = function(cb) {
// we multiply and divide by COIN to avoid rounding errors when adding // we multiply and divide by COIN to avoid rounding errors when adding
for (var a in balanceByAddr) { for (var a in balanceByAddr) {
balanceByAddr[a] = balanceByAddr[a] / COIN; balanceByAddr[a] = balanceByAddr[a].toFixed(0) / COIN;
} }
balance = balance / COIN; balance = balance / COIN;
@ -579,7 +581,7 @@ Wallet.prototype.getBalance = function(cb) {
safeBalance += amt; safeBalance += amt;
} }
safeBalance = safeBalance / COIN; safeBalance = safeBalance.toFixed(0) / COIN;
return cb(null, balance, balanceByAddr, safeBalance); return cb(null, balance, balanceByAddr, safeBalance);
}); });
}; };

View file

@ -61,7 +61,8 @@ angular.module('copayApp.services')
w.on('ready', function(myPeerID) { w.on('ready', function(myPeerID) {
$rootScope.wallet = w; $rootScope.wallet = w;
$location.path('addresses'); $location.path('addresses');
video.setOwnPeer(myPeerID, w, handlePeerVideo); if (!config.disableVideo)
video.setOwnPeer(myPeerID, w, handlePeerVideo);
}); });
w.on('publicKeyRingUpdated', function(dontDigest) { w.on('publicKeyRingUpdated', function(dontDigest) {
@ -83,7 +84,7 @@ angular.module('copayApp.services')
root.onErrorDigest(msg); root.onErrorDigest(msg);
}); });
w.on('connect', function(peerID) { w.on('connect', function(peerID) {
if (peerID) { if (peerID && !config.disableVideo) {
video.callPeer(peerID, handlePeerVideo); video.callPeer(peerID, handlePeerVideo);
} }
$rootScope.$digest(); $rootScope.$digest();

View file

@ -180,7 +180,7 @@ describe('TxProposals model', function() {
uuk[0].split(',')[0].should.equal(unspentTest[0].txid); uuk[0].split(',')[0].should.equal(unspentTest[0].txid);
}); });
it.skip('#merge with self', function () { it('#merge with self', function () {
var priv = new PrivateKey(config); var priv = new PrivateKey(config);
var w = new TxProposals({ var w = new TxProposals({
networkName: config.networkName, networkName: config.networkName,
@ -398,7 +398,7 @@ var _dumpChunks = function (scriptSig, label) {
}); });
it.skip('#merge, merge signatures case 3', function () { it('#merge, merge signatures case 3', function () {
var priv = new PrivateKey(config); var priv = new PrivateKey(config);
var priv2 = new PrivateKey(config); var priv2 = new PrivateKey(config);