Merge branch 'ref/design' of github.com:matiu/copay into ref/design
This commit is contained in:
commit
3bac497049
6 changed files with 186 additions and 174 deletions
|
|
@ -20,6 +20,8 @@ ios: $(WORKDIR)ios
|
||||||
|
|
||||||
android: project-android
|
android: project-android
|
||||||
mkdir -p android/platforms/android/res/xml/
|
mkdir -p android/platforms/android/res/xml/
|
||||||
|
mkdir $(WORKDIR)android/scripts
|
||||||
|
cp -R scripts/* $(WORKDIR)android/scripts
|
||||||
cp android/build-extras.gradle $(WORKDIR)android/platforms/android/build-extras.gradle
|
cp android/build-extras.gradle $(WORKDIR)android/platforms/android/build-extras.gradle
|
||||||
cp android/project.properties $(WORKDIR)android/platforms/android/project.properties
|
cp android/project.properties $(WORKDIR)android/platforms/android/project.properties
|
||||||
cp -R android/res/* $(WORKDIR)android/platforms/android/res
|
cp -R android/res/* $(WORKDIR)android/platforms/android/res
|
||||||
|
|
|
||||||
|
|
@ -1,86 +1,95 @@
|
||||||
<ion-modal-view ng-controller="searchController">
|
<ion-modal-view>
|
||||||
<ion-header-bar align-title="center" class="tab-bar" ng-style="{'background-color':color}">
|
<ion-header-bar align-title="center" class="tab-bar" ng-style="{'background-color':color}">
|
||||||
<div class="left-small">
|
<div class="left-small">
|
||||||
<a ng-click="cancel(); index.cancelSearch()" class="p10">
|
<a ng-click="cancel()" class="p10">
|
||||||
<span class="text-close" translate>Close</span>
|
<span class="text-close" translate>Close</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<h1 class="title ellipsis" translate>Search Transactions</h1>
|
<h1 class="title ellipsis" translate>Search Transactions</h1>
|
||||||
</ion-header-bar>
|
</ion-header-bar>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content ng-controller="searchController">
|
||||||
<div class="row searchBar searchLabel">
|
<div class="bar bar-header item-input-inset">
|
||||||
<i class="fi-magnifying-glass size-14"></i>
|
<label class="item-input-wrapper">
|
||||||
<form>
|
<i class="icon ion-ios-search placeholder-icon"></i>
|
||||||
<input name="search" type="search" ng-model="search" ng-init="search = ''" ng-change="index.updateSearchInput(search)"
|
<input type="search" ng-model="search" ng-init="search = ''" ng-change="updateSearchInput(search)"
|
||||||
placeholder="{{'Search transactions' | translate}}">
|
placeholder="{{'Search transactions' | translate}}">
|
||||||
</input>
|
</label>
|
||||||
</form>
|
<button class="button button-stable" ng-click="cancelSearch()">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-repeat="btx in index.txHistorySearchResults track by btx.txid"
|
<div class="list">
|
||||||
ng-click="home.openTxModal(btx)"
|
<div class="row item" ng-repeat="btx in txHistorySearchResults track by btx.txid" ng-click="openTxModal(btx)">
|
||||||
class="row collapse last-transactions-content">
|
<div class="col col-10">
|
||||||
<div class="large-6 medium-6 small-6 columns size-14">
|
<img src="img/icon-receive-history.svg" alt="sync" width="40" ng-if="btx.action == 'received'">
|
||||||
<div class="m10r left">
|
<img src="img/icon-sent-history.svg" alt="sync" width="40" ng-if="btx.action == 'sent'">
|
||||||
<img src="img/icon-receive-history.svg" alt="sync" width="40" ng-show="btx.action == 'received'">
|
<img src="img/icon-moved.svg" alt="sync" width="40" ng-if="btx.action == 'moved'">
|
||||||
<img src="img/icon-sent-history.svg" alt="sync" width="40" ng-show="btx.action == 'sent'">
|
|
||||||
<img src="img/icon-moved.svg" alt="sync" width="40" ng-show="btx.action == 'moved'">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="m10t">
|
|
||||||
<span ng-show="btx.action == 'received'">
|
<div class="col col-50">
|
||||||
|
<div class="padding" ng-if="btx.action == 'received'">
|
||||||
<span class="ellipsis">
|
<span class="ellipsis">
|
||||||
<span ng-if="btx.note.body">{{btx.note.body}}</span>
|
<h2 ng-if="btx.note.body">{{btx.note.body}}</h2>
|
||||||
<span ng-if="!btx.note.body" translate> Received</span>
|
<h2 ng-if="!btx.note.body" translate> Received</h2>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="padding" ng-if="btx.action == 'sent'">
|
||||||
|
<span class="ellipsis">
|
||||||
|
<h2 ng-if="btx.message">{{btx.message}}</h2>
|
||||||
|
<h2 ng-if="!btx.message && btx.note.body">{{btx.note.body}}</h2>
|
||||||
|
<h2 ng-if="!btx.message && !btx.note.body && wallet.addressbook[btx.addressTo]">{{wallet.addressbook[btx.addressTo]}}</h2>
|
||||||
|
<h2 ng-if="!btx.message && !btx.note.body && !wallet.addressbook[btx.addressTo]" translate> Sent</h2>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="padding" ng-if="btx.action == 'moved'">
|
||||||
|
<span class="ellipsis">
|
||||||
|
<h2 ng-if="btx.note.body">{{btx.note.body}}</h2>
|
||||||
|
<h2 ng-if="!btx.note.body" translate>Moved</h2>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="label tu warning radius" ng-if="btx.action == 'invalid'" translate>Invalid</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col col-30 padding">
|
||||||
|
<span class="size-16" ng-class="{'text-bold': btx.recent}">
|
||||||
|
<span ng-if="btx.action == 'received'">+</span>
|
||||||
|
<span ng-if="btx.action == 'sent'">-</span>
|
||||||
|
<span class="size-12" ng-if="btx.action == 'invalid'" translate>
|
||||||
|
(possible double spend)
|
||||||
|
</span>
|
||||||
|
<span ng-if="btx.action != 'invalid'">
|
||||||
|
{{btx.amountStr}}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span ng-show="btx.action == 'sent'">
|
<p>
|
||||||
<span class="ellipsis">
|
<time ng-if="btx.time">{{btx.time * 1000 | amTimeAgo}}</time>
|
||||||
<span ng-if="btx.message">{{btx.message}}</span>
|
<span translate class="text-warning"
|
||||||
<span ng-if="!btx.message && btx.note.body">{{btx.note.body}}</span>
|
ng-show="!btx.time && (!btx.confirmations || btx.confirmations == 0)">
|
||||||
<span ng-if="!btx.message && !btx.note.body && index.addressbook[btx.addressTo]">{{index.addressbook[btx.addressTo]}}</span>
|
Unconfirmed
|
||||||
<span ng-if="!btx.message && !btx.note.body && !index.addressbook[btx.addressTo]" translate> Sent</span>
|
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</p>
|
||||||
<span ng-show="btx.action == 'moved'" translate>Moved</span>
|
</div>
|
||||||
<span class="label tu warning radius" ng-show="btx.action == 'invalid'" translate>Invalid</span>
|
|
||||||
|
<div class="col col-10 text-center">
|
||||||
|
<i class="icon ion-chevron-right"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-gray text-center size-12 p10t" ng-if="txHistoryShowMore">
|
||||||
|
<span class="size-12" translate>{{filteredTxHistory.length - txHistorySearchResults.length}} more</span>
|
||||||
|
|
||||||
|
<i class="icon-arrow-down4"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="large-5 medium-5 small-5 columns text-right" >
|
<ion-infinite-scroll
|
||||||
<span class="size-16" ng-class="{'text-bold': btx.recent}">
|
ng-if="txHistoryShowMore"
|
||||||
<span ng-if="btx.action == 'received'">+</span>
|
on-infinite="moreSearchResults()"
|
||||||
<span ng-if="btx.action == 'sent'">-</span>
|
distance="1%">
|
||||||
<span class="size-12" ng-if="btx.action == 'invalid'" translate>
|
</ion-infinite-scroll>
|
||||||
(possible double spend)
|
|
||||||
</span>
|
|
||||||
<span ng-if="btx.action != 'invalid'">
|
|
||||||
{{btx.amountStr}}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<div class="size-12 text-gray">
|
|
||||||
<time ng-if="btx.time">{{btx.time * 1000 | amTimeAgo}}</time>
|
|
||||||
<span translate class="text-warning"
|
|
||||||
ng-show="!btx.time && (!btx.confirmations || btx.confirmations == 0)">
|
|
||||||
Unconfirmed
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="large-1 medium-1 small-1 columns text-right m10t">
|
|
||||||
<i class="icon-arrow-right3 size-18"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-gray text-center size-12 p10t" ng-if="index.historyShowMore">
|
|
||||||
<span class="size-12" translate>{{index.result.length - index.txHistorySearchResults.length}} more</span>
|
|
||||||
|
|
||||||
<i class="icon-arrow-down4"></i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ion-infinite-scroll
|
|
||||||
ng-if="index.historyShowMore && index.isSearching"
|
|
||||||
on-infinite="index.showMore()"
|
|
||||||
distance="1%">
|
|
||||||
</ion-infinite-scroll>
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-modal-view>
|
</ion-modal-view>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content ng-controller="walletDetailsController" ng-init="init()" cache-view="false" delegate-handle="my-handle" overflow-scroll="true">
|
<ion-content ng-controller="walletDetailsController" ng-init="init()" cache-view="false" delegate-handle="my-handle" overflow-scroll="true">
|
||||||
<div ng-show="!wallet">
|
<div ng-show="!wallet">
|
||||||
No Wallet
|
No Wallet
|
||||||
<a href ui-sref="tabs.home" class="button">
|
<a href ui-sref="tabs.home" class="button">
|
||||||
|
|
|
||||||
|
|
@ -1,72 +1,88 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('searchController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, $ionicScrollDelegate, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService) {
|
||||||
|
|
||||||
//
|
var HISTORY_SHOW_LIMIT = 10;
|
||||||
// self.startSearch = function() {
|
var currentTxHistoryPage = 0;
|
||||||
// self.isSearching = true;
|
var wallet;
|
||||||
// self.txHistorySearchResults = [];
|
var isCordova = platformInfo.isCordova;
|
||||||
// self.result = [];
|
$scope.txHistorySearchResults = [];
|
||||||
// self.historyShowMore = false;
|
$scope.filteredTxHistory = [];
|
||||||
// self.nextTxHistory = self.historyShowMoreLimit;
|
|
||||||
// }
|
$scope.cancel = function() {
|
||||||
//
|
$scope.searchModal.hide();
|
||||||
// self.cancelSearch = function() {
|
};
|
||||||
// self.isSearching = false;
|
|
||||||
// self.result = [];
|
$scope.cancelSearch = function() {
|
||||||
// self.setCompactTxHistory();
|
$scope.txHistorySearchResults = [];
|
||||||
// }
|
$scope.filteredTxHistory = [];
|
||||||
//
|
$scope.search = '';
|
||||||
// self.updateSearchInput = function(search) {
|
$scope.currentTxHistoryPage = 0;
|
||||||
// self.search = search;
|
$ionicScrollDelegate.resize();
|
||||||
// if (isCordova)
|
}
|
||||||
// window.plugins.toast.hide();
|
|
||||||
// self.throttleSearch();
|
$scope.updateSearchInput = function(search) {
|
||||||
// $ionicScrollDelegate.resize();
|
if (isCordova)
|
||||||
// }
|
window.plugins.toast.hide();
|
||||||
//
|
throttleSearch(search);
|
||||||
// self.throttleSearch = lodash.throttle(function() {
|
$ionicScrollDelegate.resize();
|
||||||
//
|
}
|
||||||
// function filter(search) {
|
|
||||||
// self.result = [];
|
var throttleSearch = lodash.throttle(function(search) {
|
||||||
//
|
|
||||||
// function computeSearchableString(tx) {
|
function filter(search) {
|
||||||
// var addrbook = '';
|
$scope.filteredTxHistory = [];
|
||||||
// if (tx.addressTo && self.addressbook && self.addressbook[tx.addressTo]) addrbook = self.addressbook[tx.addressTo] || '';
|
|
||||||
// var searchableDate = computeSearchableDate(new Date(tx.time * 1000));
|
function computeSearchableString(tx) {
|
||||||
// var message = tx.message ? tx.message : '';
|
var addrbook = '';
|
||||||
// var comment = tx.note ? tx.note.body : '';
|
if (tx.addressTo && self.addressbook && self.addressbook[tx.addressTo]) addrbook = self.addressbook[tx.addressTo] || '';
|
||||||
// var addressTo = tx.addressTo ? tx.addressTo : '';
|
var searchableDate = computeSearchableDate(new Date(tx.time * 1000));
|
||||||
// return ((tx.amountStr + message + addressTo + addrbook + searchableDate + comment).toString()).toLowerCase();
|
var message = tx.message ? tx.message : '';
|
||||||
// }
|
var comment = tx.note ? tx.note.body : '';
|
||||||
//
|
var addressTo = tx.addressTo ? tx.addressTo : '';
|
||||||
// function computeSearchableDate(date) {
|
return ((tx.amountStr + message + addressTo + addrbook + searchableDate + comment).toString()).toLowerCase();
|
||||||
// var day = ('0' + date.getDate()).slice(-2).toString();
|
}
|
||||||
// var month = ('0' + (date.getMonth() + 1)).slice(-2).toString();
|
|
||||||
// var year = date.getFullYear();
|
function computeSearchableDate(date) {
|
||||||
// return [month, day, year].join('/');
|
var day = ('0' + date.getDate()).slice(-2).toString();
|
||||||
// };
|
var month = ('0' + (date.getMonth() + 1)).slice(-2).toString();
|
||||||
//
|
var year = date.getFullYear();
|
||||||
// if (lodash.isEmpty(search)) {
|
return [month, day, year].join('/');
|
||||||
// self.historyShowMore = false;
|
};
|
||||||
// return [];
|
|
||||||
// }
|
if (lodash.isEmpty(search)) {
|
||||||
// self.result = lodash.filter(self.completeHistory, function(tx) {
|
$scope.txHistoryShowMore = false;
|
||||||
// if (!tx.searcheableString) tx.searcheableString = computeSearchableString(tx);
|
return [];
|
||||||
// return lodash.includes(tx.searcheableString, search.toLowerCase());
|
}
|
||||||
// });
|
|
||||||
//
|
$scope.filteredTxHistory = lodash.filter($scope.completeTxHistory, function(tx) {
|
||||||
// if (self.result.length > self.historyShowLimit) self.historyShowMore = true;
|
if (!tx.searcheableString) tx.searcheableString = computeSearchableString(tx);
|
||||||
// else self.historyShowMore = false;
|
return lodash.includes(tx.searcheableString, search.toLowerCase());
|
||||||
//
|
});
|
||||||
// return self.result;
|
|
||||||
// };
|
if ($scope.filteredTxHistory.length > HISTORY_SHOW_LIMIT) $scope.txHistoryShowMore = true;
|
||||||
//
|
else $scope.txHistoryShowMore = false;
|
||||||
// self.txHistorySearchResults = filter(self.search).slice(0, self.historyShowLimit);
|
|
||||||
// if (isCordova)
|
return $scope.filteredTxHistory;
|
||||||
// window.plugins.toast.showShortBottom(gettextCatalog.getString('Matches: ' + self.result.length));
|
};
|
||||||
//
|
$scope.txHistorySearchResults = filter(search).slice(0, HISTORY_SHOW_LIMIT);
|
||||||
// $timeout(function() {
|
if (isCordova)
|
||||||
// $rootScope.$apply();
|
window.plugins.toast.showShortBottom(gettextCatalog.getString('Matches: ' + $scope.filteredTxHistory.length));
|
||||||
// });
|
$timeout(function() {
|
||||||
//
|
$rootScope.$apply();
|
||||||
// }, 1000);
|
});
|
||||||
//
|
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
$scope.moreSearchResults = function() {
|
||||||
|
currentTxHistoryPage++;
|
||||||
|
$scope.showHistory();
|
||||||
|
$scope.$broadcast('scroll.infiniteScrollComplete');
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.showHistory = function() {
|
||||||
|
$scope.txHistorySearchResults = $scope.filteredTxHistory ? $scope.filteredTxHistory.slice(0, (currentTxHistoryPage + 1) * HISTORY_SHOW_LIMIT) : [];
|
||||||
|
$scope.txHistoryShowMore = $scope.filteredTxHistory.length > $scope.txHistorySearchResults.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
$scope.openSearchModal = function() {
|
$scope.openSearchModal = function() {
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
var wallet = profileService.getWallet($stateParams.walletId);
|
||||||
$scope.color = wallet.color;
|
$scope.color = wallet.color;
|
||||||
$scope.self = self;
|
|
||||||
|
|
||||||
$ionicModal.fromTemplateUrl('views/modals/search.html', {
|
$ionicModal.fromTemplateUrl('views/modals/search.html', {
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
|
|
@ -73,7 +72,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
|
|
||||||
var progressFn = function(txs) {
|
var progressFn = function(txs) {
|
||||||
$scope.updatingTxHistoryProgress = txs ? txs.length : 0;
|
$scope.updatingTxHistoryProgress = txs ? txs.length : 0;
|
||||||
completeTxHistory = txs;
|
$scope.completeTxHistory = txs;
|
||||||
$scope.showHistory();
|
$scope.showHistory();
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
};
|
};
|
||||||
|
|
@ -88,7 +87,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
$scope.updateTxHistoryError = true;
|
$scope.updateTxHistoryError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
completeTxHistory = txHistory;
|
$scope.completeTxHistory = txHistory;
|
||||||
|
|
||||||
$scope.showHistory();
|
$scope.showHistory();
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
@ -97,12 +96,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showHistory = function() {
|
$scope.showHistory = function() {
|
||||||
if ($scope.isSearching) {
|
if ($scope.completeTxHistory) {
|
||||||
$scope.txHistorySearchResults = filteredTxHistory ? filteredTxHistory.slice(0, (currentTxHistoryPage + 1) * HISTORY_SHOW_LIMIT) : [];
|
$scope.txHistory = $scope.completeTxHistory.slice(0, (currentTxHistoryPage + 1) * HISTORY_SHOW_LIMIT);
|
||||||
$scope.txHistoryShowMore = filteredTxHistory.length > $scope.txHistorySearchResults.length;
|
$scope.txHistoryShowMore = $scope.completeTxHistory.length > $scope.txHistory.length;
|
||||||
} else if (completeTxHistory) {
|
|
||||||
$scope.txHistory = completeTxHistory.slice(0, (currentTxHistoryPage + 1) * HISTORY_SHOW_LIMIT);
|
|
||||||
$scope.txHistoryShowMore = completeTxHistory.length > $scope.txHistory.length;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -122,12 +118,11 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
};
|
};
|
||||||
|
|
||||||
var currentTxHistoryPage;
|
var currentTxHistoryPage;
|
||||||
var completeTxHistory;
|
|
||||||
var wallet;
|
var wallet;
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
currentTxHistoryPage = 0;
|
currentTxHistoryPage = 0;
|
||||||
completeTxHistory = [];
|
$scope.completeTxHistory = [];
|
||||||
|
|
||||||
wallet = profileService.getWallet($stateParams.walletId);
|
wallet = profileService.getWallet($stateParams.walletId);
|
||||||
$scope.wallet = wallet;
|
$scope.wallet = wallet;
|
||||||
|
|
|
||||||
|
|
@ -608,7 +608,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.state('amazon', {
|
.state('amazon', {
|
||||||
url: '/amazon',
|
url: '/amazon',
|
||||||
abstract: true,
|
abstract: true,
|
||||||
template: '<ion-nav-view name="amazon"></ion-nav-view>'
|
template: '<ion-nav-view name="amazon"></ion-nav-view>'
|
||||||
|
|
@ -630,7 +630,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog) {
|
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog) {
|
||||||
|
|
||||||
if (platformInfo.isCordova) {
|
if (platformInfo.isCordova) {
|
||||||
if (screen.width < 768) {
|
if (screen.width < 768) {
|
||||||
|
|
@ -678,14 +678,28 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
StatusBar.styleLightContent();
|
StatusBar.styleLightContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ionicPlatform.registerBackButtonAction(function(event) {
|
$ionicPlatform.registerBackButtonAction(function(e) {
|
||||||
event.preventDefault();
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
var secondBackButtonPress = false;
|
var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : '';
|
||||||
var intval = setInterval(function() {
|
var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : '';
|
||||||
secondBackButtonPress = false;
|
|
||||||
}, 5000);
|
if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) {
|
||||||
|
ionic.Platform.exitApp();
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ($ionicHistory.backView() && !fromTabs) {
|
||||||
|
$ionicHistory.goBack();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$rootScope.backButtonPressedOnceToExit = true;
|
||||||
|
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
|
||||||
|
setInterval(function() {
|
||||||
|
$rootScope.backButtonPressedOnceToExit = false;
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
101);
|
||||||
|
|
||||||
$ionicPlatform.on('pause', function() {
|
$ionicPlatform.on('pause', function() {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
|
|
@ -695,30 +709,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
$rootScope.$emit('Local/Resume');
|
$rootScope.$emit('Local/Resume');
|
||||||
});
|
});
|
||||||
|
|
||||||
$ionicPlatform.on('backbutton', function(event) {
|
|
||||||
|
|
||||||
var loc = window.location;
|
|
||||||
var fromDisclaimer = loc.toString().match(/disclaimer/) ? 'true' : '';
|
|
||||||
var fromHome = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
|
|
||||||
|
|
||||||
if (fromDisclaimer == 'true')
|
|
||||||
navigator.app.exitApp();
|
|
||||||
|
|
||||||
if (platformInfo.isMobile && fromHome == 'true') {
|
|
||||||
if (secondBackButtonPress)
|
|
||||||
navigator.app.exitApp();
|
|
||||||
else
|
|
||||||
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (secondBackButtonPress)
|
|
||||||
clearInterval(intval);
|
|
||||||
else
|
|
||||||
secondBackButtonPress = true;
|
|
||||||
|
|
||||||
$state.go('tabs.home');
|
|
||||||
});
|
|
||||||
|
|
||||||
$ionicPlatform.on('menubutton', function() {
|
$ionicPlatform.on('menubutton', function() {
|
||||||
window.location = '#/preferences';
|
window.location = '#/preferences';
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue