Browse Source

Fixed flicker of welcome screen.

Only auto show settings when in a room.
pull/59/head
Simon Eisenmann 11 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 @@ @@ -20,7 +20,7 @@
*/
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);
@ -29,32 +29,36 @@ define(['text!partials/page.html', 'text!partials/page/welcome.html'], function( @@ -29,32 +29,36 @@ define(['text!partials/page.html', 'text!partials/page/welcome.html'], function(
scope.room = false;
scope.page = null;
scope.$on("welcome", function() {
if (!scope.initialized) {
if (mediaStream.config.DefaultRoomEnabled !== true) {
scope.$on("welcome", function() {
if (!scope.initialized) {
scope.initialized = true;
scope.refresh();
}
});
scope.$on("room", function(event, room) {
scope.initialized = true;
scope.room = room !== null ? true : false;
scope.refresh();
}
});
});
scope.$on("room", function(event, room) {
scope.initialized = true;
scope.room = room !== null ? true : false;
scope.refresh();
});
scope.$watch("status", function(event) {
if (scope.initialized) {
scope.refresh();
}
});
scope.$watch("status", function(event) {
if (scope.initialized) {
scope.refresh();
}
});
scope.refresh = function() {
if (scope.roomid || scope.room || scope.status !== "waiting") {
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($, _, @@ -29,7 +29,7 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _,
var pending = true;
var complete = false;
var initalizer = null;
var initializer = null;
var ctrl = this;
ctrl.setInfo = function(info) {
@ -43,17 +43,20 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _, @@ -43,17 +43,20 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _,
if (status) {
localStorage.setItem("mediastream-mediacheck", MEDIA_CHECK)
$scope.connect()
ctrl.setInfo("initializing");
initializer = $timeout(function() {
if (mediaStream.config.DefaultRoomEnabled !== true) {
ctrl.setInfo("initializing");
initializer = $timeout(function() {
ctrl.setInfo("ok");
$scope.layout.settings = false;
$scope.$emit("welcome");
}, 1000);
} else {
ctrl.setInfo("ok");
$scope.$emit("welcome");
}, 1000);
}
complete = true;
} else {
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($, _, @@ -98,6 +101,8 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _,
$timeout.cancel(initializer);
initializer = null;
}
// Check if we should show settings per default when in a room.
$scope.layout.settings = $scope.loadedUser ? false : true;
ctrl.setInfo("ok");
}
});

Loading…
Cancel
Save