|
|
@ -23,7 +23,7 @@ interface State {
|
|
|
|
doneInitialScroll: boolean;
|
|
|
|
doneInitialScroll: boolean;
|
|
|
|
displayScrollToBottomButton: boolean;
|
|
|
|
displayScrollToBottomButton: boolean;
|
|
|
|
messageFetchTimestamp: number;
|
|
|
|
messageFetchTimestamp: number;
|
|
|
|
isRecording: boolean;
|
|
|
|
isRecordingView: boolean;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export class SessionConversation extends React.Component<any, State> {
|
|
|
|
export class SessionConversation extends React.Component<any, State> {
|
|
|
@ -47,7 +47,7 @@ export class SessionConversation extends React.Component<any, State> {
|
|
|
|
doneInitialScroll: false,
|
|
|
|
doneInitialScroll: false,
|
|
|
|
displayScrollToBottomButton: false,
|
|
|
|
displayScrollToBottomButton: false,
|
|
|
|
messageFetchTimestamp: 0,
|
|
|
|
messageFetchTimestamp: 0,
|
|
|
|
isRecording: false,
|
|
|
|
isRecordingView: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.handleScroll = this.handleScroll.bind(this);
|
|
|
|
this.handleScroll = this.handleScroll.bind(this);
|
|
|
@ -58,9 +58,11 @@ export class SessionConversation extends React.Component<any, State> {
|
|
|
|
this.renderTimerNotification = this.renderTimerNotification.bind(this);
|
|
|
|
this.renderTimerNotification = this.renderTimerNotification.bind(this);
|
|
|
|
this.renderFriendRequest = this.renderFriendRequest.bind(this);
|
|
|
|
this.renderFriendRequest = this.renderFriendRequest.bind(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Recording View render and unrender
|
|
|
|
|
|
|
|
this.onLoadVoiceNoteView = this.onLoadVoiceNoteView.bind(this);
|
|
|
|
|
|
|
|
this.onExitVoiceNoteView = this.onExitVoiceNoteView.bind(this);
|
|
|
|
|
|
|
|
|
|
|
|
this.onKeyDown = this.onKeyDown.bind(this);
|
|
|
|
this.onKeyDown = this.onKeyDown.bind(this);
|
|
|
|
this.onStartedRecording = this.onStartedRecording.bind(this);
|
|
|
|
|
|
|
|
this.onStoppedRecording = this.onStoppedRecording.bind(this);
|
|
|
|
|
|
|
|
this.selectMessage = this.selectMessage.bind(this);
|
|
|
|
this.selectMessage = this.selectMessage.bind(this);
|
|
|
|
this.resetSelection = this.resetSelection.bind(this);
|
|
|
|
this.resetSelection = this.resetSelection.bind(this);
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +72,7 @@ export class SessionConversation extends React.Component<any, State> {
|
|
|
|
public async componentWillMount() {
|
|
|
|
public async componentWillMount() {
|
|
|
|
await this.getMessages();
|
|
|
|
await this.getMessages();
|
|
|
|
|
|
|
|
|
|
|
|
// Inside a setTimeout to simultate onready()
|
|
|
|
// Pause thread to wait for rendering to complete
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.scrollToUnread();
|
|
|
|
this.scrollToUnread();
|
|
|
|
}, 0);
|
|
|
|
}, 0);
|
|
|
@ -101,7 +103,7 @@ export class SessionConversation extends React.Component<any, State> {
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
console.log(`[vince][info] Props`, this.props);
|
|
|
|
console.log(`[vince][info] Props`, this.props);
|
|
|
|
|
|
|
|
|
|
|
|
const { messages, conversationKey, doneInitialScroll, isRecording } = this.state;
|
|
|
|
const { messages, conversationKey, doneInitialScroll, isRecordingView } = this.state;
|
|
|
|
const loading = !doneInitialScroll || messages.length === 0;
|
|
|
|
const loading = !doneInitialScroll || messages.length === 0;
|
|
|
|
const selectionMode = !!this.state.selectedMessages.length;
|
|
|
|
const selectionMode = !!this.state.selectedMessages.length;
|
|
|
|
|
|
|
|
|
|
|
@ -136,7 +138,7 @@ export class SessionConversation extends React.Component<any, State> {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<SessionScrollButton display={true} onClick={this.scrollToBottom}/>
|
|
|
|
<SessionScrollButton display={true} onClick={this.scrollToBottom}/>
|
|
|
|
{ isRecording && (
|
|
|
|
{ isRecordingView && (
|
|
|
|
<div className="messages-wrapper--blocking-overlay"></div>
|
|
|
|
<div className="messages-wrapper--blocking-overlay"></div>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -144,8 +146,8 @@ export class SessionConversation extends React.Component<any, State> {
|
|
|
|
{ !isRss && (
|
|
|
|
{ !isRss && (
|
|
|
|
<SessionCompositionBox
|
|
|
|
<SessionCompositionBox
|
|
|
|
sendMessage={conversationModel.sendMessage}
|
|
|
|
sendMessage={conversationModel.sendMessage}
|
|
|
|
onStartedRecording={this.onStartedRecording}
|
|
|
|
onLoadVoiceNoteView={this.onLoadVoiceNoteView}
|
|
|
|
onStoppedRecording={this.onStoppedRecording}
|
|
|
|
onExitVoiceNoteView={this.onExitVoiceNoteView}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
@ -613,16 +615,16 @@ export class SessionConversation extends React.Component<any, State> {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private onStartedRecording() {
|
|
|
|
private onLoadVoiceNoteView() {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
isRecording: true,
|
|
|
|
isRecordingView: true,
|
|
|
|
selectedMessages: [],
|
|
|
|
selectedMessages: [],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private onStoppedRecording() {
|
|
|
|
private onExitVoiceNoteView() {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
isRecording: false,
|
|
|
|
isRecordingView: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
console.log(`[vince] Stopped recording entirely`);
|
|
|
|
console.log(`[vince] Stopped recording entirely`);
|
|
|
|