|
|
@ -507,6 +507,7 @@ angular.module('myApp.services', []) |
|
|
|
|
|
|
|
|
|
|
|
var messagesStorage = {}; |
|
|
|
var messagesStorage = {}; |
|
|
|
var messagesForHistory = {}; |
|
|
|
var messagesForHistory = {}; |
|
|
|
|
|
|
|
var messagesForDialogs = {}; |
|
|
|
var historiesStorage = {}; |
|
|
|
var historiesStorage = {}; |
|
|
|
var dialogsStorage = {count: null, dialogs: []}; |
|
|
|
var dialogsStorage = {count: null, dialogs: []}; |
|
|
|
var pendingByRandomID = {}; |
|
|
|
var pendingByRandomID = {}; |
|
|
@ -757,6 +758,9 @@ angular.module('myApp.services', []) |
|
|
|
if (messagesForHistory[messageID]) { |
|
|
|
if (messagesForHistory[messageID]) { |
|
|
|
messagesForHistory[messageID].unread = false; |
|
|
|
messagesForHistory[messageID].unread = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (messagesForDialogs[messageID]) { |
|
|
|
|
|
|
|
messagesForDialogs[messageID].unread = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1047,6 +1051,10 @@ angular.module('myApp.services', []) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function wrapForDialog (msgID, unreadCount) { |
|
|
|
function wrapForDialog (msgID, unreadCount) { |
|
|
|
|
|
|
|
if (messagesForDialogs[msgID] !== undefined) { |
|
|
|
|
|
|
|
return messagesForDialogs[msgID]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var message = angular.copy(messagesStorage[msgID]) || {id: msgID}; |
|
|
|
var message = angular.copy(messagesStorage[msgID]) || {id: msgID}; |
|
|
|
|
|
|
|
|
|
|
|
message.fromUser = AppUsersManager.getUser(message.from_id); |
|
|
|
message.fromUser = AppUsersManager.getUser(message.from_id); |
|
|
@ -1073,7 +1081,7 @@ angular.module('myApp.services', []) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return message; |
|
|
|
return messagesForDialogs[msgID] = message; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function wrapForHistory (msgID) { |
|
|
|
function wrapForHistory (msgID) { |
|
|
@ -1297,9 +1305,11 @@ angular.module('myApp.services', []) |
|
|
|
if (message) { |
|
|
|
if (message) { |
|
|
|
message.unread = false; |
|
|
|
message.unread = false; |
|
|
|
if (messagesForHistory[messageID]) { |
|
|
|
if (messagesForHistory[messageID]) { |
|
|
|
// console.log(222, messagesForHistory[messageID]);
|
|
|
|
|
|
|
|
messagesForHistory[messageID].unread = false; |
|
|
|
messagesForHistory[messageID].unread = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (messagesForDialogs[messageID]) { |
|
|
|
|
|
|
|
messagesForDialogs[messageID].unread = false; |
|
|
|
|
|
|
|
} |
|
|
|
peerID = getMessagePeer(message); |
|
|
|
peerID = getMessagePeer(message); |
|
|
|
if (!message.out) { |
|
|
|
if (!message.out) { |
|
|
|
foundDialog = getDialogByPeerID(peerID); |
|
|
|
foundDialog = getDialogByPeerID(peerID); |
|
|
@ -1315,7 +1325,6 @@ angular.module('myApp.services', []) |
|
|
|
angular.forEach(dialogsUpdated, function(count, peerID) { |
|
|
|
angular.forEach(dialogsUpdated, function(count, peerID) { |
|
|
|
$rootScope.$broadcast('dialog_unread', {peerID: peerID, count: count}); |
|
|
|
$rootScope.$broadcast('dialog_unread', {peerID: peerID, count: count}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
// $rootScope.$broadcast('history_update');
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -1437,8 +1446,7 @@ angular.module('myApp.services', []) |
|
|
|
var modalInstance = $modal.open({ |
|
|
|
var modalInstance = $modal.open({ |
|
|
|
templateUrl: 'partials/photo_modal.html?1', |
|
|
|
templateUrl: 'partials/photo_modal.html?1', |
|
|
|
controller: 'PhotoModalController', |
|
|
|
controller: 'PhotoModalController', |
|
|
|
scope: scope, |
|
|
|
scope: scope |
|
|
|
backdrop: 'static' |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|