parent
10c6d37656
commit
60df682f79
@ -32,14 +32,27 @@ angular.module('myApp.filters', ['myApp.i18n'])
|
||||
.filter('userStatus', function($filter, _) {
|
||||
var relativeTimeFilter = $filter('relativeTime');
|
||||
return function (user) {
|
||||
if (!user || !user.status || user.status._ == 'userStatusEmpty') {
|
||||
return _('user_status_offline');
|
||||
}
|
||||
if (user.status._ == 'userStatusOnline') {
|
||||
return _('user_status_online');
|
||||
}
|
||||
var statusType = user && user.status && user.status._ || 'userStatusEmpty';
|
||||
switch (statusType) {
|
||||
case 'userStatusOnline':
|
||||
return _('user_status_online');
|
||||
|
||||
return _('user_status_last_seen', relativeTimeFilter(user.status.was_online));
|
||||
case 'userStatusOffline':
|
||||
return _('user_status_last_seen', relativeTimeFilter(user.status.was_online));
|
||||
|
||||
case 'userStatusRecently':
|
||||
return _('user_status_recently');
|
||||
|
||||
case 'userStatusLastWeek':
|
||||
return _('user_status_last_week');
|
||||
|
||||
case 'userStatusLastMonth':
|
||||
return _('user_status_last_month');
|
||||
|
||||
case 'userStatusEmpty':
|
||||
default:
|
||||
return _('user_status_long_ago');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -732,7 +732,8 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
|
||||
var serializer = new TLSerialization(options);
|
||||
|
||||
if (!this.connectionInited) {
|
||||
serializer.storeInt(0x1c900537, 'invokeWithLayer18');
|
||||
serializer.storeInt(0xda9b0d0d, 'invokeWithLayer');
|
||||
serializer.storeInt(Config.Schema.API.layer, 'layer');
|
||||
serializer.storeInt(0x69796de9, 'initConnection');
|
||||
serializer.storeInt(Config.App.id, 'api_id');
|
||||
serializer.storeString(navigator.userAgent || 'Unknown UserAgent', 'device_model');
|
||||
|
@ -168,7 +168,7 @@ contactBlocked#561bc879 user_id:int date:int = ContactBlocked;
|
||||
|
||||
contactSuggested#3de191a1 user_id:int mutual_contacts:int = ContactSuggested;
|
||||
|
||||
contactStatus#aa77b873 user_id:int expires:int = ContactStatus;
|
||||
contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus;
|
||||
|
||||
chatLocated#3631cf4c chat_id:int distance:int = ChatLocated;
|
||||
|
||||
@ -391,6 +391,34 @@ contacts.found#566000e results:Vector<ContactFound> users:Vector<User> = contact
|
||||
|
||||
updateServiceNotification#382dd3e4 type:string message:string media:MessageMedia popup:Bool = Update;
|
||||
|
||||
userStatusRecently#e26f42f1 = UserStatus;
|
||||
userStatusLastWeek#7bf09fc = UserStatus;
|
||||
userStatusLastMonth#77ebc742 = UserStatus;
|
||||
|
||||
updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;
|
||||
|
||||
inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;
|
||||
|
||||
privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;
|
||||
|
||||
inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;
|
||||
inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;
|
||||
inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule;
|
||||
inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule;
|
||||
inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;
|
||||
inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;
|
||||
|
||||
privacyValueAllowContacts#fffe1bac = PrivacyRule;
|
||||
privacyValueAllowAll#65427b82 = PrivacyRule;
|
||||
privacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule;
|
||||
privacyValueDisallowContacts#f888fa1a = PrivacyRule;
|
||||
privacyValueDisallowAll#8b73e763 = PrivacyRule;
|
||||
privacyValueDisallowUsers#c7f49b7 users:Vector<int> = PrivacyRule;
|
||||
|
||||
account.privacyRules#554abb6f rules:Vector<PrivacyRule> users:Vector<User> = account.PrivacyRules;
|
||||
|
||||
accountDaysTTL#b8d0afdf days:int = AccountDaysTTL;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
@ -513,4 +541,10 @@ account.updateUsername#3e0bdd7c username:string = User;
|
||||
|
||||
contacts.search#11f812d8 q:string limit:int = contacts.Found;
|
||||
|
||||
invokeWithLayer18#1c900537 {X:Type} query:!X = X;
|
||||
account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;
|
||||
account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;
|
||||
account.deleteAccount#418d4e0b reason:string = Bool;
|
||||
account.getAccountTTL#8fc711d = AccountDaysTTL;
|
||||
account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool;
|
||||
|
||||
invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
|
@ -90,9 +90,12 @@
|
||||
|
||||
"user_name_deleted": "DELETED",
|
||||
"user_first_name_deleted": "DELETED",
|
||||
"user_status_offline": "offline",
|
||||
"user_status_online": "online",
|
||||
"user_status_last_seen": "last seen {0}",
|
||||
"user_status_recently": "last seen recently",
|
||||
"user_status_last_week": "last seen within a week",
|
||||
"user_status_last_month": "last seen within a month",
|
||||
"user_status_long_ago": "last seen a long time ago",
|
||||
"chat_title_deleted": "DELETED",
|
||||
"format_size_progress_mulitple": "{done} of {total} {parts}",
|
||||
"format_size_progress": "{done} of {total}",
|
||||
|
@ -97,7 +97,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
apiUser.rFullName = RichTextProcessor.wrapRichText(apiUser.last_name, {noLinks: true, noLinebreaks: true}) || apiUser.rPhone || _('user_name_deleted');
|
||||
}
|
||||
apiUser.sortName = SearchIndexManager.cleanSearchText(apiUser.first_name + ' ' + (apiUser.last_name || ''));
|
||||
apiUser.sortStatus = apiUser.status && (apiUser.status.expires || apiUser.status.was_online) || 0;
|
||||
apiUser.sortStatus = getUserStatusForSort(apiUser.status);
|
||||
|
||||
|
||||
if (users[apiUser.id] === undefined) {
|
||||
@ -112,6 +112,26 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
}
|
||||
};
|
||||
|
||||
function getUserStatusForSort(status) {
|
||||
if (status) {
|
||||
var expires = status.expires || status.was_online;
|
||||
if (expires) {
|
||||
return expires;
|
||||
}
|
||||
var timeNow = tsNow(true) + serverTimeOffset;
|
||||
switch (status._) {
|
||||
case 'userStatusRecently':
|
||||
return tsNow(true) + serverTimeOffset - 86400 * 3;
|
||||
case 'userStatusLastWeek':
|
||||
return tsNow(true) + serverTimeOffset - 86400 * 7;
|
||||
case 'userStatusLastMonth':
|
||||
return tsNow(true) + serverTimeOffset - 86400 * 30;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getUser (id) {
|
||||
if (angular.isObject(id)) {
|
||||
return id;
|
||||
@ -163,9 +183,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
function updateUsersStatuses () {
|
||||
var timestampNow = tsNow(true) + serverTimeOffset;
|
||||
angular.forEach(users, function (user) {
|
||||
if (user.status && user.status._ == 'userStatusOnline' &&
|
||||
if (user.status &&
|
||||
user.status._ == 'userStatusOnline' &&
|
||||
user.status.expires < timestampNow) {
|
||||
user.status = {_: 'userStatusOffline', was_online: user.status.expires};
|
||||
user.status = user.status.wasStatus ||
|
||||
{_: 'userStatusOffline', was_online: user.status.expires};
|
||||
delete user.status.wasStatus;
|
||||
$rootScope.$broadcast('user_update', user.id);
|
||||
}
|
||||
});
|
||||
@ -173,8 +196,21 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
|
||||
function forceUserOnline (id) {
|
||||
var user = getUser(id);
|
||||
if (user && (!user.status || user.status._ != 'userStatusOnline')) {
|
||||
user.status = {_: 'userStatusOnline', expires: tsNow(true) + serverTimeOffset + 60};
|
||||
if (user &&
|
||||
user.status &&
|
||||
user.status._ != 'userStatusOnline' &&
|
||||
user.status._ != 'userStatusEmpty') {
|
||||
|
||||
var wasStatus;
|
||||
if (user.status._ != 'userStatusOffline') {
|
||||
delete user.status.wasStatus;
|
||||
wasStatus != angular.copy(user.status);
|
||||
}
|
||||
user.status = {
|
||||
_: 'userStatusOnline',
|
||||
expires: tsNow(true) + serverTimeOffset + 60,
|
||||
wasStatus: wasStatus
|
||||
};
|
||||
$rootScope.$broadcast('user_update', id);
|
||||
}
|
||||
}
|
||||
@ -305,7 +341,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
user = users[userID];
|
||||
if (user) {
|
||||
user.status = update.status;
|
||||
user.sortStatus = update.status && (update.status.expires || update.status.was_online) || 0;
|
||||
user.sortStatus = getUserStatusForSort(update.status);
|
||||
$rootScope.$broadcast('user_update', userID);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user