support wide screens

This commit is contained in:
Gabriel Bazán 2016-06-23 16:18:18 -03:00
commit 2c300d422e
7 changed files with 44 additions and 15 deletions

View file

@ -18,6 +18,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
ret.historyShowMoreLimit = 10;
ret.isSearching = false;
ret.prevState = 'walletHome';
ret.physicalScreenWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width);
ret.menu = [{
'title': gettext('Receive'),
@ -1677,6 +1678,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setTab(tab, reset);
});
$rootScope.$on('Local/WindowResize', function() {
self.physicalScreenWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width);
});
$rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) {
function openConfirmationPopup(txp, cb) {

View file

@ -510,9 +510,34 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
})
.run(function($rootScope, $state, $location, $log, $timeout, $ionicPlatform, platformInfo, profileService, uxLanguage, go, gettextCatalog) {
if (platformInfo.isCordova) {
if (screen.width < 768) {
screen.lockOrientation('portrait');
} else {
window.addEventListener("orientationchange", function() {
var leftMenuWidth = document.querySelector("ion-side-menu[side='left']").clientWidth;
if (screen.orientation.includes('portrait')) {
// Portrait
document.querySelector("ion-side-menu-content").style.width = (screen.width - leftMenuWidth) + "px";
} else {
// Landscape
document.querySelector("ion-side-menu-content").style.width = (screen.height - leftMenuWidth) + "px";
}
});
}
} else {
if (screen.width >= 768) {
window.addEventListener('resize', function() {
$rootScope.$emit('Local/WindowResize');
});
}
}
$ionicPlatform.ready(function() {
if (platformInfo.isCordova) {
ionic.Platform.fullScreen(true, false);
$ionicPlatform.registerBackButtonAction(function(event) {
event.preventDefault();
}, 100);