diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 69f923cc58..ff85001b35 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -832,7 +832,8 @@ export const ComposePost = ({ onSelectDraft={handleSelectDraft} onSaveDraft={saveCurrentDraft} onDiscard={handleClearComposer} - isEmpty={isComposerEmpty}> + isEmpty={isComposerEmpty} + isDirty={composerState.isDirty}> {missingAltError && } Promise onDiscard: () => void isEmpty: boolean + isDirty: boolean topBarAnimatedStyle: StyleProp children?: React.ReactNode }) { @@ -1170,6 +1173,7 @@ function ComposerTopBar({ onSaveDraft={onSaveDraft} onDiscard={onDiscard} isEmpty={isEmpty} + isDirty={isDirty} /> {isPublishing ? ( <> diff --git a/src/view/com/composer/drafts/DraftsButton.tsx b/src/view/com/composer/drafts/DraftsButton.tsx index 863e70f975..d36099b3ee 100644 --- a/src/view/com/composer/drafts/DraftsButton.tsx +++ b/src/view/com/composer/drafts/DraftsButton.tsx @@ -13,11 +13,13 @@ export function DraftsButton({ onSaveDraft, onDiscard, isEmpty, + isDirty, }: { onSelectDraft: (draft: StoredDraft) => void onSaveDraft: () => Promise onDiscard: () => void isEmpty: boolean + isDirty: boolean }) { const {_} = useLingui() const draftsDialogControl = Dialog.useDialogControl() @@ -25,11 +27,11 @@ export function DraftsButton({ const {isPending: isSaving} = useSaveDraft() const handlePress = () => { - if (isEmpty) { - // Composer is empty, go directly to drafts list + if (isEmpty || !isDirty) { + // Composer is empty or has no unsaved changes, go directly to drafts list draftsDialogControl.open() } else { - // Composer has content, ask what to do + // Composer has unsaved changes, ask what to do savePromptControl.open() } }