Skip to content

Commit

Permalink
Determining if this is the first time running the current build.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiam committed Feb 8, 2016
1 parent 218c0ef commit 8b54880
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ docker-genassets: require-npm
LANTERN_UI="src/github.com/getlantern/lantern-ui" && \
APP="$$LANTERN_UI/app" && \
DIST="$$LANTERN_UI/dist" && \
echo 'var LANTERN_BUILD_REVISION = "$(GIT_REVISION_SHORTCODE)";' > $$APP/js/revision.js && \
if [[ ! -d $$DIST ]]; then \
UPDATE_DIST=true; \
fi && \
Expand All @@ -140,7 +141,6 @@ docker-genassets: require-npm
gulp build && \
cd -; \
fi && \
\
rm -f bin/tarfs bin/rsrc && \
go install github.com/getlantern/tarfs/tarfs && \
echo "// +build !stub" > $$DEST && \
Expand Down
1 change: 1 addition & 0 deletions src/github.com/getlantern/lantern-ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<!-- endbuild -->

<!-- build:js2 js/app.js -->
<script src="js/revision.js"></script>
<script src="js/app.js"></script>
<script src="js/constants.js"></script>
<script src="js/helpers.js"></script>
Expand Down
1 change: 1 addition & 0 deletions src/github.com/getlantern/lantern-ui/app/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ if (typeof angular == 'object' && angular && typeof angular.module == 'function'
.constant('GOOGLE_ANALYTICS_DISABLE_KEY', GOOGLE_ANALYTICS_DISABLE_KEY)
.constant('LANTERNUI_VER', window.LANTERNUI_VER) // set in version.js
.constant('REQUIRED_API_VER', REQUIRED_API_VER)
.constant('BUILD_REVISION', LANTERN_BUILD_REVISION)
.constant('API_URL_PREFIX', API_URL_PREFIX);
} else if (typeof exports == 'object' && exports && typeof module == 'object' && module && module.exports == exports) {
module.exports = {
Expand Down
17 changes: 6 additions & 11 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', ['$rootScope', '$scope', '$compile', '$window', '$http', 'gaMgr',
'localStorageService',
function($rootScope, $scope, $compile, $window, $http, gaMgr, localStorageService) {
'localStorageService', 'BUILD_REVISION',
function($rootScope, $scope, $compile, $window, $http, gaMgr, localStorageService, BUILD_REVISION) {
$scope.currentModal = 'none';

$scope.loadScript = function(src) {
Expand Down Expand Up @@ -67,22 +67,17 @@ app.controller('RootCtrl', ['$rootScope', '$scope', '$compile', '$window', '$htt
gaMgr.trackSendLinkToMobile();
};

$rootScope.lanternWelcomeKey = localStorageService.get('lanternWelcomeKey');
// $rootScope.lanternWelcomeKey = false;
$rootScope.lanternFirstTimeBuildVar = 'lanternFirstTimeBuild-'+BUILD_REVISION;

$scope.closeModal = function() {
if (!$rootScope.lanternWelcomeKey) {
$rootScope.lanternWelcomeKey = true;
localStorageService.set('lanternWelcomeKey', true);
}
localStorageService.set($rootScope.lanternFirstTimeBuildVar, true);
$scope.currentModal = 'none';
$(".modal-backdrop").remove();
};

if (!$rootScope.lanternWelcomeKey) {
//$scope.showModal('welcome');
$rootScope.showMobileAd = true;
if (!localStorageService.get($rootScope.lanternFirstTimeBuildVar)) {
$scope.resetPlaceholder();
$rootScope.showMobileAd = true;
};

}]);
Expand Down
2 changes: 2 additions & 0 deletions src/github.com/getlantern/lantern-ui/app/js/revision.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* This revision is automatically updated by the Makefile script */
var LANTERN_BUILD_REVISION = "?";
3 changes: 0 additions & 3 deletions src/github.com/getlantern/lantern-ui/app/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ angular.module('app.services', [])
model.location.resolved = true;
}
},
'Ad': function(data) {
model.ad = {}
},
'Settings': function(data) {
console.log('Got Lantern default settings: ', data);
if (data && data.Version) {
Expand Down

0 comments on commit 8b54880

Please sign in to comment.