Skip to content

Commit

Permalink
Merge pull request #28 from kakysha/master
Browse files Browse the repository at this point in the history
fix chat bugs
  • Loading branch information
tonyofbyteball authored Jan 20, 2017
2 parents 55e9c2a + 687736f commit eb71027
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion public/views/correspondentDevices.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>

<div ui-view="dialog"></div>
<div class="m20b tab-view tab-in" ng-show="state.is('correspondentDevices')">
<div class="m20b tab-view tab-in" ng-show="state.is('correspondentDevices')" id="chat">
<ul class="no-bullet m0 correspondentList" ng-init="readList()">
<li class="p10 line-b" ng-repeat="correspondent in list | orderBy:newMsgByAddressComparator">
<a ng-show="selectedCorrespondentList[correspondent.device_address]"
Expand Down
2 changes: 1 addition & 1 deletion public/views/walletHome.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ <h4 ng-class="{'enable_text_select': !index.isCordova}" class="size-12">
</button>
</div>
</div>
<div class="m20t text-center" ng-show="!home.generatingAddress && home.addr[index.walletId]">
<div class="m20t text-center m30b" ng-show="!home.generatingAddress && home.addr[index.walletId]">
<a class="size-12 text-gray" ng-click="home.openCustomizedAmountModal(home.addr[index.walletId])">
<i class="fi-bitcoin"></i>
<span translate>Request a specific amount</span>
Expand Down
49 changes: 26 additions & 23 deletions src/js/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,29 @@ angular.module('copayApp.controllers').controller('indexController', function($r
console.log("setTab", tab, reset, tries, switchState);
tries = tries || 0;

var changeTab = function(tab) {
if (document.querySelector('.tab-in.tab-view')) {
var el = angular.element(document.querySelector('.tab-in.tab-view'));
el.removeClass('tab-in').addClass('tab-out');
var old = document.getElementById('menu-' + self.tab);
if (old) {
old.className = '';
}
}

if (document.getElementById(tab)) {
var el = angular.element(document.getElementById(tab));
el.removeClass('tab-out').addClass('tab-in');
var newe = document.getElementById('menu-' + tab);
if (newe) {
newe.className = 'active';
}
}

$rootScope.tab = self.tab = tab;
$rootScope.$emit('Local/TabChanged', tab);
};

// check if the whole menu item passed
if (typeof tab == 'object') {
if (tab.open) {
Expand All @@ -633,6 +656,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
tab.open();
return;
} else if (tab.new_state) {
changeTab(tab.link);
$rootScope.tab = self.tab = tab.link;
go.path(tab.new_state);
return;
Expand All @@ -654,35 +678,14 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (!self.tab || !$state.is('walletHome'))
$rootScope.tab = self.tab = 'walletHome';

var changeTab = function() {
if (document.querySelector('.tab-in.tab-view')) {
document.querySelector('.tab-in.tab-view').className = 'tab-out tab-view ' + self.tab;
var old = document.getElementById('menu-' + self.tab);
if (old) {
old.className = '';
}
}

if (document.getElementById(tab)) {
document.getElementById(tab).className = 'tab-in tab-view ' + tab;
var newe = document.getElementById('menu-' + tab);
if (newe) {
newe.className = 'active';
}
}

$rootScope.tab = self.tab = tab;
$rootScope.$emit('Local/TabChanged', tab);
};

if (switchState && !$state.is('walletHome')) {
go.path('walletHome', function() {
changeTab();
changeTab(tab);
});
return;
}

changeTab();
changeTab(tab);
};


Expand Down
6 changes: 4 additions & 2 deletions src/js/services/correspondentListService.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ angular.module('copayApp.services').factory('correspondentListService', function
$rootScope.newMessagesCount[peer_address] = 1;
}
if ($state.is('walletHome') && $rootScope.tab == 'walletHome') {
$stickyState.reset('correspondentDevices.correspondentDevice');
go.path('correspondentDevices.correspondentDevice');
setCurrentCorrespondent(peer_address, function(bAnotherCorrespondent){
$stickyState.reset('correspondentDevices.correspondentDevice');
go.path('correspondentDevices.correspondentDevice');
});
}
else
$rootScope.$digest();
Expand Down

0 comments on commit eb71027

Please sign in to comment.