Browse Source

Fix saving recent search

master
Eduard Kuzmenko 4 years ago
parent
commit
fe8a54ea62
  1. 4
      src/components/sidebarLeft/index.ts
  2. 2
      src/lib/appManagers/AppInlineBotsManager.ts
  3. 5
      src/lib/appManagers/appMessagesManager.ts
  4. 8
      src/lib/appManagers/appPhotosManager.ts
  5. 4
      src/lib/appManagers/appUsersManager.ts
  6. 2
      src/scss/partials/pages/_pages.scss

4
src/components/sidebarLeft/index.ts

@ -173,7 +173,9 @@ export class AppSidebarLeft extends SidebarSlider {
const scrollable = new Scrollable(searchContainer); const scrollable = new Scrollable(searchContainer);
const close = () => { const close = () => {
//setTimeout(() => {
this.backBtn.click(); this.backBtn.click();
//}, 0);
}; };
this.searchGroups = { this.searchGroups = {
@ -360,7 +362,7 @@ export class AppSidebarLeft extends SidebarSlider {
} }
}; };
searchSuper.tabs.inputMessagesFilterEmpty.addEventListener('click', (e) => { searchSuper.tabs.inputMessagesFilterEmpty.addEventListener('mousedown', (e) => {
const target = findUpTag(e.target, 'LI') as HTMLElement; const target = findUpTag(e.target, 'LI') as HTMLElement;
if(!target) { if(!target) {
return; return;

2
src/lib/appManagers/AppInlineBotsManager.ts

@ -36,7 +36,7 @@ export class AppInlineBotsManager {
result.rDescription = RichTextProcessor.wrapRichText(result.description, {noLinebreaks: true, noLinks: true}); result.rDescription = RichTextProcessor.wrapRichText(result.description, {noLinebreaks: true, noLinks: true});
result.initials = ((result as botInlineResult).url || result.title || result.type || '').substr(0, 1); */ result.initials = ((result as botInlineResult).url || result.title || result.type || '').substr(0, 1); */
if(result._ == 'botInlineMediaResult') { if(result._ === 'botInlineMediaResult') {
if(result.document) { if(result.document) {
result.document = appDocsManager.saveDoc(result.document); result.document = appDocsManager.saveDoc(result.document);
} }

5
src/lib/appManagers/appMessagesManager.ts

@ -2188,6 +2188,11 @@ export class AppMessagesManager {
} else { } else {
message.media.photo = appPhotosManager.savePhoto(message.media.photo, mediaContext); message.media.photo = appPhotosManager.savePhoto(message.media.photo, mediaContext);
} }
if(!message.media.photo) { // * found this bug on test DC
delete message.media;
}
break; break;
case 'messageMediaPoll': case 'messageMediaPoll':
message.media.poll = appPollsManager.savePoll(message.media.poll, message.media.results); message.media.poll = appPollsManager.savePoll(message.media.poll, message.media.results);

8
src/lib/appManagers/appPhotosManager.ts

@ -49,9 +49,9 @@ export class AppPhotosManager {
} }
public savePhoto(photo: Photo, context?: ReferenceContext) { public savePhoto(photo: Photo, context?: ReferenceContext) {
if(photo._ == 'photoEmpty') return undefined; if(photo._ === 'photoEmpty') return undefined;
/* if(photo.id == TEST_FILE_REFERENCE) { /* if(photo.id === TEST_FILE_REFERENCE) {
console.warn('Testing FILE_REFERENCE_EXPIRED'); console.warn('Testing FILE_REFERENCE_EXPIRED');
const bytes = [2, 67, 175, 43, 190, 0, 0, 20, 62, 95, 111, 33, 45, 99, 220, 116, 218, 11, 167, 127, 213, 18, 127, 32, 243, 202, 117, 80, 30]; const bytes = [2, 67, 175, 43, 190, 0, 0, 20, 62, 95, 111, 33, 45, 99, 220, 116, 218, 11, 167, 127, 213, 18, 127, 32, 243, 202, 117, 80, 30];
//photo.file_reference = new Uint8Array(bytes); //photo.file_reference = new Uint8Array(bytes);
@ -69,7 +69,7 @@ export class AppPhotosManager {
if(photo.sizes?.length) { if(photo.sizes?.length) {
const size = photo.sizes[photo.sizes.length - 1]; const size = photo.sizes[photo.sizes.length - 1];
if(size._ == 'photoSizeProgressive') { if(size._ === 'photoSizeProgressive') {
size.size = size.sizes[size.sizes.length - 1]; size.size = size.sizes[size.sizes.length - 1];
} }
} }
@ -379,7 +379,7 @@ export class AppPhotosManager {
} }
const location: InputFileLocation.inputDocumentFileLocation | InputFileLocation.inputPhotoFileLocation = { const location: InputFileLocation.inputDocumentFileLocation | InputFileLocation.inputPhotoFileLocation = {
_: photo._ == 'document' ? 'inputDocumentFileLocation' : 'inputPhotoFileLocation', _: photo._ === 'document' ? 'inputDocumentFileLocation' : 'inputPhotoFileLocation',
id: photo.id, id: photo.id,
access_hash: photo.access_hash, access_hash: photo.access_hash,
file_reference: photo.file_reference, file_reference: photo.file_reference,

4
src/lib/appManagers/appUsersManager.ts

@ -608,18 +608,20 @@ export class AppUsersManager {
limit: 30, limit: 30,
hash: 0, hash: 0,
}).then((result) => { }).then((result) => {
let peerIds: number[]; let peerIds: number[] = [];
if(result._ === 'contacts.topPeers') { if(result._ === 'contacts.topPeers') {
//console.log(result); //console.log(result);
this.saveApiUsers(result.users); this.saveApiUsers(result.users);
appChatsManager.saveApiChats(result.chats); appChatsManager.saveApiChats(result.chats);
if(result.categories.length) {
peerIds = result.categories[0].peers.map((topPeer) => { peerIds = result.categories[0].peers.map((topPeer) => {
const peerId = appPeersManager.getPeerId(topPeer.peer); const peerId = appPeersManager.getPeerId(topPeer.peer);
appStateManager.setPeer(peerId, this.getUser(peerId)); appStateManager.setPeer(peerId, this.getUser(peerId));
return peerId; return peerId;
}); });
} }
}
appStateManager.pushToState('topPeers', peerIds); appStateManager.pushToState('topPeers', peerIds);

2
src/scss/partials/pages/_pages.scss

@ -206,7 +206,7 @@
} }
.input-field { .input-field {
text-align: center; text-align: initial;
} }
} }

Loading…
Cancel
Save