website attach draft
This commit is contained in:
parent
0fc08f1db8
commit
48b9d94289
@ -457,6 +457,14 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
templateUrl: templateUrl('message_attach_contact')
|
||||
};
|
||||
})
|
||||
.directive('myMessageWebpage', function() {
|
||||
return {
|
||||
scope: {
|
||||
'webpage': '=myMessageWebpage'
|
||||
},
|
||||
templateUrl: templateUrl('message_attach_webpage')
|
||||
};
|
||||
})
|
||||
.directive('myMessagePending', function() {
|
||||
return {
|
||||
templateUrl: templateUrl('message_attach_pending')
|
||||
|
File diff suppressed because one or more lines are too long
@ -191,11 +191,7 @@ messages.messagesSlice#b446ae3 count:int messages:Vector<Message> chats:Vector<C
|
||||
|
||||
messages.messageEmpty#3f4e0648 = messages.Message;
|
||||
|
||||
messages.statedMessages#7d84b48 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int pts_count:int = messages.StatedMessages;
|
||||
|
||||
messages.statedMessage#96240c6a message:Message chats:Vector<Chat> users:Vector<User> pts:int pts_count:int = messages.StatedMessage;
|
||||
|
||||
messages.sentMessage#900eac40 id:int date:int pts:int pts_count:int = messages.SentMessage;
|
||||
messages.sentMessage#4c3d47f3 id:int date:int media:MessageMedia pts:int pts_count:int = messages.SentMessage;
|
||||
|
||||
messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;
|
||||
|
||||
@ -247,7 +243,7 @@ upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
|
||||
|
||||
dcOption#2ec2a43c id:int hostname:string ip_address:string port:int = DcOption;
|
||||
|
||||
config#3e6f732a date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int broadcast_size_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int disabled_features:Vector<DisabledFeature> = Config;
|
||||
config#68bac247 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int broadcast_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int disabled_features:Vector<DisabledFeature> = Config;
|
||||
|
||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||
|
||||
@ -256,11 +252,7 @@ help.noAppUpdate#c45a6536 = help.AppUpdate;
|
||||
|
||||
help.inviteText#18cb9f78 message:string = help.InviteText;
|
||||
|
||||
messages.statedMessagesLinks#51be5d19 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int pts_count:int links:Vector<contacts.Link> seq:int = messages.StatedMessages;
|
||||
|
||||
messages.statedMessageLink#948a288 message:Message chats:Vector<Chat> users:Vector<User> pts:int pts_count:int links:Vector<contacts.Link> seq:int = messages.StatedMessage;
|
||||
|
||||
messages.sentMessageLink#e923400d id:int date:int pts:int pts_count:int links:Vector<contacts.Link> seq:int = messages.SentMessage;
|
||||
messages.sentMessageLink#35a1a663 id:int date:int media:MessageMedia pts:int pts_count:int links:Vector<contacts.Link> seq:int = messages.SentMessage;
|
||||
|
||||
inputGeoChat#74d456fa chat_id:int access_hash:long = InputGeoChat;
|
||||
|
||||
@ -410,9 +402,6 @@ account.sentChangePhoneCode#a4f58c4c phone_code_hash:string send_call_timeout:in
|
||||
|
||||
updateUserPhone#12b9417b user_id:int phone:string = Update;
|
||||
|
||||
account.noPassword#5770e7a9 new_salt:bytes = account.Password;
|
||||
account.password#739e5f72 current_salt:bytes new_salt:bytes hint:string = account.Password;
|
||||
|
||||
documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
|
||||
documentAttributeAnimated#11b58939 = DocumentAttribute;
|
||||
documentAttributeSticker#994c9882 alt:string = DocumentAttribute;
|
||||
@ -440,6 +429,27 @@ contactLinkNone#feedd3ad = ContactLink;
|
||||
contactLinkHasPhone#268f3f59 = ContactLink;
|
||||
contactLinkContact#d502c2d0 = ContactLink;
|
||||
|
||||
updateWebPage#2cc36971 webpage:WebPage = Update;
|
||||
|
||||
webPageEmpty#eb1477e8 id:long = WebPage;
|
||||
webPagePending#c586da1c id:long date:int = WebPage;
|
||||
webPage#a31ea0b5 flags:# id:long url:string display_url:string type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string = WebPage;
|
||||
|
||||
messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
|
||||
|
||||
authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;
|
||||
|
||||
account.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations;
|
||||
|
||||
account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password;
|
||||
account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password;
|
||||
|
||||
account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings;
|
||||
|
||||
account.passwordInputSettings#bcfc532c flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings;
|
||||
|
||||
auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
@ -492,15 +502,15 @@ messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;
|
||||
messages.receivedMessages#28abcb68 max_id:int = Vector<int>;
|
||||
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
|
||||
messages.sendMessage#1ca852a1 peer:InputPeer reply_to_msg_id:int message:string random_id:long = messages.SentMessage;
|
||||
messages.sendMedia#fcee7fc0 peer:InputPeer reply_to_msg_id:int media:InputMedia random_id:long = messages.StatedMessage;
|
||||
messages.forwardMessages#ded42045 peer:InputPeer id:Vector<int> random_id:Vector<long> = messages.StatedMessages;
|
||||
messages.sendMedia#33f6d58c peer:InputPeer reply_to_msg_id:int media:InputMedia random_id:long = Updates;
|
||||
messages.forwardMessages#55e1728d peer:InputPeer id:Vector<int> random_id:Vector<long> = Updates;
|
||||
messages.getChats#3c6aa187 id:Vector<int> = messages.Chats;
|
||||
messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull;
|
||||
messages.editChatTitle#b4bc68b5 chat_id:int title:string = messages.StatedMessage;
|
||||
messages.editChatPhoto#d881821d chat_id:int photo:InputChatPhoto = messages.StatedMessage;
|
||||
messages.addChatUser#2ee9ee9e chat_id:int user_id:InputUser fwd_limit:int = messages.StatedMessage;
|
||||
messages.deleteChatUser#c3c5cd23 chat_id:int user_id:InputUser = messages.StatedMessage;
|
||||
messages.createChat#419d9aee users:Vector<InputUser> title:string = messages.StatedMessage;
|
||||
messages.editChatTitle#dc452855 chat_id:int title:string = Updates;
|
||||
messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates;
|
||||
messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates;
|
||||
messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates;
|
||||
messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates;
|
||||
|
||||
updates.getState#edd4882a = updates.State;
|
||||
updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference;
|
||||
@ -520,8 +530,8 @@ help.getInviteText#a4a95186 lang_code:string = help.InviteText;
|
||||
|
||||
photos.getUserPhotos#b7ee553c user_id:InputUser offset:int max_id:int limit:int = photos.Photos;
|
||||
|
||||
messages.forwardMessage#3f3f4f2 peer:InputPeer id:int random_id:long = messages.StatedMessage;
|
||||
messages.sendBroadcast#41bb0972 contacts:Vector<InputUser> message:string media:InputMedia = messages.StatedMessages;
|
||||
messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates;
|
||||
messages.sendBroadcast#bf73f4da contacts:Vector<InputUser> random_id:Vector<long> message:string media:InputMedia = Updates;
|
||||
|
||||
geochats.getLocated#7f192d8f geo_point:InputGeoPoint radius:int limit:int = geochats.Located;
|
||||
geochats.getRecents#e1427e6f offset:int limit:int = geochats.Messages;
|
||||
@ -574,12 +584,17 @@ contacts.resolveUsername#bf0131c username:string = User;
|
||||
|
||||
account.sendChangePhoneCode#a407a8f4 phone_number:string = account.SentChangePhoneCode;
|
||||
account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User;
|
||||
account.getPassword#548a30f5 = account.Password;
|
||||
account.setPassword#dd2a4d8f current_password_hash:bytes new_salt:bytes new_password_hash:bytes hint:string = Bool;
|
||||
|
||||
auth.checkPassword#a63011e password_hash:bytes = auth.Authorization;
|
||||
|
||||
messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers;
|
||||
messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers;
|
||||
|
||||
account.updateDeviceLocked#38df3532 period:int = Bool;
|
||||
account.updateDeviceLocked#38df3532 period:int = Bool;
|
||||
account.getAuthorizations#e320c158 = account.Authorizations;
|
||||
account.resetAuthorization#df77f3bc hash:long = Bool;
|
||||
account.getPassword#548a30f5 = account.Password;
|
||||
account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings;
|
||||
account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool;
|
||||
|
||||
auth.checkPassword#a63011e password_hash:bytes = auth.Authorization;
|
||||
auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery;
|
||||
auth.recoverPassword#4ea56e92 code:string = auth.Authorization;
|
@ -801,6 +801,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
var pendingByRandomID = {};
|
||||
var pendingByMessageID = {};
|
||||
var pendingAfterMsgs = {};
|
||||
var pendingWebPages = {};
|
||||
var sendFilePromise = $q.when();
|
||||
var tempID = -1;
|
||||
|
||||
@ -1396,6 +1397,18 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
case 'messageMediaAudio':
|
||||
AppAudioManager.saveAudio(apiMessage.media.audio);
|
||||
break;
|
||||
case 'messageMediaWebPage':
|
||||
var webpage = apiMessage.media.webpage;
|
||||
if (webpage.photo && webpage.photo._ === 'photo') {
|
||||
AppPhotosManager.savePhoto(webpage.photo);
|
||||
} else {
|
||||
delete webpage.photo;
|
||||
}
|
||||
if (pendingWebPages[webpage.id] === undefined) {
|
||||
pendingWebPages[webpage.id] = {};
|
||||
}
|
||||
pendingWebPages[webpage.id][apiMessage.id] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (apiMessage.action && apiMessage.action._ == 'messageActionChatEditPhoto') {
|
||||
@ -1472,6 +1485,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
}, sentRequestOptions).then(function (sentMessage) {
|
||||
message.date = sentMessage.date;
|
||||
message.id = sentMessage.id;
|
||||
message.media = sentMessage.media;
|
||||
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updates',
|
||||
@ -2012,6 +2026,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
{noLinks: true, noLinebreaks: true}
|
||||
);
|
||||
break;
|
||||
|
||||
case 'messageMediaWebPage':
|
||||
if (message.media.webpage.photo) {
|
||||
message.media.webpage.photo = AppPhotosManager.wrapForHistory(message.media.webpage.photo.id, {website: true});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (message.action) {
|
||||
@ -2534,6 +2554,32 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 'updateWebPage':
|
||||
console.log('webpage update', update);
|
||||
var webpage = update.webpage;
|
||||
if (pendingWebPages[webpage.id] !== undefined) {
|
||||
var message, historyMessage;
|
||||
angular.forEach(pendingWebPages[webpage.id], function (t, msgID) {
|
||||
if (message = messagesStorage[msgID]) {
|
||||
message.media = {
|
||||
_: 'messageMediaWebPage',
|
||||
webpage: webpage
|
||||
};
|
||||
}
|
||||
if (historyMessage = messagesForHistory[msgID]) {
|
||||
if (webpage.photo) {
|
||||
AppPhotosManager.savePhoto(webpage.photo);
|
||||
webpage.photo = AppPhotosManager.wrapForHistory(webpage.photo.id, {website: true});
|
||||
}
|
||||
historyMessage.media = {
|
||||
_: 'messageMediaWebPage',
|
||||
webpage: webpage
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@ -2651,10 +2697,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
return photos[photoID] || {_: 'photoEmpty'};
|
||||
}
|
||||
|
||||
function wrapForHistory (photoID) {
|
||||
function wrapForHistory (photoID, options) {
|
||||
options = options || {};
|
||||
var photo = angular.copy(photos[photoID]) || {_: 'photoEmpty'},
|
||||
width = Math.min(windowW - 80, Config.Mobile ? 210 : 260),
|
||||
height = Math.min(windowH - 100, Config.Mobile ? 210 : 260),
|
||||
width = options.website ? 100 : Math.min(windowW - 80, Config.Mobile ? 210 : 260),
|
||||
height = options.website ? 100 : Math.min(windowH - 100, Config.Mobile ? 210 : 260),
|
||||
thumbPhotoSize = choosePhotoSize(photo, width, height),
|
||||
thumb = {
|
||||
placeholder: 'img/placeholders/PhotoThumbConversation.gif',
|
||||
|
@ -1614,7 +1614,8 @@ img.im_message_document_thumb {
|
||||
width: 265px;
|
||||
padding: 0 0 1px;
|
||||
}
|
||||
.im_message_document_actions {
|
||||
.im_message_document_actions,
|
||||
.im_message_website_description {
|
||||
width: 265px;
|
||||
}
|
||||
.im_message_document_name {
|
||||
@ -1760,7 +1761,8 @@ img.im_message_document_thumb {
|
||||
.im_message_document_name_wrap,
|
||||
.im_message_upload_progress_wrap,
|
||||
.im_message_download_progress_wrap,
|
||||
.im_message_document_actions {
|
||||
.im_message_document_actions,
|
||||
.im_message_website_description {
|
||||
width: 207px;
|
||||
}
|
||||
.im_message_document_name {
|
||||
|
@ -50,7 +50,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="::historyMessage.media ? true : false" class="im_message_media" ng-switch="historyMessage.media._">
|
||||
<div class="im_message_text" ng-if="::historyMessage.message.length || false" ng-bind-html="::historyMessage.richMessage" dir="auto"></div>
|
||||
<!-- <div class="im_message_external_embed_wrap" ng-if="::historyMessage.richUrlEmbed || false" my-external-embed="historyMessage.richUrlEmbed"></div> -->
|
||||
<div ng-if="::historyMessage.media || historyMessage.id < 0 ? true : false" class="im_message_media" ng-switch="historyMessage.media._">
|
||||
|
||||
<div ng-switch-when="messageMediaPhoto" my-message-photo></div>
|
||||
<div ng-switch-when="messageMediaVideo" my-message-video="historyMessage.media.video" message-id="historyMessage.id"></div>
|
||||
@ -58,6 +60,7 @@
|
||||
<div ng-switch-when="messageMediaAudio" class="im_message_audio" my-audio-player audio="historyMessage.media.audio"></div>
|
||||
<div ng-switch-when="messageMediaGeo" my-message-map></div>
|
||||
<div ng-switch-when="messageMediaContact" class="im_message_contact" my-message-contact></div>
|
||||
<div ng-switch-when="messageMediaWebPage" class="im_message_webpage" my-message-webpage="historyMessage.media.webpage"></div>
|
||||
<div ng-switch-when="messageMediaPending" my-message-pending></div>
|
||||
<div ng-switch-when="messageMediaUnsupported">
|
||||
<div class="im_message_text">
|
||||
@ -67,8 +70,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="im_message_text" ng-if="::historyMessage.message.length || false" ng-bind-html="::historyMessage.richMessage" dir="auto"></div>
|
||||
<div class="im_message_external_embed_wrap" ng-if="::historyMessage.richUrlEmbed || false" my-external-embed="historyMessage.richUrlEmbed"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
21
app/partials/desktop/message_attach_webpage.html
Normal file
21
app/partials/desktop/message_attach_webpage.html
Normal file
@ -0,0 +1,21 @@
|
||||
<div class="im_message_document clearfix" ng-class="{im_message_document_thumbed: !!webpage.photo}" ng-if="webpage._ == 'webPage'">
|
||||
|
||||
<a ng-if="::webpage.photo" ng-click="docOpen()">
|
||||
<div class="im_message_document_thumb_wrap">
|
||||
<img
|
||||
class="im_message_document_thumb"
|
||||
my-load-thumb
|
||||
thumb="webpage.photo.thumb"
|
||||
/>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div class="im_message_document_info">
|
||||
<div class="im_message_document_name_wrap">
|
||||
<a href="" ng-click="docOpen()" class="im_message_document_name" ng-bind="webpage.title || webpage.author"></a>
|
||||
<span class="im_message_document_size" ng-bind="webpage.display_url"></span>
|
||||
</div>
|
||||
<div class="im_message_website_description" ng-bind="webpage.description"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user