mirror of https://github.com/BTCPrivate/copay.git
Scanner button at topbar only for mobile
This commit is contained in:
parent
05e4c2abb8
commit
d0f8583122
|
@ -84,8 +84,10 @@
|
||||||
<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
|
<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="right-small" ng-show="$root.iden && $root.wallet.isComplete() && !$root.hideWalletNavigation">
|
<section class="right-small"
|
||||||
<a class="p10" ng-click="$root.go('more')"><i class="fi-widget size-24"></i></a>
|
ng-show="$root.iden && $root.wallet.isComplete() && !$root.hideWalletNavigation && isCordova">
|
||||||
|
<a class="p10"
|
||||||
|
ng-click="openScanner()"><i class="fi-camera size-24"></i></a>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="middle tab-bar-section">
|
<section class="middle tab-bar-section">
|
||||||
|
|
|
@ -73,6 +73,6 @@ angular.module('copayApp.controllers').controller('CreateController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on("$destroy", function () {
|
$scope.$on("$destroy", function () {
|
||||||
$rootScope.hideWalletNavigation = false;
|
$rootScope.hideWalletNavigation = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,7 +101,7 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
|
|
||||||
|
|
||||||
$scope.$on("$destroy", function () {
|
$scope.$on("$destroy", function () {
|
||||||
$rootScope.hideWalletNavigation = false;
|
$rootScope.hideWalletNavigation = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -155,6 +155,6 @@ angular.module('copayApp.controllers').controller('JoinController',
|
||||||
|
|
||||||
|
|
||||||
$scope.$on("$destroy", function () {
|
$scope.$on("$destroy", function () {
|
||||||
$rootScope.hideWalletNavigation = false;
|
$rootScope.hideWalletNavigation = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,6 +50,17 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (isCordova) {
|
||||||
|
var openScannerCordova = $rootScope.$on('dataScanned', function(event, data) {
|
||||||
|
$scope.sendForm.address.$setViewValue(data);
|
||||||
|
$scope.sendForm.address.$render();
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function() {
|
||||||
|
openScannerCordova();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$scope.formFocus = function(what) {
|
$scope.formFocus = function(what) {
|
||||||
if (!$scope.isWindowsPhoneApp) return
|
if (!$scope.isWindowsPhoneApp) return
|
||||||
|
|
||||||
|
@ -299,7 +310,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.openScanner = function() {
|
$scope.openScanner = function() {
|
||||||
if (window.cordova) return $scope.scannerIntent();
|
|
||||||
$scope.showScanner = true;
|
$scope.showScanner = true;
|
||||||
|
|
||||||
// Wait a moment until the canvas shows
|
// Wait a moment until the canvas shows
|
||||||
|
@ -324,31 +334,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.scannerIntent = function() {
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
cordova.plugins.barcodeScanner.scan(
|
|
||||||
function onSuccess(result) {
|
|
||||||
$timeout(function() {
|
|
||||||
window.ignoreMobilePause = false;
|
|
||||||
}, 100);
|
|
||||||
if (result.cancelled) return;
|
|
||||||
|
|
||||||
$timeout(function() {
|
|
||||||
var data = result.text;
|
|
||||||
$scope.$apply(function() {
|
|
||||||
$scope.sendForm.address.$setViewValue(result.text);
|
|
||||||
$scope.sendForm.address.$render();
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
},
|
|
||||||
function onError(error) {
|
|
||||||
$timeout(function() {
|
|
||||||
window.ignoreMobilePause = false;
|
|
||||||
}, 100);
|
|
||||||
alert('Scanning error');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.setTopAmount = function() {
|
$scope.setTopAmount = function() {
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
var form = $scope.sendForm;
|
var form = $scope.sendForm;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, $timeout, identityService, isMobile, go) {
|
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, $timeout, identityService, isMobile, isCordova, go) {
|
||||||
|
|
||||||
$scope.isMobile = isMobile.any()
|
$scope.isMobile = isMobile.any();
|
||||||
|
$scope.isCordova = isCordova;
|
||||||
|
|
||||||
$scope.menu = [{
|
$scope.menu = [{
|
||||||
'title': 'Home',
|
'title': 'Home',
|
||||||
|
@ -46,6 +47,32 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
|
||||||
$scope.setWallets();
|
$scope.setWallets();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.openScanner = function() {
|
||||||
|
window.ignoreMobilePause = true;
|
||||||
|
cordova.plugins.barcodeScanner.scan(
|
||||||
|
function onSuccess(result) {
|
||||||
|
$timeout(function() {
|
||||||
|
window.ignoreMobilePause = false;
|
||||||
|
}, 100);
|
||||||
|
if (result.cancelled) return;
|
||||||
|
|
||||||
|
$timeout(function() {
|
||||||
|
var data = result.text;
|
||||||
|
$scope.$apply(function() {
|
||||||
|
$rootScope.$emit('dataScanned', data);
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
|
function onError(error) {
|
||||||
|
$timeout(function() {
|
||||||
|
window.ignoreMobilePause = false;
|
||||||
|
}, 100);
|
||||||
|
alert('Scanning error');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
go.send();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
// This should be called only once.
|
// This should be called only once.
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,10 @@
|
||||||
<div class="large-8 medium-6 small-12 columns">
|
<div class="large-8 medium-6 small-12 columns">
|
||||||
<div class="ellipsis oh">
|
<div class="ellipsis oh">
|
||||||
<div class="avatar-wallet left">{{$root.wallet.getName() | limitTo: 1}}</div>
|
<div class="avatar-wallet left">{{$root.wallet.getName() | limitTo: 1}}</div>
|
||||||
<h2 class="m10t left">{{$root.wallet.getName()}}</h2>
|
<h2 class="m10t left">
|
||||||
|
{{$root.wallet.getName()}}
|
||||||
|
<a ng-click="$root.go('more')"><i class="fi-widget size-24"></i></a>
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-4 medium-6 small-12 columns">
|
<div class="large-4 medium-6 small-12 columns">
|
||||||
|
|
|
@ -1,19 +1,8 @@
|
||||||
<div class="send" ng-controller="SendController" ng-init="init()">
|
<div class="send" ng-controller="SendController" ng-init="init()">
|
||||||
<div class="row">
|
<div class="row show-for-large-up">
|
||||||
<h1 class="large-8 large-centered columns show-for-large-up">{{$root.title}}</h1>
|
<div class="large-8 large-centered columns">
|
||||||
</div>
|
|
||||||
<div class="row hide-for-medium-up" ng-hide="$root.wpInputFocused" >
|
|
||||||
<div class="large-10 medium-10 small-9 columns">
|
|
||||||
<h1>{{$root.title}}</h1>
|
<h1>{{$root.title}}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-2 medium-2 small-3 columns" ng-show="!lockAddress && !_merchantData">
|
|
||||||
<div ng-hide="showScanner || disableScanner">
|
|
||||||
<a class="button right m10b radius tiny black" ng-click="openScanner()"><i class="fi-camera size-18"></i></a>
|
|
||||||
</div>
|
|
||||||
<div ng-show="showScanner">
|
|
||||||
<a translate class="button right radius tiny m10b warning" ng-click="cancelScanner()"><i class="fi-x size-18"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" ng-show="fetchingURL">
|
<div class="row" ng-show="fetchingURL">
|
||||||
|
@ -31,20 +20,20 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" ng-show="creatingTX">
|
<div class="row" ng-show="creatingTX">
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="box-notification">
|
<div class="box-notification">
|
||||||
<div class="box-icon secondary">
|
<div class="box-icon secondary">
|
||||||
<i class="fi-bitcoin-circle icon-rotate spinner size-24"></i>
|
<i class="fi-bitcoin-circle icon-rotate spinner size-24"></i>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-secondary size-14">
|
<span class="text-secondary size-14">
|
||||||
Creating Transaction...
|
Creating Transaction...
|
||||||
</span>
|
</span>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="row" ng-show="!fetchingURL && !creatingTX">
|
<div class="row" ng-show="!fetchingURL && !creatingTX">
|
||||||
|
|
Loading…
Reference in New Issue