|
|
@ -18,7 +18,7 @@ import {
|
|
|
|
getSelectedConversationKey,
|
|
|
|
getSelectedConversationKey,
|
|
|
|
} from '../../../../state/selectors/conversations';
|
|
|
|
} from '../../../../state/selectors/conversations';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
DisappearingMessageConversationSetting,
|
|
|
|
DEFAULT_TIMER_OPTION,
|
|
|
|
DisappearingMessageConversationType,
|
|
|
|
DisappearingMessageConversationType,
|
|
|
|
} from '../../../../util/expiringMessages';
|
|
|
|
} from '../../../../util/expiringMessages';
|
|
|
|
import { TimerOptionsArray } from '../../../../state/ducks/timerOptions';
|
|
|
|
import { TimerOptionsArray } from '../../../../state/ducks/timerOptions';
|
|
|
@ -204,22 +204,22 @@ export const OverlayDisappearingMessages = (props: OverlayDisappearingMessagesPr
|
|
|
|
const { isGroup } = convoProps;
|
|
|
|
const { isGroup } = convoProps;
|
|
|
|
|
|
|
|
|
|
|
|
const [modeSelected, setModeSelected] = useState(convoProps.expirationType);
|
|
|
|
const [modeSelected, setModeSelected] = useState(convoProps.expirationType);
|
|
|
|
const [timeSelected, setTimeSelected] = useState(convoProps.expireTimer);
|
|
|
|
const [timeSelected, setTimeSelected] = useState(
|
|
|
|
// Legacy mode uses the default timer options depending on the conversation type
|
|
|
|
convoProps.expireTimer && convoProps.expireTimer > -1
|
|
|
|
// TODO verify that this if fine compared to updating in the useEffect
|
|
|
|
? convoProps.expireTimer
|
|
|
|
const timerOptions = useTimerOptionsByMode(
|
|
|
|
: isGroup
|
|
|
|
modeSelected === 'legacy'
|
|
|
|
? DEFAULT_TIMER_OPTION.GROUP
|
|
|
|
? isGroup
|
|
|
|
: DEFAULT_TIMER_OPTION.PRIVATE_CONVERSATION
|
|
|
|
? DisappearingMessageConversationSetting[2]
|
|
|
|
|
|
|
|
: DisappearingMessageConversationSetting[1]
|
|
|
|
|
|
|
|
: modeSelected
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO verify that this if fine compared to updating in the useEffect
|
|
|
|
|
|
|
|
const timerOptions = useTimerOptionsByMode(modeSelected);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if (modeSelected !== convoProps.expirationType) {
|
|
|
|
if (modeSelected !== convoProps.expirationType) {
|
|
|
|
setModeSelected(convoProps.expirationType);
|
|
|
|
setModeSelected(convoProps.expirationType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (timeSelected !== convoProps.expireTimer) {
|
|
|
|
if (convoProps.expireTimer && timeSelected !== convoProps.expireTimer) {
|
|
|
|
setTimeSelected(convoProps.expireTimer);
|
|
|
|
setTimeSelected(convoProps.expireTimer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [convoProps.expirationType, convoProps.expireTimer]);
|
|
|
|
}, [convoProps.expirationType, convoProps.expireTimer]);
|
|
|
|