{"size": 5282, "ext": "js", "max_stars_repo_path": "yeoman/app/scripts/controllers/launchpad.js", "max_stars_repo_name": "dreamfactorysoftware/launchpad-cordova", "max_stars_repo_stars_event_min_datetime": "2015-03-05T15:05:18.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-22T07:18:29.000Z", "max_issues_repo_path": "yeoman/app/scripts/controllers/launchpad.js", "max_issues_repo_name": "dreamfactorysoftware/launchpad-cordova", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "yeoman/app/scripts/controllers/launchpad.js", "max_forks_repo_name": "dreamfactorysoftware/launchpad-cordova", "max_forks_repo_forks_event_min_datetime": "2015-03-05T15:05:19.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-10T20:44:48.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 3, "avg_line_length": 25.3942307692, "max_line_length": 151, "alphanum_fraction": 0.4888299886}
'use strict';


angular.module('lpApp')
    .controller('LaunchPadCtrl', ['$scope', '$rootScope', '$location', 'getGroups', 'getDSPInfo', 'AppLaunchService', 'AppStrings', 'ObjectService',
        function ($scope, $rootScope, $location, getGroups, getDSPInfo, AppLaunchService, AppStrings, ObjectService) {

            // Set App Location
            $rootScope.appLocation = 'Launchpad';

            $scope.overridePageStrings = {
                title: getDSPInfo.name,
                description: ''
            };

            $scope.pageText = ObjectService.extend(AppStrings.getLaunchPadStrings, $scope.overridePageStrings);


            $scope.groups = getGroups;


            // PUBLIC API

            $scope.singleTapGroup = function (group) {

                $scope.$broadcast('tap:single:group', group)
            };

            $scope.singleTapApp = function (app) {

                $scope.$broadcast('tap:single:app', app);
            };

            $scope.holdApp = function(app) {

                $scope.$broadcast('hold:app', app);
            };


            // PRIVATE API

            $scope._launchApp = function (app) {

                AppLaunchService.launchApp(app);
            };

            $scope._launchGroup = function (group) {

                $location.url('/launchpad/' + group.id)
            };

            $scope._launchAppDetail = function(group, app) {

                $location.url('/app-detail/'+ group.id + '/' + app.id);
            };


            // MESSAGES

            $scope.$on('tap:single:group', function (e, group) {

                $scope._launchGroup(group);
            });

            $scope.$on('tap:single:app', function (e, app) {

                $scope._launchApp(app);
            });

            $scope.$on('hold:app', function(e, app) {

                var group = {
                    id: 'ungrouped'
                };

                $scope._launchAppDetail(group, app);
            });

        }])
    .controller('LaunchPadGroupCtrl', ['$scope', '$rootScope', '$location', 'getApps', 'getDSPInfo', 'AppLaunchService', 'AppStrings', 'ObjectService',
        function ($scope, $rootScope, $location, getApps, getDSPInfo, AppLaunchService, AppStrings, ObjectService) {

            // Set App Location
            $rootScope.appLocation = 'LaunchPad Group';

            $scope.overridePageStrings = {
                title: getDSPInfo.name + ': ' + getApps.name,
                description: ''
            };


            $scope.pageText = ObjectService.extend(AppStrings.getLaunchPadGroupStrings, $scope.overridePageStrings);


            // Variables
            $scope.group = getApps;


            // PUBLIC API
            $scope.singleTap = function (app) {

                $scope.$broadcast('tap:single', app);
            };

            $scope.holdApp = function(app) {

                $scope.$broadcast('hold:app', app);
            };



            // PRIVATE API

            $scope._launchApp = function (app) {

                AppLaunchService.launchApp(app);
            };

            $scope._changeModeForward = function (app) {

                app.modes.next();
            };

            $scope._changeModeBackward = function (app) {

                app.modes.previous();
            };

            $scope._launchAppDetail = function(group, app) {


                $location.url('/app-detail/'+ group.id + '/' + app.id);
            };


            // MESSAGES
            $scope.$on('tap:single', function (e, app) {

                    $scope._launchApp(app);
            });


            $scope.$on('hold:app', function(e, app) {

                $scope._launchAppDetail($scope.group, app);
            });
        }])
    .controller('AppDetailCtrl', ['$scope', '$rootScope', '$location', 'getAppInfo', 'AppLaunchService', 'AppStrings', 'ObjectService',
        function ($scope, $rootScope, $location, getAppInfo, AppLaunchService, AppStrings, ObjectService) {

            // Set App Location
            $rootScope.appLocation = 'App Detail';

            $scope.overridePageStrings = {
                title: 'App Info: ' + getAppInfo.name,
                description: '',
                info: getAppInfo
            };

            $scope.app = getAppInfo;

            $scope.pageText = ObjectService.extend(AppStrings.getAppInfoStrings, $scope.overridePageStrings);


            $scope.moreInfoData = false;

            // PUBLIC API

            $scope.launchApp = function() {

                $scope.$broadcast('app:launch');
            };

            $scope.moreDetail = function() {

                $scope.$broadcast('app:moreDetail');
            };


            // PRIVATE API
            $scope._moreDetail = function() {

                if ($scope.moreInfoData === false) {
                    $scope.moreInfoData = true;
                }
                else {
                    $scope.moreInfoData = false
                }
            };


            // MESSAGES

            $scope.$on('app:launch', function(e) {


                AppLaunchService.launchApp($scope.app);
            });


            $scope.$on('app:moreDetail', function(e) {

                $scope._moreDetail();
            });



        }]);