Fixed a bug that would clear the database upon background refresh

This commit is contained in:
Deniz Düzgören
2019-08-07 07:25:06 +02:00
parent 52db4b20bb
commit 78e836b737
5 changed files with 27 additions and 31 deletions
@@ -30,18 +30,15 @@ class NotificationService : JobService() {
val networkStatus = connectivityManager.activeNetworkInfo
Thread(Runnable {
if (!prefs.getBoolean("notif", false)) {
if (!prefs.getBoolean("notif", false) || jobCancelled || networkStatus == null) {
jobFinished(params, false)
return@Runnable
} else {
if (jobCancelled || networkStatus == null) {
return@Runnable
}
if (prefs.getBoolean("notif", false)) {
edit.putInt("notificationTestNumberDev", prefs.getInt("notificationTestNumberDev", 0) + 1).apply()
try {
DataFetcher(true, true, true, context, application, null).execute()
} catch (ignored: Exception) {}
}
edit.putInt("notificationTestNumberDev", prefs.getInt("notificationTestNumberDev", 0) + 1).apply()
try {
DataFetcher(true, true, true, context, application, null).execute()
} catch (ignored: Exception) {}
jobFinished(params, false)
}
}).start()