Skip to content

Commit

Permalink
add welcome screen check before any usage requests are sent
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Blose committed Mar 30, 2015
1 parent 0906521 commit 2459367
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/github.com/getlantern/lantern-ui/app/js/controllers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

app.controller('RootCtrl', ['$scope', '$compile', '$window', '$http',
app.controller('RootCtrl', ['$rootScope', '$scope', '$compile', '$window', '$http',
'localStorageService',
function($scope, $compile, $window, $http, localStorageService) {
function($rootScope, $scope, $compile, $window, $http, localStorageService) {
$scope.currentModal = 'none';

$scope.loadScript = function(src) {
Expand Down Expand Up @@ -32,22 +32,22 @@ app.controller('RootCtrl', ['$scope', '$compile', '$window', '$http',
$scope.currentModal = val;
};

$scope.lanternWelcomeKey = localStorageService.get('lanternWelcomeKey');
$rootScope.lanternWelcomeKey = localStorageService.get('lanternWelcomeKey');

$scope.closeModal = function() {

// if it's our first time opening the UI,
// show the settings modal first immediately followed by
// the welcome screen
if ($scope.currentModal == 'welcome' && !$scope.lanternWelcomeKey) {
$scope.lanternWelcomeKey = true;
if ($scope.currentModal == 'welcome' && !$rootScope.lanternWelcomeKey) {
$rootScope.lanternWelcomeKey = true;
localStorageService.set('lanternWelcomeKey', true);
} else {
$scope.currentModal = 'none';
}
};

if (!$scope.lanternWelcomeKey) {
if (!$rootScope.lanternWelcomeKey) {
$scope.showModal('welcome');
};

Expand Down
4 changes: 3 additions & 1 deletion src/github.com/getlantern/lantern-ui/app/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ angular.module('app.services', [])

if (data.AutoReport) {
model.settings.autoReport = true;
$rootScope.trackPageView();
if ($rootScope.lanternWelcomeKey) {
$rootScope.trackPageView();
}
}

},
Expand Down

0 comments on commit 2459367

Please sign in to comment.