2024-08-13 10:26:23 +03:00
|
|
|
import { t, Trans } from '@lingui/macro';
|
|
|
|
|
2024-05-24 07:30:20 +03:00
|
|
|
import openOSK from './open-osk';
|
|
|
|
import showToast from './show-toast';
|
|
|
|
import states from './states';
|
|
|
|
|
|
|
|
const TOAST_DURATION = 5_000; // 5 seconds
|
|
|
|
|
|
|
|
export default function showCompose(opts) {
|
|
|
|
if (!opts) opts = true;
|
|
|
|
|
|
|
|
if (states.showCompose) {
|
|
|
|
if (states.composerState.minimized) {
|
|
|
|
showToast({
|
|
|
|
duration: TOAST_DURATION,
|
2024-08-13 10:26:23 +03:00
|
|
|
text: t`A draft post is currently minimized. Post or discard it before creating a new one.`,
|
2024-05-24 07:30:20 +03:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
showToast({
|
|
|
|
duration: TOAST_DURATION,
|
2024-08-13 10:26:23 +03:00
|
|
|
text: t`A post is currently open. Post or discard it before creating a new one.`,
|
2024-05-24 07:30:20 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
openOSK();
|
|
|
|
states.showCompose = opts;
|
|
|
|
}
|