diff --git a/app/css/app.css b/app/css/app.css index 36c9eead..f183c6f2 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -991,13 +991,13 @@ a.im_message_from_photo, a.im_message_contact_photo { margin: 1px 12px 0 0; } -.im_message_contact_name { - color: #3C6E97; - font-weight: bold; -} .non_osx .im_message_contact_name { font-size: 12px; } +.im_message_contact_name { + font-weight: bold; + /*color: #3C6E97;*/ +} a.im_message_photo_thumb, a.im_message_video_thumb { display: block; diff --git a/app/js/controllers.js b/app/js/controllers.js index a4f1d455..207ac177 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -936,7 +936,8 @@ angular.module('myApp.controllers', []) _: 'inputMediaContact', phone_number: $scope.user.phone, first_name: $scope.user.first_name, - last_name: $scope.user.last_name + last_name: $scope.user.last_name, + user_id: $scope.user.id }); $rootScope.$broadcast('history_focus', {peerString: peerString}); }) diff --git a/app/js/directives.js b/app/js/directives.js index 63ec8549..a83999f4 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -622,18 +622,28 @@ angular.module('myApp.directives', ['myApp.filters']) if (cachedSrc) { element.attr('src', cachedSrc); } + if ($scope.thumb && $scope.thumb.width && $scope.thumb.height) { + element.attr('width', $scope.thumb.width); + element.attr('height', $scope.thumb.height); + } - $scope.$watchCollection('thumb.location', function (newLocation) { + var stopWatching = $scope.$watchCollection('thumb.location', function (newLocation) { + if ($scope.thumb && $scope.thumb.width && $scope.thumb.height) { + element.attr('width', $scope.thumb.width); + element.attr('height', $scope.thumb.height); + } // console.log('new loc', newLocation, arguments); var counterSaved = ++counter; if (!newLocation || newLocation.empty) { element.attr('src', $scope.thumb && $scope.thumb.placeholder || 'img/blank.gif'); + cleanup(); return; } var cachedSrc = MtpApiFileManager.getCachedFile(newLocation); if (cachedSrc) { element.attr('src', cachedSrc); + cleanup(); return; } @@ -644,15 +654,24 @@ angular.module('myApp.directives', ['myApp.filters']) MtpApiFileManager.downloadSmallFile($scope.thumb.location, $scope.thumb.size).then(function (url) { if (counterSaved == counter) { element.attr('src', url); + cleanup(); } }, function (e) { console.log('Download image failed', e, $scope.thumb.location); if (counterSaved == counter) { element.attr('src', $scope.thumb.placeholder || 'img/blank.gif'); + cleanup(); } }); }) + var cleanup = angular.noop; + // function () { + // setTimeout(function () { + // $scope.$destroy() + // stopWatching(); + // }, 0); + // }; } }) @@ -761,9 +780,7 @@ angular.module('myApp.directives', ['myApp.filters']) \ \