From 29192ea0297f0a3f120379157540f9e1fb4516ec Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Thu, 6 Feb 2014 00:38:54 +0400 Subject: [PATCH] Fixed close photo, hide unread dot --- app/css/app.css | 6 +++--- app/index.html | 6 +++--- app/js/controllers.js | 2 +- app/js/services.js | 18 +++++++++++++----- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index db8a5df5..d40ca739 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -526,11 +526,11 @@ a.im_dialog:hover .im_dialog_message_text { background: #c1d6e5; display: inline-block; float: right; - width: 10px; - height: 10px; + width: 8px; + height: 8px; border-radius: 5px; overflow: hidden; - margin: 8px 0 0; + margin: 10px 0 0; } a.im_dialog:hover .im_dialog_unread { diff --git a/app/index.html b/app/index.html index 298a32dc..12b96fb2 100644 --- a/app/index.html +++ b/app/index.html @@ -7,7 +7,7 @@ - + @@ -52,8 +52,8 @@ - - + + diff --git a/app/js/controllers.js b/app/js/controllers.js index a3a1b7af..45f6f280 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -220,7 +220,7 @@ angular.module('myApp.controllers', []) var wrappedDialog = AppMessagesManager.wrapForDialog(dialog.top_message, dialog.unread_count); if (pos !== false) { var prev = $scope.dialogs.splice(pos, 1); - wrappedDialog = angular.extend(prev[0], wrappedDialog); + // wrappedDialog = angular.extend(prev[0], wrappedDialog); offset++; } $scope.dialogs.unshift(wrappedDialog); diff --git a/app/js/services.js b/app/js/services.js index f431a954..4777114a 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -507,6 +507,7 @@ angular.module('myApp.services', []) var messagesStorage = {}; var messagesForHistory = {}; + var messagesForDialogs = {}; var historiesStorage = {}; var dialogsStorage = {count: null, dialogs: []}; var pendingByRandomID = {}; @@ -757,6 +758,9 @@ angular.module('myApp.services', []) if (messagesForHistory[messageID]) { messagesForHistory[messageID].unread = false; } + if (messagesForDialogs[messageID]) { + messagesForDialogs[messageID].unread = false; + } } } @@ -1047,6 +1051,10 @@ angular.module('myApp.services', []) } function wrapForDialog (msgID, unreadCount) { + if (messagesForDialogs[msgID] !== undefined) { + return messagesForDialogs[msgID]; + } + var message = angular.copy(messagesStorage[msgID]) || {id: msgID}; message.fromUser = AppUsersManager.getUser(message.from_id); @@ -1073,7 +1081,7 @@ angular.module('myApp.services', []) } - return message; + return messagesForDialogs[msgID] = message; } function wrapForHistory (msgID) { @@ -1297,9 +1305,11 @@ angular.module('myApp.services', []) if (message) { message.unread = false; if (messagesForHistory[messageID]) { - // console.log(222, messagesForHistory[messageID]); messagesForHistory[messageID].unread = false; } + if (messagesForDialogs[messageID]) { + messagesForDialogs[messageID].unread = false; + } peerID = getMessagePeer(message); if (!message.out) { foundDialog = getDialogByPeerID(peerID); @@ -1315,7 +1325,6 @@ angular.module('myApp.services', []) angular.forEach(dialogsUpdated, function(count, peerID) { $rootScope.$broadcast('dialog_unread', {peerID: peerID, count: count}); }); - // $rootScope.$broadcast('history_update'); break; } }); @@ -1437,8 +1446,7 @@ angular.module('myApp.services', []) var modalInstance = $modal.open({ templateUrl: 'partials/photo_modal.html?1', controller: 'PhotoModalController', - scope: scope, - backdrop: 'static' + scope: scope }); }