Skip to main content

Drafts guide

Configuration

Drafts are enabled by default, asks the user to save a draft before leave any VideoEditor screen. If you need to change drafts configuration you should add the code below in the VideoEditorModule:

    override val draftConfig: BeanDefinition<DraftConfig> = factory(override = true) {
DraftConfig.ENABLED_ASK_TO_SAVE
}

You can choose one of these options:

  1. ENABLED_ASK_TO_SAVE - drafts enabled, asks the user to save a draft
  2. ENABLED_ASK_IF_SAVE_NOT_EXPORT - drafts enabled, asks the user to save a draft without export
  3. ENABLED_SAVE_BY_DEFAULT - drafts enabled, saved by default without asking the user
  4. DISABLED - disabled drafts

Draft Helper

DraftsHelper interface is used for managing drafts.

interface DraftsHelper {

val allDrafts: StateFlow<List<Draft>>

fun delete(draft: Draft)

fun deleteAll()

fun openDraft(draft: Draft): Intent

fun openLastDraft(): Intent
}

To get the instance of DraftsHelper use the following in your Fragment or Activity.

val draftsHelper: DraftsHelper by inject()

Used string resources

ResourceIdValue
drafts_titleDrafts
drafts_empty_descriptionNo Drafts
drafts_options_editEdit
drafts_options_deleteDelete
editor_trim_videoAdjust Clips
editor_discard_changesDiscard changes
editor_update_draftUpdate draft