diff --git a/www/index.html b/www/index.html index 59b00cdad246eb1d24b74031ba4466ccd3b57b00..4b500bcee4650924f5b0ff1d4ce691b5aea936ea 100644 --- a/www/index.html +++ b/www/index.html @@ -59,9 +59,8 @@ ng-class="{'nobackdrop': $root.tour, 'expert-mode': $root.settings.expertMode, 'demo': $root.config.demo && !$root.config.readonly, 'readonly': $root.config.readonly}" style="background-color: #1a237e;"> <ion-nav-view> - <div class="loader"> - <h3 style="text-align: center; padding-top: 25px; color: whitesmoke;"><b>Cesium</b></h3> - <h4 style="text-align: center; color: whitesmoke;"><i class="icon ion-load-a"></i></h4> + <div class="loader center"> + <div class="logo"></div> </div> </ion-nav-view> diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index 87508125545f1ba216396cac2ebb1ccc88a1f638..2b4464c7e9d53971890e46b7cb4a1258bb417b2f 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -204,8 +204,8 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ if (csConfig.httpsMode && $window.location && $window.location.protocol !== 'https:') { var href = $window.location.href; var hashIndex = href.indexOf('#'); - var rootPath = (hashIndex != -1) ? href.substr(0, hashIndex) : href; - rootPath = 'https' + rootPath.substr(4); + var rootPath = (hashIndex !== -1) ? href.substring(0, hashIndex) : href; + rootPath = 'https' + rootPath.substring(4); href = rootPath + $state.href(state); if (csConfig.httpsModeDebug) { // Debug mode: just log, then continue @@ -569,19 +569,41 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ var skip = $scope.fullscreen || !UIUtils.screen.isSmall() || !Device.isWeb(); if (skip) return; + // Already ask + if (csSettings.data.useFullscreen === false) { + $scope.toggleFullscreen(false); + return; + } + + // User already say 'yes' => need o ask again (chrome will avoid changed if no gesture has been done) + //if (csSettings.data.useFullscreen === true) { + // $scope.toggleFullscreen(true); + // return; + //} + return UIUtils.alert.confirm('CONFIRM.FULLSCREEN', undefined, { cancelText: 'COMMON.BTN_NO', okText: 'COMMON.BTN_YES' }) .then(function(confirm) { - if (!confirm) return; - $scope.toggleFullscreen(); + $scope.toggleFullscreen(confirm); }); }; - $scope.toggleFullscreen = function() { - $scope.fullscreen = !UIUtils.screen.fullscreen.isEnabled(); - UIUtils.screen.fullscreen.toggleAll(); + $scope.toggleFullscreen = function(enable, options) { + enable = angular.isDefined(enable) ? enable : !UIUtils.screen.fullscreen.isEnabled(); + + $scope.fullscreen = enable; + + if (enable !== UIUtils.screen.fullscreen.isEnabled()) { + UIUtils.screen.fullscreen.toggleAll(); + } + + // Save into settings + if ((csSettings.data.useFullscreen !== enable) && (!options || options.emitEvent !== false)) { + csSettings.data.useFullscreen = enable; + return $timeout(csSettings.store, 2000); + } }; // removeIf(no-device) diff --git a/www/js/controllers/home-controllers.js b/www/js/controllers/home-controllers.js index be727b9fda90a460afa4f2a622ce0a047a914320..46cb297ab39116f96e0000c4fdf3a50e8486dd35 100644 --- a/www/js/controllers/home-controllers.js +++ b/www/js/controllers/home-controllers.js @@ -7,7 +7,7 @@ angular.module('cesium.home.controllers', ['cesium.platform', 'cesium.services'] .state('app.home', { - url: "/home?error&uri", + url: "/home?error&uri&login", views: { 'menuContent': { templateUrl: "templates/home/home.html", @@ -25,7 +25,7 @@ angular.module('cesium.home.controllers', ['cesium.platform', 'cesium.services'] ; function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $translate, $http, $q, $location, - UIUtils, BMA, Device, csConfig, csHttp, csCache, csPlatform, csNetwork, csCurrency, csSettings) { + UIUtils, BMA, Device, csConfig, csHttp, csCache, csPlatform, csNetwork, csCurrency, csSettings, csWallet) { 'ngInject'; $scope.loading = true; @@ -45,7 +45,6 @@ function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $tra } if (state && state.stateParams && state.stateParams.uri) { - return $scope.handleUri(state.stateParams.uri) .then(function() { $scope.loading = false; @@ -56,6 +55,7 @@ function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $tra $scope.node = csCurrency.data.node; $scope.loading = false; $scope.cleanLocationHref(state); + return $q.when(); } else { @@ -77,8 +77,10 @@ function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $tra $scope.$broadcast('$$rebind::loading'); // force rebind loading }, 200); + var hasLoginParam = state && state.stateParams && state.stateParams.login || false; + // Wait platform to be ready - csPlatform.ready() + return csPlatform.ready() .catch(function(err) { $scope.node = csCurrency.data.node; $scope.error = err; @@ -91,6 +93,14 @@ function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $tra $scope.loadingMessage = ''; $scope.loadingPct = 100; $scope.$broadcast('$$rebind::loading'); // force rebind loading + $scope.$broadcast('$$rebind::feed'); // force rebind feed + + // Open the login modal + if (hasLoginParam && !csWallet.isLogin() && !$scope.error) { + $scope.cleanLocationHref(state); + + return csWallet.login(); + } }); } }; @@ -126,8 +136,11 @@ function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $tra }; $scope.toggleFeed = function(show) { + $scope.showFeed = (show !== undefined) ? show : !$scope.showFeed; - $scope.$broadcast('$$rebind::feed'); // force rebind feed + if (!this.loading) { + $scope.$broadcast('$$rebind::feed'); // force rebind feed + } }; /* -- show/hide locales popup -- */ @@ -152,10 +165,13 @@ function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $tra // remove '?uri&error' from the location URI, and inside history $scope.cleanLocationHref = function(state) { + state = state || {stateName: 'app.home'}; + state.stateParams = state.stateParams || {}; if (state && state.stateParams) { var stateParams = angular.copy(state.stateParams); delete stateParams.uri; delete stateParams.error; + delete stateParams.login; $location.search(stateParams).replace(); @@ -167,7 +183,7 @@ function HomeController($scope, $state, $timeout, $interval, $ionicHistory, $tra }); return $state.go(state.stateName, stateParams, { reload: false, - inherit: true, + inherit: false, notify: false }); } diff --git a/www/js/controllers/login-controllers.js b/www/js/controllers/login-controllers.js index 47b0e1cbc1fb44633f2b795e24268151acf0666e..f921716f1c8124c5628a0c654a7fc22a93821f0f 100644 --- a/www/js/controllers/login-controllers.js +++ b/www/js/controllers/login-controllers.js @@ -1,24 +1,6 @@ angular.module('cesium.login.controllers', ['cesium.services']) - .config(function($stateProvider) { - 'ngInject'; - - $stateProvider - .state('app.login', { - url: "/login", - views: { - 'menuContent': { - templateUrl: "templates/home/home.html", - controller: 'LoginCtrl' - } - } - }) - ; - }) - - .controller('LoginCtrl', LoginController) - .controller('LoginModalCtrl', LoginModalController) .controller('AuthCtrl', AuthController) @@ -26,23 +8,6 @@ angular.module('cesium.login.controllers', ['cesium.services']) ; -function LoginController($scope, $timeout, $controller, csWallet) { - 'ngInject'; - - // Initialize the super class and extend it. - angular.extend(this, $controller('HomeCtrl', {$scope: $scope})); - - $scope.showLoginModal = function() { - if ($scope.loading) return $timeout($scope.showLoginModal, 500); // recursive call - - if (!csWallet.isLogin() && !$scope.error) { - return $timeout(csWallet.login, 300); - } - }; - $scope.$on('$ionicView.enter', $scope.showLoginModal); - -} - function LoginModalController($scope, $timeout, $q, $ionicPopover, $window, CryptoUtils, csCrypto, ionicReady, UIUtils, BMA, Modals, csConfig, csSettings, Device, parameters) { 'ngInject'; diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index 03d370e771c66b843269ccaf04e9f52df19e01f0..dd774d50d2ab399949492105f3d86ff91a3b37b2 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -129,7 +129,7 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc $scope.destPub = parameters.pubkey; } if (parameters.amount) { - var amount = Number(parameters.amount) + var amount = Number(parameters.amount); // Trunc at 2 decimals $scope.formData.amount = !isNaN(amount) ? Math.trunc(parseFloat(parameters.amount) * 100) / 100 : null; $scope.formData.useRelative=false; diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 6336b6df7878adf2a9dc3aa600475a8561a73fad..3c9e50f137a361bf84c32740b47bd3d0f811466c 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -1118,7 +1118,8 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s } $scope.removeActionParamInLocationHref(state); - } + }; + var onLoadSuccess = function() { $scope.doMotion(); diff --git a/www/js/services/settings-services.js b/www/js/services/settings-services.js index ff47d939a413b90c8c20428de44ed8bcce39b9e6..988ea9686e16537ee43eda56411104c144d8b01b 100644 --- a/www/js/services/settings-services.js +++ b/www/js/services/settings-services.js @@ -93,6 +93,7 @@ angular.module('cesium.settings.services', ['ngApi', 'cesium.config']) useRelative: false, useLocalStorage: !!$window.localStorage, // Overwritten to false if not a device useLocalStorageEncryption: false, + useFullscreen: null, persistCache: false, // disable by default (waiting resolution of issue #885) walletHistoryTimeSecond: 30 * 24 * 60 * 60, // 30 days walletHistorySliceSecond: 5 * 24 * 60 * 60, // download using 5 days slice - need for cache diff --git a/www/templates/home/home.html b/www/templates/home/home.html index 26cd84200e2265d06801c65db83aaadcefb203bf..5bdc95c172d3474a0476885172c1f04eca23b221 100644 --- a/www/templates/home/home.html +++ b/www/templates/home/home.html @@ -1,4 +1,4 @@ -<ion-view id="home" bind-notifier="{locale:$root.settings.locale.id, feed: showFeed, loading: loading}"> +<ion-view id="home" bind-notifier="{locale:$root.settings.locale.id, loading: loading}"> <!-- no title --> <ion-nav-title></ion-nav-title> diff --git a/www/templates/menu.html b/www/templates/menu.html index 9af34b7a3d4212ae655dcffb3aff2e77830c455e..141aa8da8880b5ab298a59958525ad62e212700e 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -68,7 +68,8 @@ <div class="visible-sm visible-xs hero"> <div class="content"> - <i class="avatar avatar-member hero-icon" ng-if="!walletData.avatar" ng-class="{'royal-bg': login, 'stable-bg': !login}" ng-click="!login ? showHome() : loginAndGo()" menu-close></i> + <i class="avatar avatar-member hero-icon" ng-if="!walletData.avatar" ng-class="{'royal-bg': login, 'stable-bg': !login}" + ng-click="loginAndGo()" menu-close></i> <a class="avatar hero-icon" ng-if="walletData.avatar" style="background-image: url('{{walletData.avatar.src}}')" ui-sref="app.view_wallet" menu-close></a> <h4 ng-if="login"> <a class="light" ui-sref="app.view_wallet" menu-close> @@ -77,8 +78,7 @@ </a> </h4> <h4 ng-if="!login"> - <a class="light" ui-sref="app.login" - menu-close> + <a class="light" ng-click="loginAndGo()" menu-close> {{'COMMON.BTN_LOGIN'|translate}} <i class="ion-arrow-right-b"></i> </a>