|
|
|
@ -8,6 +8,7 @@ import io.legado.app.base.BaseViewModel |
|
|
|
|
import io.legado.app.data.entities.ReplaceRule |
|
|
|
|
import io.legado.app.help.FileHelp |
|
|
|
|
import io.legado.app.help.storage.Backup |
|
|
|
|
import io.legado.app.help.storage.Restore |
|
|
|
|
import io.legado.app.utils.GSON |
|
|
|
|
import io.legado.app.utils.splitNotBlank |
|
|
|
|
import org.jetbrains.anko.toast |
|
|
|
@ -17,7 +18,7 @@ class ReplaceRuleViewModel(application: Application) : BaseViewModel(application |
|
|
|
|
|
|
|
|
|
fun importSource(text: String, toast: (msg: String) -> Unit) { |
|
|
|
|
execute { |
|
|
|
|
|
|
|
|
|
Restore.importOldReplaceRule(text) |
|
|
|
|
}.onError { |
|
|
|
|
toast(it.localizedMessage ?: "ERROR") |
|
|
|
|
}.onSuccess { |
|
|
|
|