Merge pull request #5630 from cmgustavo/ref/remove-files-01

Ref/remove files 01
This commit is contained in:
Javier Donadío 2017-02-20 10:21:44 -05:00 committed by GitHub
commit 928dda70a4
7 changed files with 85 additions and 183 deletions

View File

@ -14,7 +14,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.canSign = $scope.wallet.canSign() || $scope.wallet.isPrivKeyExternal();
$scope.color = $scope.wallet.color;
$scope.data = {};
$scope.hasClick = platformInfo.hasClick;
$scope.displayAmount = getDisplayAmount($scope.tx.amountStr);
$scope.displayUnit = getDisplayUnit($scope.tx.amountStr);
initActionList();

View File

@ -1096,101 +1096,98 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
uxLanguage.init();
$ionicPlatform.ready(function() {
if (platformInfo.isCordova) {
if (screen.width < 768)
screen.lockOrientation('portrait');
if (screen.width < 768)
screen.lockOrientation('portrait');
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
cordova.plugins.Keyboard.disableScroll(true);
}
window.addEventListener('native.keyboardshow', function() {
document.body.classList.add('keyboard-open');
});
$ionicPlatform.registerBackButtonAction(function(e) {
//from root tabs view
var matchHome = $ionicHistory.currentStateName() == 'tabs.home' ? true : false;
var matchReceive = $ionicHistory.currentStateName() == 'tabs.receive' ? true : false;
var matchScan = $ionicHistory.currentStateName() == 'tabs.scan' ? true : false;
var matchSend = $ionicHistory.currentStateName() == 'tabs.send' ? true : false;
var matchSettings = $ionicHistory.currentStateName() == 'tabs.settings' ? true : false;
var fromTabs = matchHome | matchReceive | matchScan | matchSend | matchSettings;
//onboarding with no back views
var matchWelcome = $ionicHistory.currentStateName() == 'onboarding.welcome' ? true : false;
var matchCollectEmail = $ionicHistory.currentStateName() == 'onboarding.collectEmail' ? true : false;
var matchBackupRequest = $ionicHistory.currentStateName() == 'onboarding.backupRequest' ? true : false;
var matchNotifications = $ionicHistory.currentStateName() == 'onboarding.notifications' ? true : false;
var fromOnboarding = matchCollectEmail | matchBackupRequest | matchNotifications | matchWelcome;
if ($ionicHistory.backView() && !fromTabs && !fromOnboarding) {
$ionicHistory.goBack();
} else
if ($rootScope.backButtonPressedOnceToExit) {
ionic.Platform.exitApp();
} else {
$rootScope.backButtonPressedOnceToExit = true;
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
$timeout(function() {
$rootScope.backButtonPressedOnceToExit = false;
}, 3000);
}
e.preventDefault();
}, 101);
$ionicPlatform.on('pause', function() {
// Nothing to do
});
$ionicPlatform.on('resume', function() {
// Nothing to do
});
$ionicPlatform.on('menubutton', function() {
window.location = '#/preferences';
});
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
cordova.plugins.Keyboard.disableScroll(true);
}
$log.info('Init profile...');
// Try to open local profile
profileService.loadAndBindProfile(function(err) {
$ionicHistory.nextViewOptions({
disableAnimate: true
});
if (err) {
if (err.message && err.message.match('NOPROFILE')) {
$log.debug('No profile... redirecting');
window.addEventListener('native.keyboardshow', function() {
document.body.classList.add('keyboard-open');
});
$ionicPlatform.registerBackButtonAction(function(e) {
//from root tabs view
var matchHome = $ionicHistory.currentStateName() == 'tabs.home' ? true : false;
var matchReceive = $ionicHistory.currentStateName() == 'tabs.receive' ? true : false;
var matchScan = $ionicHistory.currentStateName() == 'tabs.scan' ? true : false;
var matchSend = $ionicHistory.currentStateName() == 'tabs.send' ? true : false;
var matchSettings = $ionicHistory.currentStateName() == 'tabs.settings' ? true : false;
var fromTabs = matchHome | matchReceive | matchScan | matchSend | matchSettings;
//onboarding with no back views
var matchWelcome = $ionicHistory.currentStateName() == 'onboarding.welcome' ? true : false;
var matchCollectEmail = $ionicHistory.currentStateName() == 'onboarding.collectEmail' ? true : false;
var matchBackupRequest = $ionicHistory.currentStateName() == 'onboarding.backupRequest' ? true : false;
var matchNotifications = $ionicHistory.currentStateName() == 'onboarding.notifications' ? true : false;
var fromOnboarding = matchCollectEmail | matchBackupRequest | matchNotifications | matchWelcome;
if ($ionicHistory.backView() && !fromTabs && !fromOnboarding) {
$ionicHistory.goBack();
} else
if ($rootScope.backButtonPressedOnceToExit) {
ionic.Platform.exitApp();
} else {
$rootScope.backButtonPressedOnceToExit = true;
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
$timeout(function() {
$rootScope.backButtonPressedOnceToExit = false;
}, 3000);
}
e.preventDefault();
}, 101);
$ionicPlatform.on('pause', function() {
// Nothing to do
});
$ionicPlatform.on('resume', function() {
// Nothing to do
});
$ionicPlatform.on('menubutton', function() {
window.location = '#/preferences';
});
});
$log.info('Init profile...');
// Try to open local profile
profileService.loadAndBindProfile(function(err) {
$ionicHistory.nextViewOptions({
disableAnimate: true
});
if (err) {
if (err.message && err.message.match('NOPROFILE')) {
$log.debug('No profile... redirecting');
$state.go('onboarding.welcome');
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
if (lodash.isEmpty(profileService.getWallets())) {
$log.debug('No wallets and no disclaimer... redirecting');
$state.go('onboarding.welcome');
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
if (lodash.isEmpty(profileService.getWallets())) {
$log.debug('No wallets and no disclaimer... redirecting');
$state.go('onboarding.welcome');
} else {
$log.debug('Display disclaimer... redirecting');
$state.go('onboarding.disclaimer', {
resume: true
});
}
} else {
throw new Error(err); // TODO
$log.debug('Display disclaimer... redirecting');
$state.go('onboarding.disclaimer', {
resume: true
});
}
} else {
profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.');
scannerService.gentleInitialize();
$state.go('tabs.home');
throw new Error(err); // TODO
}
} else {
profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.');
scannerService.gentleInitialize();
$state.go('tabs.home');
}
// After everything have been loaded, initialize handler URL
$timeout(function() {
openURLService.init();
}, 1000);
});
// After everything have been loaded, initialize handler URL
$timeout(function() {
openURLService.init();
}, 1000);
});
if (platformInfo.isNW) {

View File

@ -1,34 +0,0 @@
'use strict';
angular.module('copayApp.services').service('addonManager', function (lodash) {
var addons = [];
this.registerAddon = function (addonSpec) {
addons.push(addonSpec);
};
this.addonMenuItems = function () {
return lodash.map(addons, function (addonSpec) {
return addonSpec.menuItem;
});
};
this.addonViews = function () {
return lodash.map(addons, function (addonSpec) {
return addonSpec.view;
});
};
this.formatPendingTxp = function (txp) {
lodash.each(addons, function (addon) {
if (addon.formatPendingTxp) {
addon.formatPendingTxp(txp);
}
});
};
this.txTemplateUrl = function() {
var addon = lodash.find(addons, 'txTemplateUrl');
return addon ? addon.txTemplateUrl() : null;
}
});

View File

@ -1,7 +0,0 @@
'use strict';
'use strict';
angular.module('copayApp.services')
.factory('addressService', function(storageService, profileService, $log, $timeout, lodash, bwcError, gettextCatalog) {
var root = {};
return root;
});

View File

@ -1,37 +0,0 @@
'use strict';
angular.module('copayApp.services').factory('confirmDialog', function($log, $timeout, profileService, configService, gettextCatalog, platformInfo) {
var root = {};
var acceptMsg = gettextCatalog.getString('Accept');
var cancelMsg = gettextCatalog.getString('Cancel');
var confirmMsg = gettextCatalog.getString('Confirm');
root.show = function(msg, cb) {
if (platformInfo.isCordova) {
navigator.notification.confirm(
msg,
function(buttonIndex) {
if (buttonIndex == 1) {
$timeout(function() {
return cb(true);
}, 1);
} else {
return cb(false);
}
},
confirmMsg, [acceptMsg, cancelMsg]
);
} else if (platformInfo.isChromeApp) {
// No feedback, alert/confirm not supported.
return cb(true);
} else {
return cb(confirm(msg));
}
};
return root;
});

View File

@ -39,21 +39,5 @@ angular.module('copayApp.services').factory('platformInfo', function($window) {
ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW;
ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW;
ret.hasClick = false;
if ($window.sessionStorage.getItem('hasClick')) {
ret.hasClick = true;
}
$window.addEventListener('mousedown', function() {
ret.hasClick = true;
$window.sessionStorage.setItem('hasClick', 'true');
});
$window.addEventListener('touchstart', function() {
ret.hasClick = false;
$window.sessionStorage.removeItem('hasClick');
});
return ret;
});

View File

@ -163,13 +163,13 @@
<click-to-accept
ng-click="onConfirm(statusChangeHandler)"
ng-if="tx.pendingForUs && canSign && !paymentExpired && hasClick"
ng-if="tx.pendingForUs && canSign && !paymentExpired && !isCordova"
click-send-status="sendStatus"
has-wallet-chosen="true">
{{buttonText}}
</click-to-accept>
<slide-to-accept
ng-if="tx.pendingForUs && canSign && !paymentExpired && !hasClick"
ng-if="tx.pendingForUs && canSign && !paymentExpired && isCordova"
slide-on-confirm="onConfirm()"
slide-send-status="sendStatus"
has-wallet-chosen="true">