Browse Source

Fixed session revoke handling, fixed undefined location, IM styles

master
Igor Zhukov 10 years ago
parent
commit
dd7d5d91ca
  1. 2
      app/css/app.css
  2. 4
      app/js/controllers.js
  3. 15
      app/js/directives.js
  4. 11
      app/js/lib/mtproto.js

2
app/css/app.css

@ -2206,7 +2206,7 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status {
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
width: 112px; width: 112px;
height: 50px; height: 52px;
margin: -8px 0 0 -112px; margin: -8px 0 0 -112px;
} }
@media (min-width: 1024px) { @media (min-width: 1024px) {

4
app/js/controllers.js

@ -300,7 +300,9 @@ angular.module('myApp.controllers', [])
}, function (error) { }, function (error) {
if (error.code == 401) { if (error.code == 401) {
$location.url('/login'); MtpApiManager.logOut()['finally'](function () {
$location.url('/login');
});
} }
}); });
} }

15
app/js/directives.js

@ -89,12 +89,16 @@ angular.module('myApp.directives', ['myApp.filters'])
return; return;
} }
if (!headWrap) { if (!headWrap || !headWrap.offsetHeight) {
headWrap = $('.tg_page_head')[0]; headWrap = $('.tg_page_head')[0];
} }
if (!footer || !footer.offsetHeight) {
footer = $('.im_page_footer')[0];
}
$(element).css({ $(element).css({
height: $($window).height() - footer.offsetHeight - (headWrap ? headWrap.offsetHeight : 44) - 72 height: $($window).height() - footer.offsetHeight - (headWrap ? headWrap.offsetHeight : 44) - 72
}); });
updateScroller(); updateScroller();
} }
@ -276,6 +280,12 @@ angular.module('myApp.directives', ['myApp.filters'])
}); });
} }
if (!headWrap || !headWrap.offsetHeight) {
headWrap = $('.tg_page_head')[0];
}
if (!footer || !footer.offsetHeight) {
footer = $('.im_page_footer')[0];
}
var historyH = $($window).height() - panelWrap.offsetHeight - bottomPanelWrap.offsetHeight - (headWrap ? headWrap.offsetHeight : 44) - footer.offsetHeight; var historyH = $($window).height() - panelWrap.offsetHeight - bottomPanelWrap.offsetHeight - (headWrap ? headWrap.offsetHeight : 44) - footer.offsetHeight;
$(historyWrap).css({ $(historyWrap).css({
height: historyH height: historyH
@ -496,7 +506,8 @@ angular.module('myApp.directives', ['myApp.filters'])
var cachedSrc = MtpApiFileManager.getCachedFile( var cachedSrc = MtpApiFileManager.getCachedFile(
scope.thumb && scope.thumb &&
scope.thumb.location && scope.thumb.location &&
!scope.thumb.location.empty !scope.thumb.location.empty &&
scope.thumb.location
); );
if (cachedSrc) { if (cachedSrc) {

11
app/js/lib/mtproto.js

@ -2333,6 +2333,12 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker
return mtpInvokeApi('auth.logOut').then(function () { return mtpInvokeApi('auth.logOut').then(function () {
AppConfigManager.remove('dc', 'user_auth'); AppConfigManager.remove('dc', 'user_auth');
baseDcID = false;
}, function (error) {
AppConfigManager.remove('dc', 'user_auth');
if (error && error.code != 401) {
AppConfigManager.remove('dc' + baseDcID + '_auth_key');
}
baseDcID = false; baseDcID = false;
}); });
} }
@ -2597,6 +2603,11 @@ factory('MtpApiFileManager', function (MtpApiManager, $q, $window) {
case 'inputAudioFileLocation': case 'inputAudioFileLocation':
return 'audio' + location.id; return 'audio' + location.id;
} }
if (!location.volume_id) {
console.trace('Empty location', location);
}
return location.volume_id + '_' + location.local_id + '_' + location.secret + '.jpg'; return location.volume_id + '_' + location.local_id + '_' + location.secret + '.jpg';
}; };

Loading…
Cancel
Save