Browse Source

Bump to 0.4.6

Added scroll animation
Supported sticker sets on mobile
Decreased sticker size in history
Fixed filter history after message focused
master
Igor Zhukov 9 years ago
parent
commit
92119a46fc
  1. 2
      app/js/app.js
  2. 2
      app/js/background.js
  3. 11
      app/js/controllers.js
  4. 39
      app/js/directives.js
  5. 2
      app/js/directives_mobile.js
  6. 2
      app/js/filters.js
  7. 2
      app/js/lib/bin_utils.js
  8. 4
      app/js/lib/config.js
  9. 2
      app/js/lib/crypto_worker.js
  10. 2
      app/js/lib/mtproto.js
  11. 2
      app/js/lib/mtproto_wrapper.js
  12. 2
      app/js/lib/ng_utils.js
  13. 2
      app/js/lib/tl_utils.js
  14. 8
      app/js/lib/utils.js
  15. 2
      app/js/message_composer.js
  16. 24
      app/js/services.js
  17. 10
      app/less/mobile.less
  18. 2
      app/manifest.json
  19. 2
      app/manifest.webapp
  20. 11
      app/partials/desktop/changelog_modal.html
  21. 15
      app/partials/mobile/changelog_modal.html
  22. 60
      app/partials/mobile/stickerset_modal.html
  23. 2
      package.json

2
app/js/app.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/background.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

11
app/js/controllers.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -576,13 +576,13 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -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']) @@ -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']) @@ -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;

39
app/js/directives.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -1050,9 +1050,10 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -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']) @@ -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']) @@ -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 () {

2
app/js/directives_mobile.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/filters.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/lib/bin_utils.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

4
app/js/lib/config.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -21,7 +21,7 @@ Config = window.Config || {}; @@ -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']
};

2
app/js/lib/crypto_worker.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/lib/mtproto.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/lib/mtproto_wrapper.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/lib/ng_utils.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/lib/tl_utils.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

8
app/js/lib/utils.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -492,7 +492,11 @@ function versionCompare (ver1, ver2) { @@ -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) {

2
app/js/message_composer.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

24
app/js/services.js

@ -1,5 +1,5 @@ @@ -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 <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -3382,8 +3382,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -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']) @@ -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']) @@ -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;

10
app/less/mobile.less

@ -1674,4 +1674,14 @@ a.media_modal_date:hover { @@ -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;
}

2
app/manifest.json

@ -1,7 +1,7 @@ @@ -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": {

2
app/manifest.webapp

@ -1,7 +1,7 @@ @@ -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": {

11
app/partials/desktop/changelog_modal.html

@ -31,6 +31,17 @@ @@ -31,6 +31,17 @@
<div class="md_modal_sections">
<div class="md_modal_versioned_section_wrap" ng-if="canShowVersion('0.4.6')">
<div class="md_modal_section_version">0.4.6</div>
<div class="md_modal_section_description changelog_version_changes">
<ul class="list-unstyled changelog_version_changes_list">
<li>Install and share custom sticker sets like this one: <a href="tg://addstickers?set=Animals">telegram.me/addstickers/Animals</a></li>
<li>If you're an artist, create custom sticker sets using our <a href="tg://resolve?domain=stickers">@Stickers</a> bot.</li>
<li>Check out <a href="https://telegram.org/blog/stickers-revolution" target="_blank">Telegram Blog</a> for more info</li>
</ul>
</div>
</div>
<div class="md_modal_versioned_section_wrap" ng-if="canShowVersion('0.4.5')">
<div class="md_modal_section_version">0.4.5</div>
<div class="md_modal_section_description changelog_version_changes">

15
app/partials/mobile/changelog_modal.html

@ -19,9 +19,22 @@ @@ -19,9 +19,22 @@
<div class="modal_section changelog_version_wrap">
<h3 class="modal_section_header changelog_version_title">
Version 0.4.5
Version 0.4.6
<span class="pull-right" my-i18n="changelog_modal_title_current_version"></span>
</h3>
<div class="modal_section_body changelog_version_changes">
<ul class="list-unstyled changelog_version_changes_list">
<li>Install and share custom sticker sets like this one: <a href="tg://addstickers?set=Animals">telegram.me/addstickers/Animals</a></li>
<li>If you're an artist, create custom sticker sets using our <a href="tg://resolve?domain=stickers">@Stickers</a> bot.</li>
<li>Check out <a href="https://telegram.org/blog/stickers-revolution" target="_blank">Telegram Blog</a> for more info</li>
</ul>
</div>
</div>
<div class="modal_section changelog_version_wrap">
<h3 class="modal_section_header changelog_version_title">
Version 0.4.5
</h3>
<div class="modal_section_body changelog_version_changes">
<ul class="list-unstyled changelog_version_changes_list">
<li>

60
app/partials/mobile/stickerset_modal.html

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
<div class="stickerset_modal_wrap">
<div class="tg_page_head tg_modal_head">
<div class="navbar navbar-static-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<ul class="nav navbar-nav navbar-quick-nav">
<li class="navbar-quick-right" ng-if="stickersetLoaded" ng-switch="stickersetInstalled">
<a ng-switch-when="true" my-i18n="stickerset_modal_uninstall" ng-click="toggleInstalled(false)"></a>
<a ng-switch-when="false" my-i18n="stickerset_modal_install" ng-click="toggleInstalled(true)"></a>
</li>
<li>
<a ng-click="$dismiss()" class="navbar-quick-media-back">
<i class="icon icon-back"></i>
<div class="navbar-quick-back-title">
<h4 ng-switch="!stickersetLoaded">
<span ng-switch-when="true" my-i18n="stickerset_modal_title_loading"></span>
<span ng-switch-default ng-bind="stickerset.title"></span>
</h4>
</div>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="modal-body">
<div my-stickers-list class="stickerset_modal_col">
<div class="stickerset_wrap nano" my-infinite-scroller>
<div class="stickerset_scrollable_wrap nano-content" ng-switch="!stickersetLoaded">
<div ng-switch-when="true" class="stickerset_modal_loading" my-vertical-position="0.2" padding="true" my-i18n="stickerset_modal_loading">
<my-i18n-param name="dots">
<span my-loading-dots></span>
</my-i18n-param>
</div>
<div ng-switch-default class="stickerset_modal_stickers_list clearfix">
<div class="stickerset_modal_sticker_wrap" ng-repeat="sticker in documents | limitTo: slice.limit">
<div class="stickerset_modal_sticker" my-load-sticker document="sticker" thumb="true"></div>
<div class="stickerset_modal_sticker_alt" ng-bind-html="sticker.stickerEmoji"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

2
package.json

@ -1,7 +1,7 @@ @@ -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",
"main": "app/index.html",
"single-instance": true,
"dom_storage_quota": 40,

Loading…
Cancel
Save