From 55b980bd0b23e3aac8022aea0c2ab222bd045556 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 20 Jan 2016 00:49:50 +0300 Subject: [PATCH] Bugfixes --- app/js/app.js | 9 +++++++-- app/js/directives.js | 2 ++ app/js/lib/config.js | 1 + app/js/lib/utils.js | 14 ++++++++++++++ app/js/services.js | 12 ++++++++++-- app/less/app.less | 4 ++++ app/partials/desktop/full_gif.html | 2 +- app/partials/desktop/im.html | 4 ++-- 8 files changed, 41 insertions(+), 7 deletions(-) diff --git a/app/js/app.js b/app/js/app.js index 1affa791..6f90ca53 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -7,12 +7,17 @@ 'use strict'; +var extraModules = []; +if (Config.Modes.animations) { + extraModules.push('ngAnimate'); +} + + // Declare app level module which depends on filters, and services angular.module('myApp', [ 'ngRoute', 'ngSanitize', 'ngTouch', - // 'ngAnimate', 'ui.bootstrap', 'mediaPlayer', 'izhukov.utils', @@ -25,7 +30,7 @@ angular.module('myApp', [ PRODUCTION_ONLY_END*/ 'myApp.directives', 'myApp.controllers' -]). +].concat(extraModules)). config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvider', function($locationProvider, $routeProvider, $compileProvider, StorageProvider) { $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|filesystem|chrome-extension|app):|data:image\//); diff --git a/app/js/directives.js b/app/js/directives.js index e8496750..88731a29 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1099,6 +1099,7 @@ angular.module('myApp.directives', ['myApp.filters']) historyEl = $('.im_history', element)[0], scrollableWrap = $('.im_history_scrollable_wrap', element)[0], scrollable = $('.im_history_scrollable', element)[0], + emptyWrapEl = $('.im_history_empty_wrap', element)[0], bottomPanelWrap = $('.im_bottom_panel_wrap', element)[0], sendFormWrap = $('.im_send_form_wrap', element)[0], headWrap = $('.tg_page_head')[0], @@ -1412,6 +1413,7 @@ angular.module('myApp.directives', ['myApp.filters']) $(historyMessagesEl).css({marginTop: 0}); var marginTop = scrollableWrap.offsetHeight - historyMessagesEl.offsetHeight + - emptyWrapEl.offsetHeight - (Config.Mobile ? 0 : 39); if (historyMessagesEl.offsetHeight > 0 && marginTop > 0) { diff --git a/app/js/lib/config.js b/app/js/lib/config.js index 469bfd94..8b6b5d79 100644 --- a/app/js/lib/config.js +++ b/app/js/lib/config.js @@ -37,6 +37,7 @@ Config.Modes = { packed: location.protocol == 'app:' || location.protocol == 'chrome-extension:', ios_standalone: window.navigator.standalone && navigator.userAgent.match(/iOS|iPhone|iPad/), chrome_packed: window.chrome && chrome.app && chrome.app.window && true || false, + animations: true, memory_only: false }; diff --git a/app/js/lib/utils.js b/app/js/lib/utils.js index 1cc8b783..a1077165 100644 --- a/app/js/lib/utils.js +++ b/app/js/lib/utils.js @@ -289,7 +289,21 @@ function scrollToNode (scrollable, node, scroller) { } } +if (Config.Modes.animations && + typeof window.requestAnimationFrame == 'function') { + window.onAnimationFrameCallback = function (cb) { + return (function () { + window.requestAnimationFrame(cb); + }); + }; +} else { + window.onAnimationFrameCallback = function (cb) { + return cb; + }; +} + function onContentLoaded (cb) { + cb = onAnimationFrameCallback(cb); setZeroTimeout(cb); } diff --git a/app/js/services.js b/app/js/services.js index cbe48856..7e339210 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -1907,7 +1907,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } }) -.service('AppDocsManager', function ($sce, $rootScope, $modal, $window, $q, RichTextProcessor, MtpApiFileManager, FileManager, qSync) { +.service('AppDocsManager', function ($sce, $rootScope, $modal, $window, $q, $timeout, RichTextProcessor, MtpApiFileManager, FileManager, qSync) { var docs = {}, docsForHistory = {}, windowW = $(window).width(), @@ -2096,13 +2096,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) }); downloadPromise.then(function (blob) { - delete historyDoc.progress; if (blob) { FileManager.getFileCorrectUrl(blob, doc.mime_type).then(function (url) { historyDoc.url = $sce.trustAsResourceUrl(url); }) historyDoc.downloaded = true; } + historyDoc.progress.percent = 100; + $timeout(function () { + delete historyDoc.progress; + }); console.log('file save done'); }, function (e) { console.log('document download failed', e); @@ -2283,6 +2286,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var applied = false; var started = false; + // $rootScope.$on('apiUpdate', function (e, update) { + // if (update._ == 'updateStickerSets') { + // } + // }); + return { start: start, openStickersetLink: openStickersetLink, diff --git a/app/less/app.less b/app/less/app.less index 4fb87269..4dd37b09 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -1529,6 +1529,9 @@ div.im_message_video_thumb { .image-2x('../img/icons/IconsetW.png', 42px, 1171px); background-position: 0 -590px; + .is_2x & { + background-position: 0 -591px; + } } .im_message_geopoint { @@ -3626,6 +3629,7 @@ h5 { left: 50%; margin-left: -20px; margin-top: -20px; + pointer-events: none; } .img_gif_label { font-weight: bold; diff --git a/app/partials/desktop/full_gif.html b/app/partials/desktop/full_gif.html index cb02be0d..ae2f3024 100644 --- a/app/partials/desktop/full_gif.html +++ b/app/partials/desktop/full_gif.html @@ -10,7 +10,7 @@
-
GIF
+
GIF
diff --git a/app/partials/desktop/im.html b/app/partials/desktop/im.html index 2c3a0c41..22a72e87 100644 --- a/app/partials/desktop/im.html +++ b/app/partials/desktop/im.html @@ -104,7 +104,7 @@
-
+
@@ -112,7 +112,7 @@
-
+