diff --git a/app/js/app.js b/app/js/app.js index 30a6c76a..d69358a0 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 5644302f..85cf1d9a 100644 --- a/app/js/background.js +++ b/app/js/background.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 ef550a60..85b62df7 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -791,22 +791,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) } return result; - }, function (error) { - if (error.code == 401) { - MtpApiManager.logOut()['finally'](function () { - if (location.protocol == 'http:' && - !Config.Modes.http && - Config.App.domains.indexOf(location.hostname) != -1) { - location.href = location.href.replace(/^http:/, 'https:'); - } else { - location.hash = '/login'; - AppRuntimeManager.reload(); - } - }); - error.handled = true; - } - - return $q.reject(); }); }; @@ -2626,6 +2610,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.password = {_: 'account.noPassword'}; updatePasswordState(); var updatePasswordTimeout = false; + var stopped = false; $scope.changePassword = function (options) { options = options || {}; @@ -2660,12 +2645,17 @@ angular.module('myApp.controllers', ['myApp.i18n']) updatePasswordTimeout = false; PasswordManager.getState().then(function (result) { $scope.password = result; - if (result._ == 'account.noPassword' && result.email_unconfirmed_pattern) { + if (result._ == 'account.noPassword' && result.email_unconfirmed_pattern && !stopped) { updatePasswordTimeout = $timeout(updatePasswordState, 5000); } }); } + $scope.$on('$destroy', function () { + $timeout.cancel(updatePasswordTimeout); + stopped = true; + }); + function onPhotoSelected (photo) { if (!photo || !photo.type || photo.type.indexOf('image') !== 0) { @@ -2997,6 +2987,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.slice = {limit: 20, limitDelta: 20}; var updateSessionsTimeout = false; + var stopped = false; function updateSessions () { $timeout.cancel(updateSessionsTimeout); @@ -3018,7 +3009,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) } return sB.date_active - sA.date_active; }); - updateSessionsTimeout = $timeout(updateSessions, 5000); + if (!stopped) { + updateSessionsTimeout = $timeout(updateSessions, 5000); + } }) } @@ -3042,6 +3035,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) } }); + $scope.$on('$destroy', function () { + $timeout.cancel(updateSessionsTimeout); + stopped = true; + }); + }) .controller('PasswordUpdateModalController', function ($scope, $q, _, PasswordManager, MtpApiManager, ErrorService, $modalInstance) { diff --git a/app/js/directives.js b/app/js/directives.js index 3f5dc052..3d888027 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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/directives_mobile.js b/app/js/directives_mobile.js index ce7a30b5..edcda57a 100644 --- a/app/js/directives_mobile.js +++ b/app/js/directives_mobile.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 f52bb6b5..8a32485b 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 404350eb..0bad7395 100644 --- a/app/js/lib/bin_utils.js +++ b/app/js/lib/bin_utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 3ab2b429..a3926039 100644 --- a/app/js/lib/config.js +++ b/app/js/lib/config.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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.2', + version: '0.4.3', domains: ['web.telegram.org', 'zhukov.github.io'] }; diff --git a/app/js/lib/crypto_worker.js b/app/js/lib/crypto_worker.js index 3543c238..c57e24ad 100644 --- a/app/js/lib/crypto_worker.js +++ b/app/js/lib/crypto_worker.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 0d4b5cf1..a55e6081 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 fa1821a6..bf20ae44 100644 --- a/app/js/lib/mtproto_wrapper.js +++ b/app/js/lib/mtproto_wrapper.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -7,7 +7,7 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) -.factory('MtpApiManager', function (Storage, MtpAuthorizer, MtpNetworkerFactory, MtpSingleInstanceService, ErrorService, qSync, $q, TelegramMeWebService) { +.factory('MtpApiManager', function (Storage, MtpAuthorizer, MtpNetworkerFactory, MtpSingleInstanceService, AppRuntimeManager, ErrorService, qSync, $q, TelegramMeWebService) { var cachedNetworkers = {}, cachedUploadNetworkers = {}, cachedExportPromise = {}, @@ -134,7 +134,20 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) error.stack = error.originalError && error.originalError.stack || error.stack || (new Error()).stack; setTimeout(function () { if (!error.handled) { - ErrorService.show({error: error}); + if (error.code == 401) { + mtpLogOut()['finally'](function () { + if (location.protocol == 'http:' && + !Config.Modes.http && + Config.App.domains.indexOf(location.hostname) != -1) { + location.href = location.href.replace(/^http:/, 'https:'); + } else { + location.hash = '/login'; + AppRuntimeManager.reload(); + } + }); + } else { + ErrorService.show({error: error}); + } error.handled = true; } }, 100); diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index 1199e87e..5e48c43a 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 c9e4c0af..83899d7d 100644 --- a/app/js/lib/tl_utils.js +++ b/app/js/lib/tl_utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 961ba603..de66ff16 100644 --- a/app/js/lib/utils.js +++ b/app/js/lib/utils.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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/message_composer.js b/app/js/message_composer.js index 04bb8571..f036919d 100644 --- a/app/js/message_composer.js +++ b/app/js/message_composer.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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 f7d06f47..a1ac383f 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.4.2 - messaging web application for MTProto + * Webogram v0.4.3 - 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/less/app.less b/app/less/app.less index 73589abb..8f47be5a 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -2799,11 +2799,8 @@ a.contacts_modal_contact:hover .md_modal_list_peer_description, text-align: center; } } -.sessions_wrap { - -} -.sessions_scrollable_wrap { - +.sessions_modal_sessions_list { + margin-bottom: 20px; } .session_active_date_online { color: #3a6d99; diff --git a/app/manifest.json b/app/manifest.json index 2d5caeec..417a2407 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.2", + "version": "0.4.3", "short_name": "Telegram", "manifest_version": 2, "app": { diff --git a/app/manifest.webapp b/app/manifest.webapp index 59bb6cef..afc38e5b 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.2", + "version": "0.4.3", "type": "privileged", "launch_path": "/index.html", "developer": { diff --git a/package.json b/package.json index 43aeb57d..5c038378 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Telegram", "description": "Telegram Web App.\nMore info & source code here: https://github.com/zhukov/webogram", - "version": "0.4.2", + "version": "0.4.3", "main": "app/index.html", "single-instance": true, "dom_storage_quota": 40,