|
|
@ -18,6 +18,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
contactsFillPromise, |
|
|
|
contactsFillPromise, |
|
|
|
contactsList, |
|
|
|
contactsList, |
|
|
|
contactsIndex = SearchIndexManager.createIndex(), |
|
|
|
contactsIndex = SearchIndexManager.createIndex(), |
|
|
|
|
|
|
|
myID, |
|
|
|
serverTimeOffset = 0; |
|
|
|
serverTimeOffset = 0; |
|
|
|
|
|
|
|
|
|
|
|
Storage.get('server_time_offset').then(function (to) { |
|
|
|
Storage.get('server_time_offset').then(function (to) { |
|
|
@ -25,6 +26,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
serverTimeOffset = to; |
|
|
|
serverTimeOffset = to; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
MtpApiManager.getUserID().then(function (id) { |
|
|
|
|
|
|
|
myID = id; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function fillContacts () { |
|
|
|
function fillContacts () { |
|
|
|
if (contactsFillPromise) { |
|
|
|
if (contactsFillPromise) { |
|
|
@ -171,6 +175,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
return users[id] || {id: id, deleted: true, num: 1}; |
|
|
|
return users[id] || {id: id, deleted: true, num: 1}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getSelf() { |
|
|
|
|
|
|
|
return getUser(myID); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function hasUser(id) { |
|
|
|
function hasUser(id) { |
|
|
|
return angular.isObject(users[id]); |
|
|
|
return angular.isObject(users[id]); |
|
|
|
} |
|
|
|
} |
|
|
@ -424,6 +432,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
saveApiUsers: saveApiUsers, |
|
|
|
saveApiUsers: saveApiUsers, |
|
|
|
saveApiUser: saveApiUser, |
|
|
|
saveApiUser: saveApiUser, |
|
|
|
getUser: getUser, |
|
|
|
getUser: getUser, |
|
|
|
|
|
|
|
getSelf: getSelf, |
|
|
|
getUserInput: getUserInput, |
|
|
|
getUserInput: getUserInput, |
|
|
|
setUserStatus: setUserStatus, |
|
|
|
setUserStatus: setUserStatus, |
|
|
|
forceUserOnline: forceUserOnline, |
|
|
|
forceUserOnline: forceUserOnline, |
|
|
@ -2031,6 +2040,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
if (!Config.Navigator.mobile) { |
|
|
|
if (!Config.Navigator.mobile) { |
|
|
|
options.extractUrlEmbed = true; |
|
|
|
options.extractUrlEmbed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (message.flags & 16) { |
|
|
|
|
|
|
|
var user = AppUsersManager.getSelf(); |
|
|
|
|
|
|
|
if (user) { |
|
|
|
|
|
|
|
options.highlightUsername = user.username; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
message.richMessage = RichTextProcessor.wrapRichText(message.message, options); |
|
|
|
message.richMessage = RichTextProcessor.wrapRichText(message.message, options); |
|
|
|
if (options.extractedUrlEmbed) { |
|
|
|
if (options.extractedUrlEmbed) { |
|
|
|
message.richUrlEmbed = options.extractedUrlEmbed; |
|
|
|
message.richUrlEmbed = options.extractedUrlEmbed; |
|
|
@ -2240,7 +2255,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
notification.title = RichTextProcessor.wrapPlainText(notification.title); |
|
|
|
notification.title = RichTextProcessor.wrapPlainText(notification.title); |
|
|
|
|
|
|
|
|
|
|
|
notification.onclick = function () { |
|
|
|
notification.onclick = function () { |
|
|
|
$rootScope.$broadcast('history_focus', {peerString: peerString}); |
|
|
|
$rootScope.$broadcast('history_focus', { |
|
|
|
|
|
|
|
peerString: peerString, |
|
|
|
|
|
|
|
messageID: message.flags & 16 ? message.id : 0, |
|
|
|
|
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
notification.message = notificationMessage; |
|
|
|
notification.message = notificationMessage; |
|
|
@ -3843,9 +3861,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
|
|
|
|
|
|
|
|
if (match[3]) { // telegram.me links
|
|
|
|
if (match[3]) { // telegram.me links
|
|
|
|
if (!options.noLinks) { |
|
|
|
if (!options.noLinks) { |
|
|
|
|
|
|
|
var attr = ''; |
|
|
|
|
|
|
|
if (options.highlightUsername == match[3] && |
|
|
|
|
|
|
|
match[2] == '@') { |
|
|
|
|
|
|
|
attr = 'class="im_message_mymention"'; |
|
|
|
|
|
|
|
} |
|
|
|
html.push( |
|
|
|
html.push( |
|
|
|
match[1], |
|
|
|
match[1], |
|
|
|
'<a href="#/im?p=', |
|
|
|
'<a ' + attr + ' href="#/im?p=', |
|
|
|
encodeURIComponent('@' + match[3]), |
|
|
|
encodeURIComponent('@' + match[3]), |
|
|
|
'">', |
|
|
|
'">', |
|
|
|
encodeEntities(match[2] + match[3]), |
|
|
|
encodeEntities(match[2] + match[3]), |
|
|
|