This commit is contained in:
Igor Zhukov 2016-01-20 00:49:50 +03:00
parent 53bf285800
commit 55b980bd0b
8 changed files with 41 additions and 7 deletions

View File

@ -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\//);

View File

@ -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) {

View File

@ -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
};

View File

@ -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);
}

View File

@ -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,

View File

@ -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;

View File

@ -10,7 +10,7 @@
</i>
<div my-arc-progress="document.progress.percent"></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 ng-if="document.url" ng-show="document.downloaded &amp;&amp; isActive" ng-switch="document.mime_type == 'video/mp4'">

View File

@ -104,7 +104,7 @@
<div class="im_history_scrollable">
<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 my-arc-progress stroke="5" width="60"></div>
</div>
@ -112,7 +112,7 @@
</div>
<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>
<div class="im_history_messages_peer" ng-show="peerHistory.peerID == historyPeer.id" ng-repeat="peerHistory in peerHistories">