|
|
@ -11,14 +11,11 @@ import io.legado.app.utils.fromJsonArray |
|
|
|
|
|
|
|
|
|
|
|
class TocRegexViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
class TocRegexViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
|
|
|
|
|
|
|
fun saveRule(rule: TxtTocRule, oldRule: TxtTocRule? = null) { |
|
|
|
fun saveRule(rule: TxtTocRule) { |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
if (rule.serialNumber < 0) { |
|
|
|
if (rule.serialNumber < 0) { |
|
|
|
rule.serialNumber = App.db.txtTocRule().lastOrderNum + 1 |
|
|
|
rule.serialNumber = App.db.txtTocRule().lastOrderNum + 1 |
|
|
|
} |
|
|
|
} |
|
|
|
oldRule?.let { |
|
|
|
|
|
|
|
App.db.txtTocRule().delete(oldRule) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
App.db.txtTocRule().insert(rule) |
|
|
|
App.db.txtTocRule().insert(rule) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|