mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Doesn't autoplay new messages once if last message received was an autoplayed.
This commit is contained in:
parent
da00ac8d44
commit
5a62fabd1c
|
@ -1,5 +1,5 @@
|
|||
// Audio Player
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import H5AudioPlayer from 'react-h5-audio-player';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useTheme } from 'styled-components';
|
||||
|
@ -39,7 +39,7 @@ export const AudioPlayerWithEncryptedFile = (props: {
|
|||
if (
|
||||
window.inboxStore?.getState().userConfig.audioAutoplay === true &&
|
||||
props.playNextMessage &&
|
||||
props.playableMessageIndex
|
||||
props.playableMessageIndex !== undefined
|
||||
) {
|
||||
props.playNextMessage(props.playableMessageIndex);
|
||||
}
|
||||
|
|
|
@ -277,12 +277,15 @@ export class SessionMessagesList extends React.Component<Props, State> {
|
|||
* @param index index of message that just completed
|
||||
*/
|
||||
const playNextMessage = (index: any) => {
|
||||
const nextIndex = index - 1;
|
||||
if (messages[nextIndex]) {
|
||||
this.setState({
|
||||
nextMessageToPlay: nextIndex,
|
||||
});
|
||||
let nextIndex: number | null = index - 1;
|
||||
|
||||
if (index <= 0 || messages.length < index - 1) {
|
||||
nextIndex = null;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
nextMessageToPlay: nextIndex,
|
||||
});
|
||||
};
|
||||
|
||||
if (messageProps) {
|
||||
|
|
Loading…
Reference in a new issue