Skip to content

Commit a6a5ad0

Browse files
committed
Removed Cloud Syncrhonization.
1 parent 0923157 commit a6a5ad0

23 files changed

+26
-3813
lines changed

src/app/app.controller.js

+5-88
Original file line numberDiff line numberDiff line change
@@ -2,102 +2,19 @@
22
* Closure for root level controllers
33
* @author ndkcha
44
* @since 0.4.1
5-
* @version 0.7.3
5+
* @version 0.9.0
66
*/
77

8-
/// <reference path="../typings/main.d.ts" />
9-
108
(function() {
119

12-
angular.module('automintApp').controller('amCtrl', HomeController).controller('amUpdatePwdCtrl', UpdatePasswordController);
13-
14-
HomeController.$inject = ['$rootScope', '$state', '$amRoot', '$amLicense', 'utils'];
15-
UpdatePasswordController.$inject = ['$mdDialog', '$rootScope', '$amLicense', '$amRoot'];
16-
17-
function HomeController($rootScope, $state, $amRoot, $amLicense, utils) {
18-
// initialize view model
19-
var vm = this;
10+
angular.module('automintApp').controller('amCtrl', HomeController);
2011

21-
// default execution steps
22-
$rootScope.firstTimers = {
23-
isFranchise: true
24-
};
25-
$amLicense.checkLogin(true).then(success).catch(failure);
26-
27-
// function definitions
28-
29-
function success(res) {
30-
if (res.isLoggedIn) {
31-
if (res.isCloudEnabled) {
32-
if (res.isCloudForceEnabled != false)
33-
$amRoot.syncDb();
34-
}
35-
$amRoot.dbAfterLogin(false);
36-
} else
37-
failure();
38-
}
39-
40-
function failure(err) {
41-
if (err != undefined)
42-
utils.showSimpleToast(err);
43-
$rootScope.hidePreloader = true;
44-
$state.go('login');
45-
}
46-
}
12+
HomeController.$inject = ['$rootScope', '$amRoot'];
4713

48-
function UpdatePasswordController($mdDialog, $rootScope, $amLicense, $amRoot) {
14+
function HomeController($rootScope, $amRoot) {
4915
// initialize view model
5016
var vm = this;
5117

52-
// temporary assignments for the instance
53-
// no such assignments for now
54-
55-
// named assignments to view model
56-
vm.password = '';
57-
58-
// function mappings to view model
59-
vm.OnKeyDown = OnKeyDown;
60-
vm.submit = submit;
61-
62-
// default execution steps
63-
setTimeout(focusPassword, 300);
64-
65-
// function definitions
66-
67-
function focusPassword() {
68-
$('#ami-password').focus();
69-
}
70-
71-
function OnKeyDown(event) {
72-
if (event.keyCode == 13)
73-
submit();
74-
}
75-
76-
function submit() {
77-
$rootScope.busyApp.show = true;
78-
$rootScope.busyApp.message = 'Loging In. Please Wait..';
79-
$amLicense.loadCredentials($rootScope.amGlobals.credentials.username, vm.password);
80-
$amLicense.login(false).then(success).catch(failure);
81-
82-
function success(res) {
83-
$rootScope.busyApp.show = false;
84-
if (res.isLoggedIn) {
85-
if (res.isSyncableDb) {
86-
if ($rootScope.amDbSync)
87-
$rootScope.amDbSync.cancel();
88-
$amRoot.syncDb();
89-
}
90-
$mdDialog.hide();
91-
} else {
92-
utils.showSimpleToast('Your license has expired!');
93-
$state.go('login');
94-
}
95-
}
96-
97-
function failure(err) {
98-
$rootScope.busyApp.show = false;
99-
vm.message = err.message;
100-
}
101-
}
18+
$amRoot.dbAfterLogin(false);
10219
}
10320
})();

src/app/app.service.js

+7-41
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22
* Root level service
33
* @author ndkcha
44
* @since 0.4.1
5-
* @version 0.7.2
5+
* @version 0.9.0
66
*/
77

8-
/// <reference path="../typings/main.d.ts" />
9-
108
(function() {
119
const ipcRenderer = require('electron').ipcRenderer;
1210

1311
angular.module('automintApp').service('$amRoot', AutomintService);
1412

15-
AutomintService.$inject = ['$rootScope', '$state', '$q', '$mdDialog', 'constants', 'pdbMain', 'pdbCache', 'pdbLocal', 'amFactory'];
13+
AutomintService.$inject = ['$rootScope', '$state', '$q', '$mdDialog', 'constants', 'pdbMain', 'pdbCache', 'pdbLocal'];
1614

17-
function AutomintService($rootScope, $state, $q, $mdDialog, constants, pdbMain, pdbCache, pdbLocal, amFactory) {
15+
function AutomintService($rootScope, $state, $q, $mdDialog, constants, pdbMain, pdbCache, pdbLocal) {
1816
// set up service view model
1917
var vm = this;
2018

@@ -82,7 +80,7 @@
8280
console.error('No Username or Password provided for database sync');
8381
return;
8482
}
85-
var url = amFactory.generateDbUrl(username, password, constants.sgw_w_main);
83+
var url = "";
8684
if ((url == undefined) || (url == '')) {
8785
console.error('Username/Password/Database name missing from url');
8886
return;
@@ -192,41 +190,9 @@
192190
live: true
193191
}).on('change', OnChangeMainDb);
194192

195-
if ($rootScope.checkAutomintValidity == undefined)
196-
$rootScope.checkAutomintValidity = setInterval(checkAutomintValidity, 1000*60*60*24);
197-
198-
if (wait)
199-
$rootScope.isSyncCalledManually = true;
200-
else {
201-
// handle database migration if any and generate cache docs after the process
202-
// no such migrations right now
203-
generateCacheDocs().then(transitToDashboard).catch(transitToDashboard);
204-
}
205-
206-
function checkAutomintValidity() {
207-
$amLicense.checkLogin(true).then(success).catch(failure);
208-
209-
function success(res) {
210-
if (res.isLoggedIn) {
211-
if ((!res.isCloudEnabled) || (res.isCloudEnabled && (res.isCloudForceEnabled == false))) {
212-
if ($rootScope.amDbSync)
213-
$rootScope.amDbSync.cancel();
214-
}
215-
} else
216-
failure("Something went wrong. Login Again");
217-
}
218-
219-
function failure(err) {
220-
$rootScope.busyApp.show = true;
221-
$rootScope.busyApp.message = err;
222-
$rootScope.busyApp.isRaEnabled = true;
223-
setTimeout(restartApp, 1000);
224-
}
225-
226-
function restartApp(err) {
227-
ipcRenderer.send('am-do-restart', true);
228-
}
229-
}
193+
// handle database migration if any and generate cache docs after the process
194+
// no such migrations right now
195+
generateCacheDocs().then(transitToDashboard).catch(transitToDashboard);
230196
}
231197

232198
function OnChangeMainDb(change) {

src/app/app.states.js

+1-19
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
* Closure for state definitions and mappings to template files
33
* @author ndkcha
44
* @since 0.4.1
5-
* @version 0.8.0
5+
* @version 0.9.0
66
*/
77

8-
/// <reference path="../typings/main.d.ts" />
9-
108
(function() {
119
angular.module('automintApp')
1210
.config(StateConfigs);
@@ -23,15 +21,6 @@
2321
controller: 'amCtrl',
2422
controllerAs: 'vm'
2523
})
26-
.state('login', {
27-
url: '/login',
28-
templateUrl: 'app/login/login.html',
29-
controller: 'amLoginCtrl',
30-
controllerAs: 'vm',
31-
resolve: {
32-
deps: ['$ocLazyLoad', loadLoginDeps]
33-
}
34-
})
3524
.state('restricted', {
3625
abstract: true,
3726
url: '',
@@ -419,12 +408,6 @@
419408
])
420409
}
421410

422-
function loadLoginDeps($ocLazyLoad) {
423-
return $ocLazyLoad.load([
424-
'app/login/login.controller.js'
425-
])
426-
}
427-
428411
function loadInUIDeps($ocLazyLoad) {
429412
return $ocLazyLoad.load([
430413
'app/components/inventory/inventory-edit.controller.js'
@@ -545,7 +528,6 @@
545528
}
546529
function loadSettingsDeps($ocLazyLoad) {
547530
return $ocLazyLoad.load([
548-
'app/components/settings/tmpl/changepassword.controller.js',
549531
'app/components/settings/settings.controller.js',
550532
'app/components/settings/settings-backup.factory.js',
551533
'app/components/settings/settings-importdata.service.js',

src/app/appbar/appbar.factory.js

+2-27
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
* Factory for Appbar Components
33
* @author ndkcha
44
* @since 0.7.0
5-
* @version 0.7.3
5+
* @version 0.9.0
66
*/
77

8-
/// <reference path="../../typings/main.d.ts" />
9-
108
(function() {
119
angular.module('automintApp').factory('amAppbar', AppbarFactory);
1210

@@ -15,36 +13,13 @@
1513
function AppbarFactory($q, $rootScope, pdbMain, pdbLocal, constants) {
1614
// initialize factory object and function maps
1715
var factory = {
18-
getPasscode: getPasscode,
19-
getCloudChannelNames: getCloudChannelNames
16+
getPasscode: getPasscode
2017
}
2118

2219
return factory;
2320

2421
// function definitions
2522

26-
function getCloudChannelNames() {
27-
var tracker = $q.defer();
28-
pdbLocal.get(constants.pdb_local_docs.login).then(getLoginDoc).catch(failure);
29-
return tracker.promise;
30-
31-
function getLoginDoc(res) {
32-
if (res.localchannelmaps) {
33-
var response = {
34-
channels: res.localchannelmaps
35-
};
36-
if (res.defaultlocalchannel != undefined)
37-
response.default = res.defaultlocalchannel;
38-
tracker.resolve(response);
39-
} else
40-
failure();
41-
}
42-
43-
function failure(err) {
44-
tracker.reject(404);
45-
}
46-
}
47-
4823
function getPasscode() {
4924
var tracker = $q.defer();
5025
pdbMain.get($rootScope.amGlobals.configDocIds.settings).then(getSettingsObj).catch(failure);

0 commit comments

Comments
 (0)