Skip to content

Commit f0248b1

Browse files
committed
Auto-fetch initial filenames when editing rules
1 parent 5069f4c commit f0248b1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

app/src/main/java/co/adityarajput/fileflow/viewmodels/Provider.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ object Provider {
2929
fun createURVM(ruleString: String) = viewModelFactory {
3030
initializer {
3131
UpsertRuleViewModel(
32+
fileFlowApplication(),
3233
Json.decodeFromString<Rule?>(ruleString),
3334
fileFlowApplication().container.repository,
3435
)

app/src/main/java/co/adityarajput/fileflow/viewmodels/UpsertRuleViewModel.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java.time.ZonedDateTime
1616
import java.util.concurrent.TimeUnit
1717

1818
class UpsertRuleViewModel(
19+
context: Context,
1920
rule: Rule?,
2021
private val repository: Repository,
2122
) : ViewModel() {
@@ -112,6 +113,10 @@ class UpsertRuleViewModel(
112113

113114
var folderPickerState by mutableStateOf<FolderPickerState?>(null)
114115

116+
init {
117+
updateForm(context)
118+
}
119+
115120
fun updateForm(context: Context, values: Values = state.values, page: FormPage = state.page) {
116121
var currentSrcFiles: List<File>? = null
117122
try {

0 commit comments

Comments
 (0)