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 com.looker.droidify.utility.extension.android.Android
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.net.InetSocketAddress
|
import java.net.InetSocketAddress
|
||||||
import java.net.Proxy
|
import java.net.Proxy
|
||||||
@ -69,10 +70,9 @@ class MainApplication : Application(), ImageLoaderFactory {
|
|||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
if (packageInfo != null) {
|
GlobalScope.launch {
|
||||||
db.installedDao.put(packageInfo.toInstalledItem())
|
if (packageInfo != null) db.installedDao.put(packageInfo.toInstalledItem())
|
||||||
} else {
|
else db.installedDao.delete(packageName)
|
||||||
db.installedDao.delete(packageName)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
|
|||||||
* @see SyncService.displayUpdatesNotification
|
* @see SyncService.displayUpdatesNotification
|
||||||
*/
|
*/
|
||||||
private fun runAutoUpdate(productItems: List<ProductItem>) {
|
private fun runAutoUpdate(productItems: List<ProductItem>) {
|
||||||
if (Preferences[Preferences.Key.InstallAfterSync]) {
|
if (Preferences[Preferences.Key.InstallAfterSync]) GlobalScope.launch {
|
||||||
// run startUpdate on every item
|
// run startUpdate on every item
|
||||||
productItems.map { productItem ->
|
productItems.map { productItem ->
|
||||||
Pair(
|
Pair(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user