fix conflict

This commit is contained in:
bechi 2014-08-01 11:38:07 -03:00
commit 2d3fdbe6fb
14 changed files with 57 additions and 12 deletions

View file

@ -21,6 +21,7 @@
"bitcore": "0.1.34",
"angular-moment": "~0.7.1",
"socket.io-client": ">=1.0.0",
"mousetrap": "1.4.6"
"mousetrap": "1.4.6",
"ng-idle": "*"
}
}

View file

@ -258,6 +258,11 @@ a:hover {
margin-bottom: 20px;
}
.box-setup label small.has-error {
font-size: 11px;
color: #FFA59B;
}
.last-transactions {
margin-bottom: 2rem;
background-color: #E8EAEF;

View file

@ -62,6 +62,7 @@
<script src="lib/angular-moment/angular-moment.js"></script>
<script src="lib/qrcode-generator/js/qrcode.js"></script>
<script src="lib/angular-qrcode/qrcode.js"></script>
<script src="lib/ng-idle/angular-idle.min.js"></script>
<script src="lib/angular-foundation/mm-foundation.min.js"></script>
<script src="lib/angular-foundation/mm-foundation-tpls.min.js"></script>
<script src="lib/peer.js"></script> <!-- TODO Change this on PeerJS version 0.3.9 -->

View file

@ -27,6 +27,7 @@ var copayApp = window.copayApp = angular.module('copayApp', [
'angularMoment',
'mm.foundation',
'monospaced.qrcode',
'ngIdle',
'copayApp.filters',
'copayApp.services',
'copayApp.controllers',
@ -40,6 +41,7 @@ copayApp.config(function($sceDelegateProvider) {
]);
});
angular.module('copayApp.filters', []);
angular.module('copayApp.services', []);
angular.module('copayApp.controllers', []);

View file

@ -82,4 +82,15 @@ angular.module('copayApp.controllers').controller('SidebarController',
// Init socket handlers (with no wallet yet)
controllerUtils.setSocketHandlers();
if ($rootScope.wallet) {
$scope.$on('$idleStart', function(a) {
notification.warning('Session will be closed', 'Your session is about to expire due to inactivity');
});
$scope.$on('$idleTimeout', function() {
$scope.signout();
notification.warning('Session closed', 'Session closed because a long time of inactivity');
});
}
});

View file

@ -18,7 +18,7 @@ function HDParams(opts) {
HDParams.init = function(totalCopayers) {
preconditions.shouldBeNumber(totalCopayers);
var ret = [new HDParams()];
var ret = [new HDParams({receiveIndex: 1})];
for (var i = 0 ; i < totalCopayers ; i++) {
ret.push(new HDParams({copayerIndex: i}));
}

View file

@ -65,17 +65,22 @@ angular
//Setting HTML5 Location Mode
angular
.module('copayApp')
.config(function($locationProvider) {
.config(function($locationProvider, $idleProvider) {
$locationProvider
.html5Mode(false)
.hashPrefix('!');
// IDLE timeout
$idleProvider.idleDuration(15 * 60); // in seconds
$idleProvider.warningDuration(10); // in seconds
})
.run(function($rootScope, $location) {
.run(function($rootScope, $location, $idle) {
$idle.watch();
$rootScope.$on('$routeChangeStart', function(event, next, current) {
if (!util.supports.data) {
$location.path('unsupported');
} else {
if ((!$rootScope.wallet || !$rootScope.wallet.id) && next.validate) {
$idle.unwatch();
$location.path('/');
}
if ($rootScope.wallet && !$rootScope.wallet.isReady()) {

View file

@ -185,13 +185,14 @@ angular.module('copayApp.services')
root.updateAddressList = function() {
var w = $rootScope.wallet;
if (w)
if (w && w.isReady())
$rootScope.addrInfos = w.getAddressesInfo();
};
root.updateBalance = function(cb) {
var w = $rootScope.wallet;
if (!w) return root.onErrorDigest();
if (!w.isReady()) return;
$rootScope.balanceByAddr = {};
$rootScope.updatingBalance = true;

View file

@ -21,6 +21,7 @@ module.exports = function(config) {
'lib/angular/angular.min.js',
'lib/angular-mocks/angular-mocks.js',
'lib/moment/moment.js',
'lib/ng-idle/angular-idle.min.js',
'lib/angular-moment/angular-moment.js',
'lib/qrcode-generator/js/qrcode.js',
'lib/angular-qrcode/qrcode.js',

View file

@ -46,6 +46,10 @@ FakeWallet.prototype.getAddressesInfo = function() {
return ret;
};
FakeWallet.prototype.isReady = function() {
return true;
}
FakeWallet.prototype.getBalance = function(cb) {
return cb(null, this.balance, this.balanceByAddr, this.safeBalance);

View file

@ -145,9 +145,8 @@ describe('PublicKeyRing model', function() {
var k = createW();
var w = k.w;
var a = w.getAddresses();
a.length.should.equal(0);
a.length.should.equal(1);
[true, false].forEach(function(isChange){
for (var i = 0; i < 2; i++) {
@ -156,15 +155,22 @@ describe('PublicKeyRing model', function() {
});
var as = w.getAddressesInfo();
as.length.should.equal(4);
as.length.should.equal(5); // include pre-generated shared one
for (var j in as) {
var a = as[j];
a.address.isValid().should.equal(true);
a.addressStr.should.equal(a.address.toString());
a.isChange.should.equal([false, false, true, true][j]);
a.isChange.should.equal([false, false, false, true, true][j]);
}
});
it('should start with one shared address', function() {
var k = createW();
var a = k.w.getAddresses();
a.length.should.equal(1);
});
it('should count generation indexes', function() {
var k = createW();
var w = k.w;

View file

@ -594,7 +594,7 @@ describe('Wallet model', function() {
it('should get balance', function(done) {
var w = createW();
var w = createW2();
var spy = sinon.spy(w.blockchain, 'getUnspent');
w.blockchain.fixUnspent([]);
w.getBalance(function(err, balance, balanceByAddr, safeBalance) {

View file

@ -11,7 +11,15 @@
<div class="box-setup">
<h1 class="text-primary line-sidebar-b">Join a Wallet in Creation</h1>
<form name="joinForm" ng-submit="join(joinForm)" novalidate>
<label for="connectionId"> Wallet Setting </label>
<label for="connectionId"> Wallet Setting
<small class="has-error" ng-show="joinForm.connectionId.$invalid
&& !joinForm.connectionId.$pristine">Wallet Secret is not valid!</small>
<small data-options="disable_for_touch:true"
ng-show="joinForm.connectionId.$pristine" class="has-tip
text-gray" tooltip="Paste wallet secret here" >Required</small>
</label>
<input id="connectionId" type="text" class="small-9 columns" placeholder="Paste wallet secret here" name="connectionId" ng-model="connectionId" wallet-secret required style="width:85%;">
<div class="small-2 columns" style="padding:0px;width:15%;" ng-hide="showScanner">
<a class="postfix button primary" ng-click="openScanner()"><i class="fi-camera">&nbsp;</i></a>

View file

@ -1,6 +1,6 @@
<div class="text-center">
<qrcode size="250" data="{{address.address}}"></qrcode>
<div class="m10t">
<h4>{{address.address}}</h4>
<span ng-if="$root.updatingBalance">