Skip to content

Commit a09b5dd

Browse files
committed
bugfix: user lists management
1 parent 7fc6c0a commit a09b5dd

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

app/src/main/kotlin/com/androidvip/sysctlgui/ui/export/ExportOptionsViewModel.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,9 @@ class ExportOptionsViewModel(
138138
context: Context
139139
): Result<Unit> = withContext(ioDispatcher) {
140140
return@withContext runCatching {
141-
val descriptor = context.contentResolver.openFileDescriptor(target, "w")
142-
?: throw IOException()
143-
144-
exportParamsUseCase(descriptor.fileDescriptor)
141+
context.contentResolver.openFileDescriptor(target, "w").use {
142+
exportParamsUseCase(it!!.fileDescriptor)
143+
}
145144
}
146145
}
147146

@@ -150,10 +149,9 @@ class ExportOptionsViewModel(
150149
context: Context
151150
): Result<Unit> = withContext(ioDispatcher) {
152151
return@withContext runCatching {
153-
val descriptor = context.contentResolver.openFileDescriptor(target, "w")
154-
?: throw IOException()
155-
156-
backupParamsUseCase(descriptor.fileDescriptor)
152+
context.contentResolver.openFileDescriptor(target, "w").use {
153+
backupParamsUseCase(it!!.fileDescriptor)
154+
}
157155
}
158156
}
159157

app/src/main/kotlin/com/androidvip/sysctlgui/ui/params/user/UserParamsViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class UserParamsViewModel(
6161

6262
fun setBaseFilterPredicate(predicate: ParamFilterPredicate) {
6363
baseFilterPredicate = predicate
64+
currentFilterPredicate = baseFilterPredicate
6465
}
6566

6667
private fun delete(kernelParam: KernelParam) {

0 commit comments

Comments
 (0)