|
7 | 7 |
|
8 | 8 | angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) |
9 | 9 |
|
10 | | - .factory('MtpApiManager', function (Storage, MtpAuthorizer, MtpNetworkerFactory, MtpSingleInstanceService, AppRuntimeManager, ErrorService, qSync, $rootScope, $q, TelegramMeWebService) { |
| 10 | + .factory('MtpApiManager', function (Storage, MtpAuthorizer, MtpNetworkerFactory, MtpSingleInstanceService, AppRuntimeManager, ErrorService, qSync, $rootScope, $q, WebPushApiManager, TelegramMeWebService) { |
11 | 11 | var cachedNetworkers = {} |
12 | 12 | var cachedUploadNetworkers = {} |
13 | 13 | var cachedExportPromise = {} |
@@ -47,11 +47,12 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) |
47 | 47 | for (var dcID = 1; dcID <= 5; dcID++) { |
48 | 48 | storageKeys.push('dc' + dcID + '_auth_key') |
49 | 49 | } |
| 50 | + WebPushApiManager.forceUnsubscribe() |
50 | 51 | return Storage.get(storageKeys).then(function (storageResult) { |
51 | 52 | var logoutPromises = [] |
52 | 53 | for (var i = 0; i < storageResult.length; i++) { |
53 | 54 | if (storageResult[i]) { |
54 | | - logoutPromises.push(mtpInvokeApi('auth.logOut', {}, {dcID: i + 1})) |
| 55 | + logoutPromises.push(mtpInvokeApi('auth.logOut', {}, {dcID: i + 1, ignoreErrors: true})) |
55 | 56 | } |
56 | 57 | } |
57 | 58 | return $q.all(logoutPromises).then(function () { |
@@ -156,6 +157,9 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) |
156 | 157 | error = {message: error} |
157 | 158 | } |
158 | 159 | deferred.reject(error) |
| 160 | + if (options.ignoreErrors) { |
| 161 | + return |
| 162 | + } |
159 | 163 |
|
160 | 164 | if (error.code == 406) { |
161 | 165 | error.handled = true |
|
0 commit comments