Added StatusManager, GA counter, improved readme
This commit is contained in:
parent
a0dc7a7195
commit
70cdf39378
@ -31,6 +31,7 @@ Here are some screenshots of the interface:
|
||||
* Emoji keyboard
|
||||
* Send plain-text messages to user or group
|
||||
* Send files (photos or documents) via attach icon or drag'n'drop
|
||||
* Desktop notifications
|
||||
|
||||
|
||||
### Unsupported at the moment
|
||||
@ -38,7 +39,6 @@ Here are some screenshots of the interface:
|
||||
* Secret chats
|
||||
* Create new group
|
||||
* Edit group photo/title/participants
|
||||
* Desktop notifications
|
||||
* Settings
|
||||
* Edit profile/userpic
|
||||
* Contacts
|
||||
@ -62,6 +62,13 @@ Install [node.js](http://nodejs.org/) and run `node server.js`. Open page http:/
|
||||
#### Running as Chrome Packaged App
|
||||
|
||||
It is possible to run this application in Chrome browser as a packaged app. In order to do this, open this URL in Chrome: `chrome://extensions/`, then tick "Developer mode" and press "Load unpacked extension...". Select the downloaded `app` folder and Webogram application should appear in the list.
|
||||
Also it's necessary to replace following line in index.html:
|
||||
```<html lang="en" ng-app="myApp"><!-- ng-csp=""-->```
|
||||
with:
|
||||
```<html lang="en" ng-app="myApp" ng-csp="">```
|
||||
|
||||
|
||||
You can also download this application from Chrome Web Store: [chrome.google.com/webstore/detail/telegram-unofficial/clhhggbfdinjmjhajaheehoeibfljjno](https://chrome.google.com/webstore/detail/telegram-unofficial/clhhggbfdinjmjhajaheehoeibfljjno). This is more secure way to use app than plain HTTP in web, because sources are downloaded only once and via HTTPS.
|
||||
|
||||
|
||||
### Third party libraries
|
||||
|
@ -21,6 +21,16 @@
|
||||
|
||||
<div ng-view></div>
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-45099287-2');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="vendor/console-polyfill/console-polyfill.js"></script>
|
||||
<script type="text/javascript" src="vendor/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="vendor/jquery.nanoscroller/nanoscroller.js"></script>
|
||||
@ -38,12 +48,12 @@
|
||||
|
||||
|
||||
<script type="text/javascript" src="js/lib/config.js"></script>
|
||||
<script type="text/javascript" src="js/lib/mtproto.js?11"></script>
|
||||
<script type="text/javascript" src="js/lib/mtproto.js?12"></script>
|
||||
|
||||
<script type="text/javascript" src="js/util.js"></script>
|
||||
<script type="text/javascript" src="js/app.js?5"></script>
|
||||
<script type="text/javascript" src="js/services.js?6"></script>
|
||||
<script type="text/javascript" src="js/controllers.js?11"></script>
|
||||
<script type="text/javascript" src="js/services.js?7"></script>
|
||||
<script type="text/javascript" src="js/controllers.js?12"></script>
|
||||
<script type="text/javascript" src="js/filters.js?3"></script>
|
||||
<script type="text/javascript" src="js/directives.js?7"></script>
|
||||
|
||||
|
@ -232,13 +232,14 @@ angular.module('myApp.controllers', [])
|
||||
|
||||
})
|
||||
|
||||
.controller('AppImHistoryController', function ($scope, $location, $timeout, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, IdleManager) {
|
||||
.controller('AppImHistoryController', function ($scope, $location, $timeout, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, IdleManager, StatusManager) {
|
||||
|
||||
$scope.$watch('curDialog.peer', applyDialogSelect);
|
||||
|
||||
ApiUpdatesManager.attach();
|
||||
|
||||
IdleManager.start();
|
||||
StatusManager.start();
|
||||
|
||||
$scope.history = [];
|
||||
$scope.typing = {};
|
||||
|
@ -1807,14 +1807,17 @@ angular.module('myApp.services', [])
|
||||
|
||||
$rootScope.idle = {isIDLE: false};
|
||||
|
||||
var toPromise;
|
||||
var toPromise, started = false;
|
||||
|
||||
return {
|
||||
start: start
|
||||
};
|
||||
|
||||
function start () {
|
||||
$($window).on('blur focus keydown mousedown touchstart', onEvent);
|
||||
if (!started) {
|
||||
started = true;
|
||||
$($window).on('blur focus keydown mousedown touchstart', onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
function onEvent (e) {
|
||||
@ -1847,6 +1850,46 @@ angular.module('myApp.services', [])
|
||||
}
|
||||
})
|
||||
|
||||
.service('StatusManager', function ($timeout, $rootScope, MtpApiManager, IdleManager) {
|
||||
|
||||
var toPromise, lastOnlineUpdated = 0, started = false;
|
||||
|
||||
return {
|
||||
start: start
|
||||
};
|
||||
|
||||
function start() {
|
||||
if (!started) {
|
||||
started = true;
|
||||
$rootScope.$watch('idle.isIDLE', checkIDLE);
|
||||
}
|
||||
}
|
||||
|
||||
function sendUpdateStatusReq(offline) {
|
||||
var date = (1 * new Date());
|
||||
if (offline && !lastOnlineUpdated ||
|
||||
!offline && (date - lastOnlineUpdated) < 50000) {
|
||||
return;
|
||||
}
|
||||
lastOnlineUpdated = offline ? 0 : date;
|
||||
return MtpApiManager.invokeApi('account.updateStatus', {
|
||||
offline: offline
|
||||
});
|
||||
}
|
||||
|
||||
function checkIDLE() {
|
||||
toPromise && $timeout.cancel(toPromise);
|
||||
if ($rootScope.idle.isIDLE) {
|
||||
toPromise = $timeout(function () {
|
||||
sendUpdateStatusReq(true);
|
||||
}, 5000);
|
||||
} else {
|
||||
sendUpdateStatusReq(false);
|
||||
toPromise = $timeout(checkIDLE, 60000);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
.service('NotificationsManager', function ($rootScope, $window, $timeout, $interval, MtpApiManager, AppPeersManager, IdleManager) {
|
||||
|
||||
@ -1921,7 +1964,9 @@ angular.module('myApp.services', [])
|
||||
$($window).on('click', requestPermission);
|
||||
}
|
||||
|
||||
$($window).on('beforeunload', notificationsClear);
|
||||
try {
|
||||
$($window).on('beforeunload', notificationsClear);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function requestPermission() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Telegram UNOFFICIAL",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"short_name": "Webogram",
|
||||
"manifest_version": 2,
|
||||
"app": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user