Skip to content

Commit

Permalink
Release 0.7.0
Browse files Browse the repository at this point in the history
Merge pull request #211 from vrlkacha/0.7.x-nd
  • Loading branch information
vrlk authored Sep 2, 2016
2 parents 5d92fa8 + adcb4b4 commit e5fb2f7
Show file tree
Hide file tree
Showing 101 changed files with 8,650 additions and 4,214 deletions.
22 changes: 21 additions & 1 deletion pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,34 @@
"dist:win32-ia32": "./node_modules/.bin/build --platform win32 --arch ia32",
"dist:win32-x64": "./node_modules/.bin/build --platform win32 --arch x64",
"dist:win32": "./node_modules/.bin/build --platform win32 --arch all",
"release": "gulp && npm run dist:win32-ia32"
"dist:osx": "./node_modules/.bin/build --platform darwin",
"release": "gulp && npm run dist:win32-ia32",
"releaseosx": "gulp && npm run dist:osx"
},
"build": {
"appId": "in.automint.mac",
"catagory": "public.app-category.productivity",
"iconUrl": "http://cruzer.io/automint.ico",
"win": {
"authors": "Automint Pvt. Ltd.",
"loadingGif": "build/installer.gif",
"remoteReleases": "http://updates.automint.in/releases/win32/ia32/"
},
"dmg": {
"icon": "build/icon.icns",
"contents": [
{
"x": 410,
"y": 150,
"type": "link",
"path": "/Applications"
},
{
"x": 130,
"y": 150,
"type": "file"
}
]
}
},
"devDependencies": {
Expand Down
201 changes: 70 additions & 131 deletions src/app/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,161 +2,100 @@
* Closure for root level controllers
* @author ndkcha
* @since 0.4.1
* @version 0.6.4
* @version 0.7.0
*/

/// <reference path="../typings/main.d.ts" />

(function() {
const ammHelp = require('./automint_modules/am-help.js');

angular.module('automintApp')
.controller('lockScreenCtrl', LockScreenController)
.controller('appBarHeaderCtrl', HeaderbarController)
.controller('appSideBarCtrl', SidebarController);

HeaderbarController.$inject = ['$rootScope', '$scope', '$state', '$timeout', '$mdSidenav', 'amRootFactory'];
SidebarController.$inject = ['$state', '$mdSidenav'];
LockScreenController.$inject = ['$rootScope', '$state', '$window', 'amRootFactory', 'utils'];

function LockScreenController($rootScope, $state, $window, amRootFactory, utils) {
var vm = this, passcode, skip = true;

$rootScope.cRootLock = 'active';

vm.unlock = unlock;
vm.isMessage = false;
vm.addService = addService;

var source = localStorage.getItem('cover-pic');
$('#am-lockscreen-img').attr('src', (source) ? source : 'assets/img/logo-250x125px.png').width(250).height(125);
amRootFactory.getPasscode().then(gps).catch(unlock);

function addService() {
$rootScope.cRootLock = '';
$state.go('restricted.services.add', {
fromState: 'locked'
});
}

function gps(res) {
if (!res || res.enabled == false) {
unlock();
skip = true;
return;
}
skip = false;
passcode = res.code;
}
angular.module('automintApp').controller('amCtrl', HomeController).controller('amUpdatePwdCtrl', UpdatePasswordController);

function unlock() {
var transitState = 'restricted.dashboard';
if (skip == false) {
if (vm.passcode != passcode) {
vm.message = "Wrong Passcode!!!";
vm.isMessage = true;
return;
}
}
$rootScope.isAutomintLocked = false;
$rootScope.cRootLock = '';
if ($state.params.fromState != undefined)
transitState = $state.params.fromState;
$state.go(transitState);
}
}
HomeController.$inject = ['$rootScope', '$state', '$amRoot', '$amLicense', 'utils'];
UpdatePasswordController.$inject = ['$mdDialog', '$rootScope', '$amLicense', '$amRoot'];

function HeaderbarController($rootScope, $scope, $state, $timeout, $mdSidenav, amRootFactory) {
function HomeController($rootScope, $state, $amRoot, $amLicense, utils) {
// initialize view model
var vm = this;

// map functions to view model
vm.toggleSideNavbar = buildDelayedToggler('main-nav-left');
vm.openLockScreen = openLockScreen;
vm.openHelpWindow = openHelpWindow;
vm.addService = addService;
$rootScope.setCoverPic();
// default execution steps
$rootScope.isFirstLoad = true;
$amLicense.checkLogin(true).then(success).catch(failure);

amRootFactory.getPasscode().then(gps).catch(failure);
// function definitions

function addService() {
$state.go('restricted.services.add');
function success(res) {
if (res.isLoggedIn) {
if (res.isCloudEnabled) {
if (res.isCloudForceEnabled != false)
$amRoot.syncDb();
}
$amRoot.dbAfterLogin(false);
} else
failure();
}

function openHelpWindow() {
ammHelp.openHelpWindow();
function failure(err) {
if (err != undefined)
utils.showSimpleToast(err);
$rootScope.hidePreloader = true;
$state.go('login');
}
}

function gps(res) {
if (res == undefined)
return;
$rootScope.isPasscodeEnabled = res.enabled;
}
function UpdatePasswordController($mdDialog, $rootScope, $amLicense, $amRoot) {
// initialize view model
var vm = this;

function failure(err) {
$rootScope.isPasscodeEnabled = false;
}
// temporary assignments for the instance
// no such assignments for now

function openLockScreen() {
$rootScope.isAutomintLocked = true;
$state.go('locked', {
fromState: $state.current.name
});
}
// named assignments to view model
vm.password = '';

// function mappings to view model
vm.OnKeyDown = OnKeyDown;
vm.submit = submit;

// default execution steps
setTimeout(focusPassword, 300);

// function definitions

// Supplies a function that will continue to operate until the time is up.
function debounce(func, wait, context) {
var timer;
return function debounced() {
var context = $scope,
args = Array.prototype.slice.call(arguments);
$timeout.cancel(timer);
timer = $timeout(function() {
timer = undefined;
func.apply(context, args);
}, wait || 10);
};
function focusPassword() {
$('#ami-password').focus();
}

// Build handler to open/close a SideNav; when animation finishes report completion in console
function buildDelayedToggler(navID) {
return debounce(function() {
$mdSidenav(navID).toggle();
}, 200);
function OnKeyDown(event) {
if (event.keyCode == 13)
submit();
}
}

function SidebarController($state, $mdSidenav) {
var vm = this;
function submit() {
$rootScope.busyApp.show = true;
$rootScope.busyApp.message = 'Loging In. Please Wait..';
$amLicense.loadCredentials($rootScope.amGlobals.credentials.username, vm.password);
$amLicense.login(false).then(success).catch(failure);

function success(res) {
$rootScope.busyApp.show = false;
if (res.isLoggedIn) {
if (res.isSyncableDb) {
if ($rootScope.amDbSync)
$rootScope.amDbSync.cancel();
$amRoot.syncDb();
}
$mdDialog.hide();
} else {
utils.showSimpleToast('Your license has expired!');
$state.go('login');
}
}

// map functions to view model
vm.openState = openState;

// objects passed to view model
vm.items = [{
name: 'Dashboard',
icon: 'dashboard',
state: 'restricted.dashboard'
}, {
name: 'Customers',
icon: 'group',
state: 'restricted.customers.all'
}, {
name: 'Treatments',
icon: 'local_car_wash',
state: 'restricted.treatments.master'
}, {
name: 'Inventory',
icon: 'build',
state: 'restricted.inventory.all'
}, {
name: 'Settings',
icon: 'settings',
state: 'restricted.settings'
}];

function openState(state) {
$mdSidenav('main-nav-left').close()
$state.go(state);
function failure(err) {
$rootScope.busyApp.show = false;
vm.message = err.message;
}
}
}
})();
Loading

0 comments on commit e5fb2f7

Please sign in to comment.