Merge pull request #326 from maraoz/fix/online-status
Fix avatar online status -- Awesome!
This commit is contained in:
commit
9b8b5383d2
3 changed files with 23 additions and 13 deletions
20
index.html
20
index.html
|
|
@ -123,19 +123,17 @@
|
||||||
<div class="large-9 medium-9 small-9 columns">
|
<div class="large-9 medium-9 small-9 columns">
|
||||||
<div class="bottom-copay"
|
<div class="bottom-copay"
|
||||||
ng-repeat="c in $root.wallet.getRegisteredPeerIds()">
|
ng-repeat="c in $root.wallet.getRegisteredPeerIds()">
|
||||||
<video
|
<video ng-if="$root.videoInfo[c.peerId]"
|
||||||
ng-if="$root.videoInfo[c.peerId]"
|
avatar peer="{{c}}"
|
||||||
class="video-small"
|
|
||||||
autoplay
|
autoplay
|
||||||
confvideo
|
|
||||||
peer="{{c.peerId}}"
|
|
||||||
ng-src="{{$root.getVideoURL(c.peerId)}}"
|
|
||||||
title="{{c.peerId + (c.peerId == $root.wallet.network.peerId?' (You)':'')}}" ></video>
|
|
||||||
<img ng-if="!$root.videoInfo[c.peerId]"
|
|
||||||
ng-class="($root.wallet.getOnlinePeerIDs().indexOf(c.peerId) != -1) ? 'online' : 'offline'"
|
ng-class="($root.wallet.getOnlinePeerIDs().indexOf(c.peerId) != -1) ? 'online' : 'offline'"
|
||||||
class="video-small"
|
ng-src="{{$root.getVideoURL(c.peerId)}}"
|
||||||
|
></video>
|
||||||
|
<img ng-if="!$root.videoInfo[c.peerId]"
|
||||||
|
avatar peer="{{c}}"
|
||||||
|
ng-class="($root.wallet.getOnlinePeerIDs().indexOf(c.peerId) != -1) ? 'online' : 'offline'"
|
||||||
src="./img/satoshi.gif"
|
src="./img/satoshi.gif"
|
||||||
title="{{c.peerId + (c.peerId == $root.wallet.network.peerId?' (You)':'')}}" />
|
/>
|
||||||
<span ng-if="c.nick" style="position:absolute; bottom:-10px; width: 80px; overflow: hidden;">{{c.nick}}</span>
|
<span ng-if="c.nick" style="position:absolute; bottom:-10px; width: 80px; overflow: hidden;">{{c.nick}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -240,7 +238,7 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-6 columns">
|
<div class="large-6 columns">
|
||||||
<h6>Select required number of signatures</h6>
|
<h6>Select required signatures</h6>
|
||||||
<select ng-model="requiredCopayers" ng-options="requiredCopayers as requiredCopayers for requiredCopayers in RCValues">
|
<select ng-model="requiredCopayers" ng-options="requiredCopayers as requiredCopayers for requiredCopayers in RCValues">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -89,12 +89,15 @@ angular.module('copay.directives')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).directive('confvideo', function($rootScope) {
|
}).directive('avatar', function($rootScope) {
|
||||||
return {
|
return {
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
var peer = attrs.peer;
|
var peer = JSON.parse(attrs.peer)
|
||||||
element.addClass(($rootScope.wallet.getOnlinePeerIDs().indexOf(peer) != -1) ? 'online' : 'offline');
|
var peerId = peer.peerId;
|
||||||
var muted = $rootScope.getVideoMutedStatus(peer);
|
var nick = peer.nick;
|
||||||
|
element.addClass('video-small');
|
||||||
|
element.attr('title', peerId + (peerId == $rootScope.wallet.network.peerId ? ' (You)' : ''));
|
||||||
|
var muted = $rootScope.getVideoMutedStatus(peerId);
|
||||||
if (muted) {
|
if (muted) {
|
||||||
element.attr("muted", true);
|
element.attr("muted", true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,15 @@ angular.module('copay.controllerUtils')
|
||||||
$rootScope.getVideoURL = function(copayer) {
|
$rootScope.getVideoURL = function(copayer) {
|
||||||
var vi = $rootScope.videoInfo[copayer]
|
var vi = $rootScope.videoInfo[copayer]
|
||||||
if (!vi) return;
|
if (!vi) return;
|
||||||
|
|
||||||
|
//alert($rootScope.wallet.getOnlinePeerIDs());
|
||||||
|
//alert(copayer);
|
||||||
|
if ($rootScope.wallet.getOnlinePeerIDs().indexOf(copayer) === -1) {
|
||||||
|
// peer disconnected, remove his video
|
||||||
|
delete $rootScope.videoInfo[copayer]
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var encoded = vi.url;
|
var encoded = vi.url;
|
||||||
var url = decodeURI(encoded);
|
var url = decodeURI(encoded);
|
||||||
var trusted = $sce.trustAsResourceUrl(url);
|
var trusted = $sce.trustAsResourceUrl(url);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue