From 92119a46fc1b92845666d60c9bb2fcdca4012ac5 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Thu, 21 May 2015 15:24:38 +0300 Subject: [PATCH] Bump to 0.4.6 Added scroll animation Supported sticker sets on mobile Decreased sticker size in history Fixed filter history after message focused --- app/js/app.js | 2 +- app/js/background.js | 2 +- app/js/controllers.js | 11 +++-- app/js/directives.js | 39 ++++++++++----- app/js/directives_mobile.js | 2 +- app/js/filters.js | 2 +- app/js/lib/bin_utils.js | 2 +- app/js/lib/config.js | 4 +- app/js/lib/crypto_worker.js | 2 +- app/js/lib/mtproto.js | 2 +- app/js/lib/mtproto_wrapper.js | 2 +- app/js/lib/ng_utils.js | 2 +- app/js/lib/tl_utils.js | 2 +- app/js/lib/utils.js | 8 ++- app/js/message_composer.js | 2 +- app/js/services.js | 24 ++++----- app/less/mobile.less | 10 ++++ app/manifest.json | 2 +- app/manifest.webapp | 2 +- app/partials/desktop/changelog_modal.html | 11 +++++ app/partials/mobile/changelog_modal.html | 15 +++++- app/partials/mobile/stickerset_modal.html | 60 +++++++++++++++++++++++ package.json | 2 +- 23 files changed, 162 insertions(+), 48 deletions(-) create mode 100644 app/partials/mobile/stickerset_modal.html diff --git a/app/js/app.js b/app/js/app.js index 113bf8ec..4b93b081 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/background.js b/app/js/background.js index dd4229ad..185b2e36 100644 --- a/app/js/background.js +++ b/app/js/background.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/controllers.js b/app/js/controllers.js index b7ffc75d..c3c6a7c1 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -576,13 +576,13 @@ angular.module('myApp.controllers', ['myApp.i18n']) AppUsersManager.resolveUsername($routeParams.p.substr(1)).then(function (userID) { $scope.curDialog = { peer: AppUsersManager.getUserString(userID), - messageID: $routeParams.m || false + messageID: parseInt($routeParams.m) || false }; }); } else { $scope.curDialog = { peer: $routeParams.p || false, - messageID: $routeParams.m || false + messageID: parseInt($routeParams.m) || false }; } } @@ -1109,13 +1109,13 @@ angular.module('myApp.controllers', ['myApp.i18n']) } function messageFocusHistory () { - var history = historiesQueueFind(); + var history = historiesQueueFind(peerID); if (history && history.ids.indexOf($scope.curDialog.messageID) != -1) { $scope.historyUnread = {}; $scope.$broadcast('messages_focus', $scope.curDialog.messageID); - $scope.$broadcast('ui_history_change_scroll'); + $scope.$broadcast('ui_history_change_scroll', true); } else { loadHistory(); } @@ -1461,6 +1461,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) function toggleMedia (mediaType) { $scope.historyFilter.mediaType = mediaType || false; + $scope.curDialog.messageID = false; peerHistory.messages = []; peerHistory.ids = []; $scope.state.empty = true; diff --git a/app/js/directives.js b/app/js/directives.js index 202f3b4c..4314a4bf 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -1050,9 +1050,10 @@ angular.module('myApp.directives', ['myApp.filters']) }); }); - function changeScroll (noFocus) { + function changeScroll (noFocus, animated) { var unreadSplit, focusMessage; + var newScrollTop = false; // console.trace('change scroll'); if (!noFocus && (focusMessage = $('.im_message_focus:visible', scrollableWrap)[0])) { @@ -1060,24 +1061,34 @@ angular.module('myApp.directives', ['myApp.filters']) st = scrollableWrap.scrollTop, ot = focusMessage.offsetTop, h = focusMessage.clientHeight; - if (!st || st + ch < ot || st > ot + h) { - scrollableWrap.scrollTop = Math.max(0, ot - Math.floor(ch / 2) + 26); + if (!st || st + ch < ot || st > ot + h || animated) { + newScrollTop = Math.max(0, ot - Math.floor(ch / 2) + 26); } atBottom = false; } else if (unreadSplit = $('.im_message_unread_split:visible', scrollableWrap)[0]) { // console.log('change scroll unread', unreadSplit.offsetTop); - scrollableWrap.scrollTop = Math.max(0, unreadSplit.offsetTop - 52); + newScrollTop = Math.max(0, unreadSplit.offsetTop - 52); atBottom = false; } else { // console.log('change scroll bottom'); - scrollableWrap.scrollTop = scrollableWrap.scrollHeight; + newScrollTop = scrollableWrap.scrollHeight; atBottom = true; } - updateScroller(); - $timeout(function () { - $(scrollableWrap).trigger('scroll'); - scrollTopInitial = scrollableWrap.scrollTop; - }); + if (newScrollTop !== false) { + var afterScroll = function () { + updateScroller(); + $timeout(function () { + $(scrollableWrap).trigger('scroll'); + scrollTopInitial = scrollableWrap.scrollTop; + }); + } + if (animated) { + $(scrollableWrap).animate({scrollTop: newScrollTop}, 200, afterScroll); + } else { + scrollableWrap.scrollTop = newScrollTop; + afterScroll(); + } + } }; $scope.$on('ui_history_change', function () { @@ -1095,8 +1106,10 @@ angular.module('myApp.directives', ['myApp.filters']) }); }); - $scope.$on('ui_history_change_scroll', function () { - onContentLoaded(changeScroll) + $scope.$on('ui_history_change_scroll', function (e, animated) { + onContentLoaded(function () { + changeScroll(false, animated); + }) }); $scope.$on('ui_history_focus', function () { diff --git a/app/js/directives_mobile.js b/app/js/directives_mobile.js index a18db84e..062d4045 100644 --- a/app/js/directives_mobile.js +++ b/app/js/directives_mobile.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/filters.js b/app/js/filters.js index 36b48512..a4ca7102 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/bin_utils.js b/app/js/lib/bin_utils.js index 4d5caf76..d6fb1711 100644 --- a/app/js/lib/bin_utils.js +++ b/app/js/lib/bin_utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/config.js b/app/js/lib/config.js index fca3a74b..36f6d6ab 100644 --- a/app/js/lib/config.js +++ b/app/js/lib/config.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -21,7 +21,7 @@ Config = window.Config || {}; Config.App = { id: 2496, hash: '8da85b0d5bfe62527e5b244c209159c3', - version: '0.4.5', + version: '0.4.6', domains: ['web.telegram.org', 'zhukov.github.io'] }; diff --git a/app/js/lib/crypto_worker.js b/app/js/lib/crypto_worker.js index bcbde616..75fbe25e 100644 --- a/app/js/lib/crypto_worker.js +++ b/app/js/lib/crypto_worker.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index 52042fa8..68da191f 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/mtproto_wrapper.js b/app/js/lib/mtproto_wrapper.js index 7287213d..2d678102 100644 --- a/app/js/lib/mtproto_wrapper.js +++ b/app/js/lib/mtproto_wrapper.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index 0208366b..b574b5d4 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/tl_utils.js b/app/js/lib/tl_utils.js index 91339f3d..a94547e2 100644 --- a/app/js/lib/tl_utils.js +++ b/app/js/lib/tl_utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/utils.js b/app/js/lib/utils.js index fdd3d023..9e6bcd2f 100644 --- a/app/js/lib/utils.js +++ b/app/js/lib/utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -492,7 +492,11 @@ function versionCompare (ver1, ver2) { var mode = decoder.WEBP_CSP_MODE; buffer.J = 4; - status = decoder.WebPDecode(data, data.length, config); + try { + status = decoder.WebPDecode(data, data.length, config); + } catch (e) { + status = e; + } ok = (status == 0); if (!ok) { diff --git a/app/js/message_composer.js b/app/js/message_composer.js index 074c211a..e1e9d2a1 100644 --- a/app/js/message_composer.js +++ b/app/js/message_composer.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/services.js b/app/js/services.js index adac9e49..68f756a7 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.5 - messaging web application for MTProto + * Webogram v0.4.6 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -3382,8 +3382,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) height = Math.min(windowH - 100, 260); } else if (isSticker) { - width = Math.min(windowW - 80, Config.Mobile ? 210 : 260); - height = Math.min(windowH - 100, Config.Mobile ? 210 : 260); + width = Math.min(windowW - 80, Config.Mobile ? 128 : 192); + height = Math.min(windowH - 100, Config.Mobile ? 128 : 192); } else { width = height = 100; } @@ -3809,7 +3809,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) templateUrl: templateUrl('stickerset_modal'), controller: 'StickersetModalController', scope: scope, - windowClass: 'stickerset_modal_window' + windowClass: 'stickerset_modal_window mobile_modal' }); } }) @@ -5463,19 +5463,21 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) return false; } - var started = !('registerProtocolHandler' in navigator); + var started = false; function start () { if (started) { return; } started = true; - try { - navigator.registerProtocolHandler('tg', '#im?tgaddr=%s', 'Telegram Web'); - } catch (e) {} - try { - navigator.registerProtocolHandler('web+tg', '#im?tgaddr=%s', 'Telegram Web'); - } catch (e) {} + if ('registerProtocolHandler' in navigator) { + try { + navigator.registerProtocolHandler('tg', '#im?tgaddr=%s', 'Telegram Web'); + } catch (e) {} + try { + navigator.registerProtocolHandler('web+tg', '#im?tgaddr=%s', 'Telegram Web'); + } catch (e) {} + } $(document).on('click', function (event) { var target = event.target; diff --git a/app/less/mobile.less b/app/less/mobile.less index 6c018669..caadc826 100644 --- a/app/less/mobile.less +++ b/app/less/mobile.less @@ -1674,4 +1674,14 @@ a.media_modal_date:hover { height: 18px; margin: 13px 17px; } +} + + +.stickerset_modal_stickers_list { + padding: 10px; +} +.stickerset_modal_sticker_wrap, +.stickerset_modal_sticker_wrap img { + width: 64px; + height: 64px; } \ No newline at end of file diff --git a/app/manifest.json b/app/manifest.json index 4cab6855..d32ad013 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "Telegram", "description": "Telegram Web App.\nMore info & source code here: https://github.com/zhukov/webogram", - "version": "0.4.5", + "version": "0.4.6", "short_name": "Telegram", "manifest_version": 2, "app": { diff --git a/app/manifest.webapp b/app/manifest.webapp index d6d632b8..99bae8ba 100644 --- a/app/manifest.webapp +++ b/app/manifest.webapp @@ -1,7 +1,7 @@ { "name": "Telegram", "description": "Telegram Web App.\nMore info & source code here: https://github.com/zhukov/webogram", - "version": "0.4.5", + "version": "0.4.6", "type": "privileged", "launch_path": "/index.html", "developer": { diff --git a/app/partials/desktop/changelog_modal.html b/app/partials/desktop/changelog_modal.html index 384bbb78..c7c913b8 100644 --- a/app/partials/desktop/changelog_modal.html +++ b/app/partials/desktop/changelog_modal.html @@ -31,6 +31,17 @@
+
+
0.4.6
+
+ +
+
+
0.4.5
diff --git a/app/partials/mobile/changelog_modal.html b/app/partials/mobile/changelog_modal.html index ea933c41..0d2a138a 100644 --- a/app/partials/mobile/changelog_modal.html +++ b/app/partials/mobile/changelog_modal.html @@ -19,9 +19,22 @@ + +