Skip to content

Commit 257d334

Browse files
committed
fixes and fixes
1 parent b2ef3c8 commit 257d334

43 files changed

Lines changed: 920 additions & 945 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ __pycache__
44
dist
55
.DS_Store
66
stats.json
7-
certs
7+
certs
8+
src/rlottie.github.io

‎public/rlottie-wasm.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎public/rlottie-wasm.wasm‎

-976 Bytes
Binary file not shown.

‎public/rlottie_with_printf/rlottie-wasm.js‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
311 KB
Binary file not shown.

‎src/components/appSearch.ts‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ export class SearchGroup {
5050

5151
export default class AppSearch {
5252
private minMsgID = 0;
53-
private loadedCount = 0;
54-
private foundCount = 0;
53+
private loadedCount = -1;
54+
private foundCount = -1;
5555
private offsetRate = 0;
56+
private loadedContacts = false;
5657

5758
private searchPromise: Promise<void> = null;
5859
private searchTimeout: number = 0;
@@ -107,9 +108,10 @@ export default class AppSearch {
107108
}
108109

109110
this.minMsgID = 0;
110-
this.loadedCount = 0;
111-
this.foundCount = 0;
111+
this.loadedCount = -1;
112+
this.foundCount = -1;
112113
this.offsetRate = 0;
114+
this.loadedContacts = false;
113115

114116
for(let i in this.searchGroups) {
115117
this.searchGroups[i].clear();
@@ -129,25 +131,27 @@ export default class AppSearch {
129131
public searchMore() {
130132
if(this.searchPromise) return this.searchPromise;
131133

132-
let query = this.query;
134+
const query = this.query;
133135

134136
if(!query.trim()) {
135137
this.onSearch && this.onSearch(0);
136138
return;
137139
}
138140

139-
if(this.loadedCount != 0 && this.loadedCount >= this.foundCount) {
141+
if(this.foundCount != -1 && this.loadedCount >= this.foundCount) {
140142
return Promise.resolve();
141143
}
142144

143-
let maxID = appMessagesIDsManager.getMessageIDInfo(this.minMsgID)[0];
145+
const maxID = appMessagesIDsManager.getMessageIDInfo(this.minMsgID)[0] || 0;
144146

145-
if(!this.peerID && !maxID) {
147+
if(!this.peerID && !maxID && !this.loadedContacts) {
146148
appUsersManager.searchContacts(query, 20).then((contacts: any) => {
147149
if(this.searchInput.value != query) {
148150
return;
149151
}
150152

153+
this.loadedContacts = true;
154+
151155
///////this.log('input search contacts result:', contacts);
152156

153157
let setResults = (results: any, group: SearchGroup, showMembersCount = false) => {
@@ -205,19 +209,19 @@ export default class AppSearch {
205209
return;
206210
}
207211

208-
//console.log('input search result:', this.peerID, query, null, maxID, 20, res);
212+
console.log('input search result:', this.peerID, query, null, maxID, 20, res);
209213

210-
let {count, history, next_rate} = res;
214+
const {count, history, next_rate} = res;
211215

212216
if(history[0] == this.minMsgID) {
213217
history.shift();
214218
}
215219

216-
let searchGroup = this.searchGroups['messages'];
220+
const searchGroup = this.searchGroups['messages'];
217221
searchGroup.setActive();
218222

219223
history.forEach((msgID: number) => {
220-
let message = appMessagesManager.getMessage(msgID);
224+
const message = appMessagesManager.getMessage(msgID);
221225
let originalDialog = appMessagesManager.getDialogByPeerID(message.peerID)[0];
222226

223227
if(!originalDialog) {
@@ -230,15 +234,18 @@ export default class AppSearch {
230234
} as any;
231235
}
232236

233-
let {dialog, dom} = appDialogsManager.addDialog(originalDialog, this.scrollable/* searchGroup.list */, false);
237+
const {dialog, dom} = appDialogsManager.addDialog(originalDialog, this.scrollable/* searchGroup.list */, false);
234238
appDialogsManager.setLastMessage(dialog, message, dom, query);
235239
});
236240

237241
this.minMsgID = history[history.length - 1];
238242
this.offsetRate = next_rate;
239243
this.loadedCount += history.length;
244+
if(this.loadedCount == -1) {
245+
this.loadedCount = 0;
246+
}
240247

241-
if(!this.foundCount) {
248+
if(this.foundCount == -1) {
242249
this.foundCount = count;
243250
this.onSearch && this.onSearch(this.foundCount);
244251
}

‎src/components/appSelectPeers.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class AppSelectPeers {
208208
}
209209

210210
public add(peerID: any, title?: string) {
211-
console.trace('add');
211+
//console.trace('add');
212212
const div = document.createElement('div');
213213
div.classList.add('selector-user', 'scale-in');
214214

‎src/components/audio.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ function wrapAudio(doc: MTDocument, audioEl: AudioElement) {
271271

272272
export default class AudioElement extends HTMLElement {
273273
public audio: HTMLAudioElement;
274+
public preloader: ProgressivePreloader;
274275

275276
private attachedHandlers: {[name: string]: any[]} = {};
276277
private onTypeDisconnect: () => void;
@@ -303,7 +304,7 @@ export default class AudioElement extends HTMLElement {
303304
const audioTimeDiv = this.querySelector('.audio-time') as HTMLDivElement;
304305
audioTimeDiv.innerHTML = durationStr;
305306

306-
let preloader: ProgressivePreloader;
307+
let preloader: ProgressivePreloader = this.preloader;
307308
let promise: CancellablePromise<Blob>;
308309

309310
const onLoad = () => {
@@ -377,7 +378,8 @@ export default class AudioElement extends HTMLElement {
377378
this.addEventListener('click', onClick);
378379
this.click();
379380
} else {
380-
onLoad();
381+
this.preloader.attach(this.querySelector('.audio-download'), false);
382+
//onLoad();
381383
}
382384
}
383385

@@ -402,6 +404,8 @@ export default class AudioElement extends HTMLElement {
402404

403405
delete this.attachedHandlers[name];
404406
}
407+
408+
this.preloader = null;
405409
}
406410

407411
static get observedAttributes(): string[] {

‎src/components/chatInput.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class ChatInput {
151151
}).then((webpage: any) => {
152152
appWebPagesManager.saveWebPage(webpage);
153153
if(this.lastUrl != url) return;
154-
console.log('got webpage: ', webpage);
154+
//console.log('got webpage: ', webpage);
155155

156156
this.setTopInfo(webpage.site_name || webpage.title, webpage.description || webpage.url);
157157

@@ -235,7 +235,7 @@ export class ChatInput {
235235
return new Promise<HTMLDivElement>((resolve, reject) => {
236236
let params: SendFileParams = {};
237237
params.file = file;
238-
console.log('selected file:', file, typeof(file), willAttach);
238+
//console.log('selected file:', file, typeof(file), willAttach);
239239
let itemDiv = document.createElement('div');
240240
switch(willAttach.type) {
241241
case 'media': {
@@ -249,6 +249,8 @@ export class ChatInput {
249249
source.src = params.objectURL = URL.createObjectURL(file);
250250
video.autoplay = false;
251251
video.controls = false;
252+
video.muted = true;
253+
video.setAttribute('playsinline', '');
252254

253255
video.onloadeddata = () => {
254256
params.width = video.videoWidth;
@@ -283,6 +285,8 @@ export class ChatInput {
283285
type: file.type.indexOf('image/') !== -1 ? 'photo' : 'doc'
284286
} as any, false, true);
285287

288+
params.objectURL = URL.createObjectURL(file);
289+
286290
itemDiv.append(docDiv);
287291
resolve(itemDiv);
288292
break;
@@ -364,7 +368,7 @@ export class ChatInput {
364368
this.attachMediaPopUp.mediaContainer.append(div);
365369
}
366370

367-
console.log('chatInput album layout:', layout);
371+
//console.log('chatInput album layout:', layout);
368372
} else {
369373
let params = willAttach.sendFileDetails[0];
370374
let div = results[0];
@@ -407,11 +411,13 @@ export class ChatInput {
407411
}, false);
408412

409413
this.attachMenu.media.addEventListener('click', () => {
414+
this.fileInput.setAttribute('accept', 'image/*, video/*');
410415
willAttach.type = 'media';
411416
this.fileInput.click();
412417
});
413418

414419
this.attachMenu.document.addEventListener('click', () => {
420+
this.fileInput.removeAttribute('accept');
415421
willAttach.type = 'document';
416422
this.fileInput.click();
417423
});
@@ -451,7 +457,7 @@ export class ChatInput {
451457
let caption = this.attachMediaPopUp.captionInput.value;
452458
willAttach.isMedia = willAttach.type == 'media';
453459

454-
console.log('will send files with options:', willAttach);
460+
//console.log('will send files with options:', willAttach);
455461

456462
let peerID = appImManager.peerID;
457463

@@ -471,7 +477,8 @@ export class ChatInput {
471477

472478
let promises = willAttach.sendFileDetails.map(params => {
473479
let promise = appMessagesManager.sendFile(peerID, params.file, Object.assign({
474-
isMedia: willAttach.isMedia,
480+
//isMedia: willAttach.isMedia,
481+
isMedia: true,
475482
caption,
476483
replyToMsgID: this.replyToMsgID
477484
}, params));

0 commit comments

Comments
 (0)