Browse Source

Fixed flicker of welcome screen.

Only auto show settings when in a room.
pull/59/head
Simon Eisenmann 12 years ago
parent
commit
7174eaee38
  1. 48
      static/js/directives/page.js
  2. 19
      static/js/directives/usability.js

48
static/js/directives/page.js

@ -20,7 +20,7 @@
*/ */
define(['text!partials/page.html', 'text!partials/page/welcome.html'], function(template, welcome) { define(['text!partials/page.html', 'text!partials/page/welcome.html'], function(template, welcome) {
return ["$templateCache", function($templateCache) { return ["$templateCache", "mediaStream", function($templateCache, mediaStream) {
$templateCache.put('page/welcome.html', welcome); $templateCache.put('page/welcome.html', welcome);
@ -29,32 +29,36 @@ define(['text!partials/page.html', 'text!partials/page/welcome.html'], function(
scope.room = false; scope.room = false;
scope.page = null; scope.page = null;
scope.$on("welcome", function() { if (mediaStream.config.DefaultRoomEnabled !== true) {
if (!scope.initialized) {
scope.$on("welcome", function() {
if (!scope.initialized) {
scope.initialized = true;
scope.refresh();
}
});
scope.$on("room", function(event, room) {
scope.initialized = true; scope.initialized = true;
scope.room = room !== null ? true : false;
scope.refresh(); scope.refresh();
} });
});
scope.$on("room", function(event, room) { scope.$watch("status", function(event) {
scope.initialized = true; if (scope.initialized) {
scope.room = room !== null ? true : false; scope.refresh();
scope.refresh(); }
}); });
scope.$watch("status", function(event) { scope.refresh = function() {
if (scope.initialized) { if (scope.roomid || scope.room || scope.status !== "waiting") {
scope.refresh(); scope.page = null;
} } else {
}); scope.page = "page/welcome.html";
}
};
scope.refresh = function() { }
if (scope.roomid || scope.room || scope.status !== "waiting") {
scope.page = null;
} else {
scope.page = "page/welcome.html";
}
};
}; };

19
static/js/directives/usability.js

@ -29,7 +29,7 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _,
var pending = true; var pending = true;
var complete = false; var complete = false;
var initalizer = null; var initializer = null;
var ctrl = this; var ctrl = this;
ctrl.setInfo = function(info) { ctrl.setInfo = function(info) {
@ -43,17 +43,20 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _,
if (status) { if (status) {
localStorage.setItem("mediastream-mediacheck", MEDIA_CHECK) localStorage.setItem("mediastream-mediacheck", MEDIA_CHECK)
$scope.connect() $scope.connect()
ctrl.setInfo("initializing"); if (mediaStream.config.DefaultRoomEnabled !== true) {
initializer = $timeout(function() { ctrl.setInfo("initializing");
initializer = $timeout(function() {
ctrl.setInfo("ok");
$scope.layout.settings = false;
$scope.$emit("welcome");
}, 1000);
} else {
ctrl.setInfo("ok"); ctrl.setInfo("ok");
$scope.$emit("welcome"); }
}, 1000);
complete = true; complete = true;
} else { } else {
ctrl.setInfo("denied"); ctrl.setInfo("denied");
} }
// Check if we should show settings per default.
$scope.layout.settings = $scope.loadedUser ? false : true;
}); });
}; };
@ -98,6 +101,8 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _,
$timeout.cancel(initializer); $timeout.cancel(initializer);
initializer = null; initializer = null;
} }
// Check if we should show settings per default when in a room.
$scope.layout.settings = $scope.loadedUser ? false : true;
ctrl.setInfo("ok"); ctrl.setInfo("ok");
} }
}); });

Loading…
Cancel
Save