forked from Mirrors/freeswitch
Merge pull request #418 in FS/freeswitch from ~JONATASOLIVEIRA/freeswitch:feature/FS-8002-growl-type-like-pop-up-if-chat-isn-t to master
* commit '9902be9bde9845ffce6ee96b48184dfb1f7a3f0e': FS-8002 - Verto Communicator - Using toastr to prompt popup
This commit is contained in:
commit
03656d5cb5
|
@ -17,8 +17,8 @@ var vertoApp = angular.module('vertoApp', [
|
|||
'ui.gravatar',
|
||||
]);
|
||||
|
||||
vertoApp.config(['$routeProvider', 'gravatarServiceProvider',
|
||||
function($routeProvider, gravatarServiceProvider) {
|
||||
vertoApp.config(['$routeProvider', 'gravatarServiceProvider', 'toastrConfig',
|
||||
function($routeProvider, gravatarServiceProvider, toastrConfig) {
|
||||
$routeProvider.
|
||||
when('/login', {
|
||||
title: 'Login',
|
||||
|
@ -52,6 +52,10 @@ vertoApp.config(['$routeProvider', 'gravatarServiceProvider',
|
|||
gravatarServiceProvider.defaults = {
|
||||
default: 'mm' // Mystery man as default for missing avatars
|
||||
};
|
||||
|
||||
angular.extend(toastrConfig, {
|
||||
maxOpened: 4
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
|
|
|
@ -462,9 +462,9 @@ vertoControllers.controller('MainController', ['$scope', '$rootScope',
|
|||
|
||||
|
||||
vertoControllers.controller('ChatController', ['$scope', '$rootScope', '$http',
|
||||
'$location', '$anchorScroll', '$timeout', 'verto',
|
||||
'$location', '$anchorScroll', '$timeout', 'toastr', 'verto', 'storage',
|
||||
function($scope, $rootScope, $http, $location, $anchorScroll, $timeout,
|
||||
verto) {
|
||||
toastr, verto, storage) {
|
||||
console.debug('Executing ChatController.');
|
||||
|
||||
function scrollToChatBottom() {
|
||||
|
@ -495,11 +495,24 @@ vertoControllers.controller('ChatController', ['$scope', '$rootScope', '$http',
|
|||
$rootScope.$on('chat.newMessage', function(event, data) {
|
||||
data.created_at = new Date();
|
||||
console.log('chat.newMessage', data);
|
||||
|
||||
$scope.$apply(function() {
|
||||
$scope.messages.push(data);
|
||||
if (data.from != verto.data.name && (!$scope.chatStatus ||
|
||||
$scope.activePane != 'chat')) {
|
||||
if(data.from != storage.data.name &&
|
||||
(angular.element('#wrapper').hasClass('toggled') ||
|
||||
$scope.activePane != 'chat')) {
|
||||
toastr.info(data.body, data.from, {onHidden: function(clicked) {
|
||||
if(clicked) {
|
||||
$scope.chatStatus = false;
|
||||
angular.element('#wrapper').removeClass('toggled');
|
||||
$rootScope.activePane = 'chat';
|
||||
$scope.activePane = 'chat';
|
||||
$scope.$apply();
|
||||
return true;
|
||||
}
|
||||
}});
|
||||
++$rootScope.chat_counter;
|
||||
return true;
|
||||
}
|
||||
$timeout(function() {
|
||||
scrollToChatBottom();
|
||||
|
@ -807,7 +820,6 @@ vertoControllers.controller('InCallController', ['$rootScope', '$scope',
|
|||
$scope.dialpadTemplate = '';
|
||||
$scope.incall = true;
|
||||
|
||||
|
||||
if (storage.data.videoCall) {
|
||||
$scope.callTemplate = 'partials/video_call.html';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue