Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nain57 committed Jun 11, 2023
1 parent 849e3e4 commit 9a8f29f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract class ListEditor<Item>(
}

private val referenceEditedItem: MutableStateFlow<Item?> = MutableStateFlow(null)
protected val _editedItem: MutableStateFlow<Item?> = MutableStateFlow((null))
private val _editedItem: MutableStateFlow<Item?> = MutableStateFlow((null))
val editedItem: StateFlow<Item?> = _editedItem
val editedItemState: Flow<EditedElementState<Item>> = combine(referenceEditedItem, _editedItem) { ref, edit ->
val hasChanged =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.buzbuz.smartautoclicker.feature.scenario.config.domain

import android.content.Context
import android.util.Log

import com.buzbuz.smartautoclicker.core.domain.Repository
import com.buzbuz.smartautoclicker.core.domain.model.action.Action
Expand All @@ -35,6 +36,8 @@ class EditionRepository private constructor(context: Context) {

companion object {

/** Tag for logs */
private const val TAG = "EditionRepository"
/** Singleton preventing multiple instances of the EditionRepository at the same time. */
@Volatile
private var INSTANCE: EditionRepository? = null
Expand Down Expand Up @@ -68,12 +71,18 @@ class EditionRepository private constructor(context: Context) {
// --- SCENARIO - START ---

/** Set the scenario to be configured. */
suspend fun startEdition(scenarioId: Long) {
suspend fun startEdition(scenarioId: Long): Boolean {
val scenario = repository.getScenario(scenarioId) ?: run {
Log.e(TAG, "Can't start edition, scenario $scenarioId not found")
return false
}

scenarioEditor.startEdition(
scenario = repository.getScenario(scenarioId),
scenario = scenario,
events = repository.getEvents(scenarioId),
endConditions = repository.getEndConditions(scenarioId),
)
return true
}

/** Save editions changes in the database. */
Expand Down

0 comments on commit 9a8f29f

Please sign in to comment.