Fix close animation on iOS Safari
Fix dividing screen after swiping back if input was focused
This commit is contained in:
parent
c44b9a7734
commit
805b7bcf43
@ -1,6 +1,6 @@
|
|||||||
import { MOUNT_CLASS_TO } from "../config/debug";
|
import { MOUNT_CLASS_TO } from "../config/debug";
|
||||||
import { isMobileSafari } from "../helpers/userAgent";
|
import { isMobileSafari } from "../helpers/userAgent";
|
||||||
import { cancelEvent } from "../helpers/dom";
|
import { blurActiveElement, cancelEvent } from "../helpers/dom";
|
||||||
import { logger } from "../lib/logger";
|
import { logger } from "../lib/logger";
|
||||||
import { doubleRaf } from "../helpers/schedulers";
|
import { doubleRaf } from "../helpers/schedulers";
|
||||||
|
|
||||||
@ -50,18 +50,45 @@ export class AppNavigationController {
|
|||||||
}, {capture: true});
|
}, {capture: true});
|
||||||
|
|
||||||
if(isMobileSafari) {
|
if(isMobileSafari) {
|
||||||
/* window.addEventListener('touchstart', (e) => {
|
const options = {passive: true};
|
||||||
this.debug && this.log('touchstart');
|
window.addEventListener('touchstart', (e) => {
|
||||||
}, {passive: true}); */
|
|
||||||
|
|
||||||
window.addEventListener('touchend', (e) => {
|
|
||||||
this.debug && this.log('touchend');
|
|
||||||
if(e.touches.length > 1) return;
|
if(e.touches.length > 1) return;
|
||||||
isPossibleSwipe = true;
|
this.debug && this.log('touchstart');
|
||||||
doubleRaf().then(() => {
|
|
||||||
isPossibleSwipe = false;
|
const detach = () => {
|
||||||
});
|
window.removeEventListener('touchend', onTouchEnd);
|
||||||
}, {passive: true});
|
window.removeEventListener('touchmove', onTouchMove);
|
||||||
|
};
|
||||||
|
|
||||||
|
let moved = false;
|
||||||
|
const onTouchMove = (e: TouchEvent) => {
|
||||||
|
this.debug && this.log('touchmove');
|
||||||
|
if(e.touches.length > 1) {
|
||||||
|
detach();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
moved = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onTouchEnd = (e: TouchEvent) => {
|
||||||
|
this.debug && this.log('touchend');
|
||||||
|
if(e.touches.length > 1 || !moved) {
|
||||||
|
detach();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isPossibleSwipe = true;
|
||||||
|
doubleRaf().then(() => {
|
||||||
|
isPossibleSwipe = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
detach();
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('touchend', onTouchEnd, options);
|
||||||
|
window.addEventListener('touchmove', onTouchMove, options);
|
||||||
|
}, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pushState(); // * push init state
|
this.pushState(); // * push init state
|
||||||
@ -72,6 +99,8 @@ export class AppNavigationController {
|
|||||||
this.debug && this.log('popstate, navigation:', item, this.navigations);
|
this.debug && this.log('popstate, navigation:', item, this.navigations);
|
||||||
if(good === false) {
|
if(good === false) {
|
||||||
this.pushItem(item);
|
this.pushItem(item);
|
||||||
|
} else {
|
||||||
|
blurActiveElement(); // no better place for it
|
||||||
}
|
}
|
||||||
|
|
||||||
this.manual = false;
|
this.manual = false;
|
||||||
|
@ -4582,11 +4582,8 @@ export class AppMessagesManager {
|
|||||||
let offset = 0;
|
let offset = 0;
|
||||||
let offsetNotFound = false;
|
let offsetNotFound = false;
|
||||||
|
|
||||||
let isMigrated = false;
|
const isMigrated = !!this.migratedToFrom[peerId];
|
||||||
let reqPeerId = peerId;
|
const reqPeerId = peerId;
|
||||||
if(this.migratedToFrom[peerId]) {
|
|
||||||
isMigrated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(maxId) {
|
if(maxId) {
|
||||||
offsetNotFound = true;
|
offsetNotFound = true;
|
||||||
@ -4726,8 +4723,6 @@ export class AppMessagesManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public requestHistory(peerId: number, maxId: number, limit = 0, offset = 0, offsetDate = 0, threadId = 0): Promise<Exclude<MessagesMessages, MessagesMessages.messagesMessagesNotModified>> {
|
public requestHistory(peerId: number, maxId: number, limit = 0, offset = 0, offsetDate = 0, threadId = 0): Promise<Exclude<MessagesMessages, MessagesMessages.messagesMessagesNotModified>> {
|
||||||
const isChannel = appPeersManager.isChannel(peerId);
|
|
||||||
|
|
||||||
//console.trace('requestHistory', peerId, maxId, limit, offset);
|
//console.trace('requestHistory', peerId, maxId, limit, offset);
|
||||||
|
|
||||||
//rootScope.broadcast('history_request');
|
//rootScope.broadcast('history_request');
|
||||||
@ -4758,7 +4753,7 @@ export class AppMessagesManager {
|
|||||||
appChatsManager.saveApiChats(historyResult.chats);
|
appChatsManager.saveApiChats(historyResult.chats);
|
||||||
this.saveMessages(historyResult.messages);
|
this.saveMessages(historyResult.messages);
|
||||||
|
|
||||||
if(isChannel) {
|
if(appPeersManager.isChannel(peerId)) {
|
||||||
apiUpdatesManager.addChannelState(-peerId, (historyResult as MessagesMessages.messagesChannelMessages).pts);
|
apiUpdatesManager.addChannelState(-peerId, (historyResult as MessagesMessages.messagesChannelMessages).pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user