Browse Source

Bugfixes

master
Igor Zhukov 9 years ago
parent
commit
55b980bd0b
  1. 9
      app/js/app.js
  2. 2
      app/js/directives.js
  3. 1
      app/js/lib/config.js
  4. 14
      app/js/lib/utils.js
  5. 12
      app/js/services.js
  6. 4
      app/less/app.less
  7. 2
      app/partials/desktop/full_gif.html
  8. 4
      app/partials/desktop/im.html

9
app/js/app.js

@ -7,12 +7,17 @@
'use strict'; 'use strict';
var extraModules = [];
if (Config.Modes.animations) {
extraModules.push('ngAnimate');
}
// Declare app level module which depends on filters, and services // Declare app level module which depends on filters, and services
angular.module('myApp', [ angular.module('myApp', [
'ngRoute', 'ngRoute',
'ngSanitize', 'ngSanitize',
'ngTouch', 'ngTouch',
// 'ngAnimate',
'ui.bootstrap', 'ui.bootstrap',
'mediaPlayer', 'mediaPlayer',
'izhukov.utils', 'izhukov.utils',
@ -25,7 +30,7 @@ angular.module('myApp', [
PRODUCTION_ONLY_END*/ PRODUCTION_ONLY_END*/
'myApp.directives', 'myApp.directives',
'myApp.controllers' 'myApp.controllers'
]). ].concat(extraModules)).
config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvider', function($locationProvider, $routeProvider, $compileProvider, StorageProvider) { config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvider', function($locationProvider, $routeProvider, $compileProvider, StorageProvider) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|filesystem|chrome-extension|app):|data:image\//); $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|filesystem|chrome-extension|app):|data:image\//);

2
app/js/directives.js

@ -1099,6 +1099,7 @@ angular.module('myApp.directives', ['myApp.filters'])
historyEl = $('.im_history', element)[0], historyEl = $('.im_history', element)[0],
scrollableWrap = $('.im_history_scrollable_wrap', element)[0], scrollableWrap = $('.im_history_scrollable_wrap', element)[0],
scrollable = $('.im_history_scrollable', element)[0], scrollable = $('.im_history_scrollable', element)[0],
emptyWrapEl = $('.im_history_empty_wrap', element)[0],
bottomPanelWrap = $('.im_bottom_panel_wrap', element)[0], bottomPanelWrap = $('.im_bottom_panel_wrap', element)[0],
sendFormWrap = $('.im_send_form_wrap', element)[0], sendFormWrap = $('.im_send_form_wrap', element)[0],
headWrap = $('.tg_page_head')[0], headWrap = $('.tg_page_head')[0],
@ -1412,6 +1413,7 @@ angular.module('myApp.directives', ['myApp.filters'])
$(historyMessagesEl).css({marginTop: 0}); $(historyMessagesEl).css({marginTop: 0});
var marginTop = scrollableWrap.offsetHeight var marginTop = scrollableWrap.offsetHeight
- historyMessagesEl.offsetHeight - historyMessagesEl.offsetHeight
- emptyWrapEl.offsetHeight
- (Config.Mobile ? 0 : 39); - (Config.Mobile ? 0 : 39);
if (historyMessagesEl.offsetHeight > 0 && marginTop > 0) { if (historyMessagesEl.offsetHeight > 0 && marginTop > 0) {

1
app/js/lib/config.js

@ -37,6 +37,7 @@ Config.Modes = {
packed: location.protocol == 'app:' || location.protocol == 'chrome-extension:', packed: location.protocol == 'app:' || location.protocol == 'chrome-extension:',
ios_standalone: window.navigator.standalone && navigator.userAgent.match(/iOS|iPhone|iPad/), ios_standalone: window.navigator.standalone && navigator.userAgent.match(/iOS|iPhone|iPad/),
chrome_packed: window.chrome && chrome.app && chrome.app.window && true || false, chrome_packed: window.chrome && chrome.app && chrome.app.window && true || false,
animations: true,
memory_only: false memory_only: false
}; };

14
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) { function onContentLoaded (cb) {
cb = onAnimationFrameCallback(cb);
setZeroTimeout(cb); setZeroTimeout(cb);
} }

12
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 = {}, var docs = {},
docsForHistory = {}, docsForHistory = {},
windowW = $(window).width(), windowW = $(window).width(),
@ -2096,13 +2096,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}); });
downloadPromise.then(function (blob) { downloadPromise.then(function (blob) {
delete historyDoc.progress;
if (blob) { if (blob) {
FileManager.getFileCorrectUrl(blob, doc.mime_type).then(function (url) { FileManager.getFileCorrectUrl(blob, doc.mime_type).then(function (url) {
historyDoc.url = $sce.trustAsResourceUrl(url); historyDoc.url = $sce.trustAsResourceUrl(url);
}) })
historyDoc.downloaded = true; historyDoc.downloaded = true;
} }
historyDoc.progress.percent = 100;
$timeout(function () {
delete historyDoc.progress;
});
console.log('file save done'); console.log('file save done');
}, function (e) { }, function (e) {
console.log('document download failed', e); console.log('document download failed', e);
@ -2283,6 +2286,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var applied = false; var applied = false;
var started = false; var started = false;
// $rootScope.$on('apiUpdate', function (e, update) {
// if (update._ == 'updateStickerSets') {
// }
// });
return { return {
start: start, start: start,
openStickersetLink: openStickersetLink, openStickersetLink: openStickersetLink,

4
app/less/app.less

@ -1529,6 +1529,9 @@ div.im_message_video_thumb {
.image-2x('../img/icons/IconsetW.png', 42px, 1171px); .image-2x('../img/icons/IconsetW.png', 42px, 1171px);
background-position: 0 -590px; background-position: 0 -590px;
.is_2x & {
background-position: 0 -591px;
}
} }
.im_message_geopoint { .im_message_geopoint {
@ -3626,6 +3629,7 @@ h5 {
left: 50%; left: 50%;
margin-left: -20px; margin-left: -20px;
margin-top: -20px; margin-top: -20px;
pointer-events: none;
} }
.img_gif_label { .img_gif_label {
font-weight: bold; font-weight: bold;

2
app/partials/desktop/full_gif.html

@ -10,7 +10,7 @@
</i> </i>
<div my-arc-progress="document.progress.percent"></div> <div my-arc-progress="document.progress.percent"></div>
</div> </div>
<div ng-switch-default class="img_gif_label noselect" class="img_gif_meta_contents">GIF</div> <div ng-switch-default class="img_gif_label noselect img_gif_meta_contents">GIF</div>
</div> </div>
<div ng-if="document.url" ng-show="document.downloaded &amp;&amp; isActive" ng-switch="document.mime_type == 'video/mp4'"> <div ng-if="document.url" ng-show="document.downloaded &amp;&amp; isActive" ng-switch="document.mime_type == 'video/mp4'">

4
app/partials/desktop/im.html

@ -104,7 +104,7 @@
<div class="im_history_scrollable"> <div class="im_history_scrollable">
<div class="im_history" ng-class="{im_history_selectable: !historyState.botActions, im_history_select_active: historyState.selectActions}"> <div class="im_history" ng-class="{im_history_selectable: !historyState.botActions, im_history_select_active: historyState.selectActions}">
<div ng-if="state.empty" ng-switch="state.mayBeHasMore"> <div class="im_history_empty_wrap" ng-show="state.empty" ng-switch="state.mayBeHasMore">
<div ng-switch-when="true" class="im_history_loading" my-vertical-position="0.25" padding="true"> <div ng-switch-when="true" class="im_history_loading" my-vertical-position="0.25" padding="true">
<div my-arc-progress stroke="5" width="60"></div> <div my-arc-progress stroke="5" width="60"></div>
</div> </div>
@ -112,7 +112,7 @@
</div> </div>
<div class="im_history_messages" ng-class="{im_history_messages_group: historyPeer.id < 0}"> <div class="im_history_messages" ng-class="{im_history_messages_group: historyPeer.id < 0}">
<div class="im_history_loading_more" ng-show="state.loaded && (!state.empty || state.mayBeHasMore)" ng-class="{im_history_loading_more_active: state.moreActive}"> <div class="im_history_loading_more" ng-class="{im_history_loading_more_active: state.moreActive}">
<div my-arc-progress stroke="3" width="26"></div> <div my-arc-progress stroke="3" width="26"></div>
</div> </div>
<div class="im_history_messages_peer" ng-show="peerHistory.peerID == historyPeer.id" ng-repeat="peerHistory in peerHistories"> <div class="im_history_messages_peer" ng-show="peerHistory.peerID == historyPeer.id" ng-repeat="peerHistory in peerHistories">

Loading…
Cancel
Save