mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-24 03:42:15 +00:00
Fix: Database access on Main crashes
This commit is contained in:
parent
27a54c1b08
commit
e559f19529
@ -22,6 +22,7 @@ import com.looker.droidify.utility.Utils.toInstalledItem
|
||||
import com.looker.droidify.utility.extension.android.Android
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.net.InetSocketAddress
|
||||
import java.net.Proxy
|
||||
@ -69,10 +70,9 @@ class MainApplication : Application(), ImageLoaderFactory {
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
if (packageInfo != null) {
|
||||
db.installedDao.put(packageInfo.toInstalledItem())
|
||||
} else {
|
||||
db.installedDao.delete(packageName)
|
||||
GlobalScope.launch {
|
||||
if (packageInfo != null) db.installedDao.put(packageInfo.toInstalledItem())
|
||||
else db.installedDao.delete(packageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
|
||||
* @see SyncService.displayUpdatesNotification
|
||||
*/
|
||||
private fun runAutoUpdate(productItems: List<ProductItem>) {
|
||||
if (Preferences[Preferences.Key.InstallAfterSync]) {
|
||||
if (Preferences[Preferences.Key.InstallAfterSync]) GlobalScope.launch {
|
||||
// run startUpdate on every item
|
||||
productItems.map { productItem ->
|
||||
Pair(
|
||||
|
Loading…
x
Reference in New Issue
Block a user