Browse Source

Fix saving recent search

master
Eduard Kuzmenko 4 years ago
parent
commit
fe8a54ea62
  1. 6
      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. 16
      src/lib/appManagers/appUsersManager.ts
  6. 2
      src/scss/partials/pages/_pages.scss

6
src/components/sidebarLeft/index.ts

@ -173,7 +173,9 @@ export class AppSidebarLeft extends SidebarSlider { @@ -173,7 +173,9 @@ export class AppSidebarLeft extends SidebarSlider {
const scrollable = new Scrollable(searchContainer);
const close = () => {
this.backBtn.click();
//setTimeout(() => {
this.backBtn.click();
//}, 0);
};
this.searchGroups = {
@ -360,7 +362,7 @@ export class AppSidebarLeft extends SidebarSlider { @@ -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;
if(!target) {
return;

2
src/lib/appManagers/AppInlineBotsManager.ts

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

5
src/lib/appManagers/appMessagesManager.ts

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

8
src/lib/appManagers/appPhotosManager.ts

@ -49,9 +49,9 @@ export class AppPhotosManager { @@ -49,9 +49,9 @@ export class AppPhotosManager {
}
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');
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);
@ -69,7 +69,7 @@ export class AppPhotosManager { @@ -69,7 +69,7 @@ export class AppPhotosManager {
if(photo.sizes?.length) {
const size = photo.sizes[photo.sizes.length - 1];
if(size._ == 'photoSizeProgressive') {
if(size._ === 'photoSizeProgressive') {
size.size = size.sizes[size.sizes.length - 1];
}
}
@ -379,7 +379,7 @@ export class AppPhotosManager { @@ -379,7 +379,7 @@ export class AppPhotosManager {
}
const location: InputFileLocation.inputDocumentFileLocation | InputFileLocation.inputPhotoFileLocation = {
_: photo._ == 'document' ? 'inputDocumentFileLocation' : 'inputPhotoFileLocation',
_: photo._ === 'document' ? 'inputDocumentFileLocation' : 'inputPhotoFileLocation',
id: photo.id,
access_hash: photo.access_hash,
file_reference: photo.file_reference,

16
src/lib/appManagers/appUsersManager.ts

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

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

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

Loading…
Cancel
Save