mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Real-time Chat (#7664)
* feat(realtime-chat): add Pusher library to the server * feat(realtime-chat): only for private groups * feat(realtime-chat): add authentication endpoint for Pusher * feat(realtime-chat): client proof of concept * fix typo in apidoc * feat(realtime-chat): redo authentication and write integration tests * remove firebase code * fix client side tests * fix line ending in bower.json * feat(realtime chat): use presence channels for parties, send events & disconnect clients if user leaves or is removed from party, automatically update UI * pusher: enable all events in the background * fix pusher integration tests
This commit is contained in:
@@ -7,14 +7,19 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
||||
function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification, Groups, Shared, Content, $modal, $timeout, ApiUrl, Payments, $sce, $window, Analytics, TAVERN_ID) {
|
||||
var user = User.user;
|
||||
|
||||
var initSticky = _.once(function(){
|
||||
$timeout(function () {
|
||||
if (window.env.IS_MOBILE || User.user.preferences.stickyHeader === false) return;
|
||||
$('.header-wrap').sticky({topSpacing:0});
|
||||
});
|
||||
});
|
||||
// Setup page once user is synced
|
||||
var clearAppLoadedListener = $rootScope.$watch('appLoaded', function (after) {
|
||||
if (after === true) {
|
||||
// Initialize sticky header
|
||||
$timeout(function () {
|
||||
if (window.env.IS_MOBILE || User.user.preferences.stickyHeader === false) return;
|
||||
$('.header-wrap').sticky({topSpacing:0});
|
||||
});
|
||||
|
||||
$rootScope.$on('userUpdated',initSticky);
|
||||
// Remove listener
|
||||
clearAppLoadedListener();
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess',
|
||||
function(event, toState, toParams, fromState, fromParams){
|
||||
|
||||
Reference in New Issue
Block a user