From 0555fa13a2d1bd17431872300ede62c2c7b98b33 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 17 Sep 2014 13:43:05 +0400 Subject: [PATCH] Added notification after auth_key generated Closes #464 --- app/index.html | 2 ++ app/js/controllers.js | 23 +++++++++++++++++-- app/js/services.js | 3 +++ app/partials/country_select_modal.html | 2 +- app/partials/im.html | 2 -- app/partials/mobile/country_select_modal.html | 2 +- app/webogram.appcache | 2 +- 7 files changed, 29 insertions(+), 7 deletions(-) diff --git a/app/index.html b/app/index.html index 503713d9..731a8515 100644 --- a/app/index.html +++ b/app/index.html @@ -35,6 +35,8 @@
+ +
diff --git a/app/js/controllers.js b/app/js/controllers.js index 6794c791..33bb7109 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -23,9 +23,10 @@ angular.module('myApp.controllers', []) ChangelogNotifyService.checkUpdate(); }) - .controller('AppLoginController', function ($scope, $location, $timeout, $modal, $modalStack, MtpApiManager, ErrorService, ChangelogNotifyService) { + .controller('AppLoginController', function ($scope, $rootScope, $location, $timeout, $modal, $modalStack, MtpApiManager, ErrorService, NotificationsManager, ChangelogNotifyService, IdleManager) { $modalStack.dismissAll(); + IdleManager.start(); MtpApiManager.getUserID().then(function (id) { if (id) { @@ -184,6 +185,12 @@ angular.module('myApp.controllers', []) phone_number: $scope.credentials.phone_number }).then(function () { $scope.progress.enabled = true; + + onContentLoaded(function () { + $scope.$broadcast('ui_height'); + }); + + var authKeyStarted = tsNow(); MtpApiManager.invokeApi('auth.sendCode', { phone_number: $scope.credentials.phone_full, sms_type: 5, @@ -200,6 +207,10 @@ angular.module('myApp.controllers', []) callCheck(); + onContentLoaded(function () { + $scope.$broadcast('ui_height'); + }); + }, function (error) { $scope.progress.enabled = false; console.log('sendCode error', error); @@ -218,6 +229,14 @@ angular.module('myApp.controllers', []) error.handled = true; break; } + })['finally'](function () { + if ($rootScope.idle.isIDLE || tsNow() - authKeyStarted > 60000) { + NotificationsManager.notify({ + title: 'Telegram', + message: 'Your authorization key was successfully generated! Open the app to log in.', + tag: 'auth_key' + }); + } }); }); } @@ -1066,7 +1085,7 @@ angular.module('myApp.controllers', []) } onContentLoaded(function () { $scope.$broadcast('messages_focus', $scope.curDialog.messageID || 0); - }) + }); $scope.$broadcast('ui_history_change'); AppMessagesManager.readHistory($scope.curDialog.inputPeer); diff --git a/app/js/services.js b/app/js/services.js index f6da174a..22cf2269 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3608,6 +3608,9 @@ angular.module('myApp.services', []) if (Config.Navigator.ffos) { data.image = 'https://raw.githubusercontent.com/zhukov/webogram/master/app/img/icons/icon60.png'; } + else if (!data.image) { + data.image = 'img/icons/icon60.png'; + } notificationsCount++; diff --git a/app/partials/country_select_modal.html b/app/partials/country_select_modal.html index a6454837..c7331877 100644 --- a/app/partials/country_select_modal.html +++ b/app/partials/country_select_modal.html @@ -5,7 +5,7 @@ diff --git a/app/partials/im.html b/app/partials/im.html index 0c8f1972..943e22b6 100644 --- a/app/partials/im.html +++ b/app/partials/im.html @@ -277,5 +277,3 @@ - -
diff --git a/app/partials/mobile/country_select_modal.html b/app/partials/mobile/country_select_modal.html index 9a3ff344..49b606f6 100644 --- a/app/partials/mobile/country_select_modal.html +++ b/app/partials/mobile/country_select_modal.html @@ -26,7 +26,7 @@