|
|
@ -43,7 +43,7 @@ import SendMenu from './sendContextMenu'; |
|
|
|
import rootScope from '../../lib/rootScope'; |
|
|
|
import rootScope from '../../lib/rootScope'; |
|
|
|
import PopupPinMessage from '../popups/unpinMessage'; |
|
|
|
import PopupPinMessage from '../popups/unpinMessage'; |
|
|
|
import { tsNow } from '../../helpers/date'; |
|
|
|
import { tsNow } from '../../helpers/date'; |
|
|
|
import appNavigationController from '../appNavigationController'; |
|
|
|
import appNavigationController, { NavigationItem } from '../appNavigationController'; |
|
|
|
import { isMobile, isMobileSafari } from '../../helpers/userAgent'; |
|
|
|
import { isMobile, isMobileSafari } from '../../helpers/userAgent'; |
|
|
|
import I18n, { i18n, join, LangPackKey } from '../../lib/langPack'; |
|
|
|
import I18n, { i18n, join, LangPackKey } from '../../lib/langPack'; |
|
|
|
import { generateTail } from './bubbles'; |
|
|
|
import { generateTail } from './bubbles'; |
|
|
@ -132,6 +132,8 @@ export default class ChatInput { |
|
|
|
private recordTimeEl: HTMLElement; |
|
|
|
private recordTimeEl: HTMLElement; |
|
|
|
private recordRippleEl: HTMLElement; |
|
|
|
private recordRippleEl: HTMLElement; |
|
|
|
private recordStartTime = 0; |
|
|
|
private recordStartTime = 0; |
|
|
|
|
|
|
|
private recordingOverlayListener: Listener; |
|
|
|
|
|
|
|
private recordingNavigationItem: NavigationItem; |
|
|
|
|
|
|
|
|
|
|
|
// private scrollTop = 0;
|
|
|
|
// private scrollTop = 0;
|
|
|
|
// private scrollOffsetTop = 0;
|
|
|
|
// private scrollOffsetTop = 0;
|
|
|
@ -174,8 +176,6 @@ export default class ChatInput { |
|
|
|
|
|
|
|
|
|
|
|
private previousQuery: string; |
|
|
|
private previousQuery: string; |
|
|
|
|
|
|
|
|
|
|
|
private recordingOverlayListener: Listener; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private chat: Chat, |
|
|
|
constructor(private chat: Chat, |
|
|
|
private appMessagesManager: AppMessagesManager, |
|
|
|
private appMessagesManager: AppMessagesManager, |
|
|
|
private appMessagesIdsManager: AppMessagesIdsManager, |
|
|
|
private appMessagesIdsManager: AppMessagesIdsManager, |
|
|
@ -583,6 +583,11 @@ export default class ChatInput { |
|
|
|
this.recordingOverlayListener = undefined; |
|
|
|
this.recordingOverlayListener = undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.recordingNavigationItem) { |
|
|
|
|
|
|
|
appNavigationController.removeItem(this.recordingNavigationItem); |
|
|
|
|
|
|
|
this.recordingNavigationItem = undefined; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.recordCanceled) { |
|
|
|
if(this.recordCanceled) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -1461,9 +1466,7 @@ export default class ChatInput { |
|
|
|
this.updateSendBtn(); |
|
|
|
this.updateSendBtn(); |
|
|
|
opusDecodeController.setKeepAlive(true); |
|
|
|
opusDecodeController.setKeepAlive(true); |
|
|
|
|
|
|
|
|
|
|
|
this.recordingOverlayListener = this.listenerSetter.add(document.body)('mousedown', (e) => { |
|
|
|
const showDiscardPopup = () => { |
|
|
|
if(!findUpClassName(e.target, 'chat-input') && !findUpClassName(e.target, 'popup-cancel-record')) { |
|
|
|
|
|
|
|
cancelEvent(e); |
|
|
|
|
|
|
|
new PopupPeer('popup-cancel-record', { |
|
|
|
new PopupPeer('popup-cancel-record', { |
|
|
|
titleLangKey: 'DiscardVoiceMessageTitle', |
|
|
|
titleLangKey: 'DiscardVoiceMessageTitle', |
|
|
|
descriptionLangKey: 'DiscardVoiceMessageDescription', |
|
|
|
descriptionLangKey: 'DiscardVoiceMessageDescription', |
|
|
@ -1477,9 +1480,26 @@ export default class ChatInput { |
|
|
|
isCancel: true |
|
|
|
isCancel: true |
|
|
|
}] |
|
|
|
}] |
|
|
|
}).show(); |
|
|
|
}).show(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.recordingOverlayListener = this.listenerSetter.add(document.body)('mousedown', (e) => { |
|
|
|
|
|
|
|
if(!findUpClassName(e.target, 'chat-input') && !findUpClassName(e.target, 'popup-cancel-record')) { |
|
|
|
|
|
|
|
cancelEvent(e); |
|
|
|
|
|
|
|
showDiscardPopup(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, {capture: true, passive: false}) as any; |
|
|
|
}, {capture: true, passive: false}) as any; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appNavigationController.pushItem(this.recordingNavigationItem = { |
|
|
|
|
|
|
|
type: 'voice', |
|
|
|
|
|
|
|
onPop: () => { |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
showDiscardPopup(); |
|
|
|
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.recordStartTime = Date.now(); |
|
|
|
this.recordStartTime = Date.now(); |
|
|
|
|
|
|
|
|
|
|
|
const sourceNode: MediaStreamAudioSourceNode = this.recorder.sourceNode; |
|
|
|
const sourceNode: MediaStreamAudioSourceNode = this.recorder.sourceNode; |
|
|
|