Commit 1ababc8c authored by topjohnwu's avatar topjohnwu

RepoDB does not need to run on main thread

parent 1f75e63c
......@@ -20,5 +20,4 @@ val databaseModule = module {
fun createRepoDatabase(context: Context) =
Room.databaseBuilder(context, RepoDatabase::class.java, "repo.db")
.fallbackToDestructiveMigration()
.allowMainThreadQueries()
.build()
......@@ -33,6 +33,7 @@ import com.topjohnwu.magisk.utils.Utils
import com.topjohnwu.magisk.view.dialogs.FingerprintAuthDialog
import com.topjohnwu.net.Networking
import com.topjohnwu.superuser.Shell
import io.reactivex.Completable
import org.koin.android.ext.android.inject
import java.io.File
......@@ -83,13 +84,15 @@ class SettingsFragment : BasePreferenceFragment() {
true
}
findPreference("clear").setOnPreferenceClickListener {
repoDB.clear()
Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT)
Completable.fromAction { repoDB.clear() }.subscribeK {
Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT)
}
true
}
findPreference("hosts").setOnPreferenceClickListener {
Shell.su("add_hosts_module").exec()
Utils.toast(R.string.settings_hosts_toast, Toast.LENGTH_SHORT)
Shell.su("add_hosts_module").submit {
Utils.toast(R.string.settings_hosts_toast, Toast.LENGTH_SHORT)
}
true
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment