Event streaming now happens on an app level, rather than a per-room level. Make eventStreamService manage it's own repolling provided no one calls stop() on it. Couple the stream with eventHandlerService so any controller can just blithely call eventStreamService.resume() and expect to 'get stuff' without having to handle promises (though resume() still returns a promise for that request and proxies it through $q). Kill and reset the stream if you logout.

This commit is contained in:
Kegan Dougal 2014-08-15 13:43:07 +01:00
parent c51cf4efca
commit 7ddb7a5cbb
5 changed files with 76 additions and 19 deletions

View file

@ -1,6 +1,6 @@
angular.module('LoginController', ['matrixService'])
.controller('LoginController', ['$scope', '$location', 'matrixService',
function($scope, $location, matrixService) {
.controller('LoginController', ['$scope', '$location', 'matrixService', 'eventStreamService',
function($scope, $location, matrixService, eventStreamService) {
'use strict';
@ -51,7 +51,7 @@ angular.module('LoginController', ['matrixService'])
// And permanently save it
matrixService.saveConfig();
eventStreamService.resume();
// Go to the user's rooms list page
$location.path("rooms");
},
@ -83,6 +83,7 @@ angular.module('LoginController', ['matrixService'])
access_token: response.data.access_token
});
matrixService.saveConfig();
eventStreamService.resume();
$location.path("rooms");
}
else {