/* jshint -W041 */ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console */ angular.module('zmApp.controllers').controller('zmApp.FirstUseCtrl', ['$scope', '$ionicSideMenuDelegate', 'zm', '$stateParams', '$ionicHistory', '$state', 'NVRDataModel', '$rootScope', '$ionicPopup', '$translate', function ($scope, $ionicSideMenuDelegate, zm, $stateParams, $ionicHistory, $state, NVRDataModel, $rootScope, $ionicPopup, $translate) { $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); }; //------------------------------------------------------------------------- // Controller Main //------------------------------------------------------------------------ $scope.$on('$ionicView.enter', function () { //console.log("**VIEW ** FirstUse Ctrl Entered"); $ionicSideMenuDelegate.canDragContent(true); // right up here lets set certs to true, we will disable it later // this is for first starts // if (window.cordova) { cordova.plugins.certificates.trustUnsecureCerts(true); NVRDataModel.log(">>>>>Accepting all certificates, since its first use"); } }); $scope.switchLang = function () { $scope.lang = NVRDataModel.getLanguages(); $scope.myopt = { lang: "" }; $rootScope.zmPopup = $ionicPopup.show({ scope: $scope, template: ' {{item.text}} ', title: $translate.instant('kSelectLanguage'), buttons: [{ text: $translate.instant('kButtonCancel'), onTap: function (e) { //return "CANCEL"; } }, { text: $translate.instant('kButtonOk'), onTap: function (e) { NVRDataModel.log("Language selected:" + $scope.myopt.lang); NVRDataModel.setDefaultLanguage($scope.myopt.lang, true); //return "OK"; } } ] }); }; $scope.goToLogin = function () { $ionicHistory.nextViewOptions({ disableAnimate: false, disableBack: true }); $state.go("app.login", { "wizard": false }); return; }; $scope.goToWizard = function () { $ionicHistory.nextViewOptions({ disableAnimate: false, disableBack: true }); $state.go("app.wizard"); return; }; }]);