1investagramsAngularApp.controller('chatBarUserControlController', 2 function ($scope, chatApiService) { 3 4 5 $scope.IsLoading = false; 6 7 $scope.UnreadCount = 0; 8 9 10 $scope.OpenAllNotifExternally = false; 11 12 13 14 function setupRetrieveChatNotificationsRealTime() { 15 try { 16 17 HubsServerMethod.NotificationHub.On.SendChatUnreadCount(function (data) { 18 19 if (data) { 20 21 var oldUnreadCount = $scope.UnreadCount; 22 23 $scope.UnreadCount = data.UC; 24 25 if (oldUnreadCount < $scope.UnreadCount) { 26 var newUnread = $scope.UnreadCount - oldUnreadCount; 27 28 //$scope.showNotificationToast("You have " + newUnread + " new messages.", null, false); 29 } 30 31 $scope.$digest(); 32 33 } 34 35 }); 36 37 38 //Connecting to signalR and joining to receive notif is done by NotifBarUserControlController 39 40 41 } 42 catch (ex) { 43 console.error(ex); 44 } 45 } 46 47 48 $scope.showNotificationToast = function (message, img, showBrowserToast, link) { 49 50 51 if ($scope.UserNav.IsShowMainNav) { 52 53 if (showBrowserToast) { 54 showBrowserNotificationToast(message, img, "InvestaChat"); 55 } 56 57 58 //toastr.info(message, 59 // "InvestaChat", { 60 // "closeButton": true, 61 // "debug": false, 62 // "newestOnTop": true, 63 // "progressBar": false, 64 // "positionClass": "toast-top-right", 65 // "preventDuplicates": true, 66 // "showDuration": "300", 67 // "hideDuration": "1000", 68 // "timeOut": "5000", 69 // "extendedTimeOut": "1000", 70 // "showEasing": "swing", 71 // "hideEasing": "linear", 72 // "showMethod": "fadeIn", 73 // "hideMethod": "fadeOut", 74 // "onclick": function () { 75 // if (link) { 76 77 // } 78 // } 79 //}); 80 81 82 } 83 84 }; 85 86 87 88 89 90 $scope.getMyChatProfile = function () { 91 92 if (!$scope.IsLoading) { 93 94 $scope.IsLoading = true; 95 showHeaderLoader(); 96 97 chatApiService.getMyChatProfile().then(function (result) { 98 $scope.IsLoading = false; 99 hideHeaderLoader(); 100 101 if (result.data) { 102 103 $scope.UnreadCount = result.data.UnreadActiveInboxCount; 104 } 105 }, 106 function (error) { 107 $scope.IsLoading = false; 108 hideHeaderLoader(); 109 showErrorResponse(error); 110 }); 111 } 112 }; 113 114 115 $scope.$on("notifSetOpenAllNotifExternally", function (event, arg) { 116 $scope.OpenAllNotifExternally = arg; 117 }); 118 119 120 121 $scope.$on("chatBarNotifClear", function (event, data) { 122 123 $scope.UnreadCount = 0; 124 125 }); 126 127 128 129 130 $scope.initValue = function () { 131 132 if ($scope.UserNav.AuthenticatedUserId > 0 && 133 $scope.UserNav.IsShowMainNav) { 134 135 $scope.getMyChatProfile(); 136 137 setupRetrieveChatNotificationsRealTime(); 138 139 } 140 141 }; 142 143 144 $scope.initValue(); 145 146 147 } 148);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.