Browse Source

Fixed close photo, hide unread dot

master
Igor Zhukov 11 years ago
parent
commit
29192ea029
  1. 6
      app/css/app.css
  2. 6
      app/index.html
  3. 2
      app/js/controllers.js
  4. 18
      app/js/services.js

6
app/css/app.css

@ -526,11 +526,11 @@ a.im_dialog:hover .im_dialog_message_text {
background: #c1d6e5; background: #c1d6e5;
display: inline-block; display: inline-block;
float: right; float: right;
width: 10px; width: 8px;
height: 10px; height: 8px;
border-radius: 5px; border-radius: 5px;
overflow: hidden; overflow: hidden;
margin: 8px 0 0; margin: 10px 0 0;
} }
a.im_dialog:hover .im_dialog_unread { a.im_dialog:hover .im_dialog_unread {

6
app/index.html

@ -7,7 +7,7 @@
<link rel="stylesheet" href="vendor/angular/angular-csp.css"/> <link rel="stylesheet" href="vendor/angular/angular-csp.css"/>
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"/> <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="vendor/jquery.nanoscroller/nanoscroller.css"/> <link rel="stylesheet" href="vendor/jquery.nanoscroller/nanoscroller.css"/>
<link rel="stylesheet" href="css/app.css?21"/> <link rel="stylesheet" href="css/app.css?22"/>
<link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="icon" href="favicon.ico" type="image/x-icon" />
<meta property="og:title" content="Webogram"> <meta property="og:title" content="Webogram">
@ -52,8 +52,8 @@
<script type="text/javascript" src="js/util.js?1"></script> <script type="text/javascript" src="js/util.js?1"></script>
<script type="text/javascript" src="js/app.js?15"></script> <script type="text/javascript" src="js/app.js?15"></script>
<script type="text/javascript" src="js/services.js?18"></script> <script type="text/javascript" src="js/services.js?19"></script>
<script type="text/javascript" src="js/controllers.js?26"></script> <script type="text/javascript" src="js/controllers.js?27"></script>
<script type="text/javascript" src="js/filters.js?3"></script> <script type="text/javascript" src="js/filters.js?3"></script>
<script type="text/javascript" src="js/directives.js?17"></script> <script type="text/javascript" src="js/directives.js?17"></script>

2
app/js/controllers.js

@ -220,7 +220,7 @@ angular.module('myApp.controllers', [])
var wrappedDialog = AppMessagesManager.wrapForDialog(dialog.top_message, dialog.unread_count); var wrappedDialog = AppMessagesManager.wrapForDialog(dialog.top_message, dialog.unread_count);
if (pos !== false) { if (pos !== false) {
var prev = $scope.dialogs.splice(pos, 1); var prev = $scope.dialogs.splice(pos, 1);
wrappedDialog = angular.extend(prev[0], wrappedDialog); // wrappedDialog = angular.extend(prev[0], wrappedDialog);
offset++; offset++;
} }
$scope.dialogs.unshift(wrappedDialog); $scope.dialogs.unshift(wrappedDialog);

18
app/js/services.js

@ -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'
}); });
} }

Loading…
Cancel
Save