Remove work-rxjava2

pull/1032/head
Alex Baker 6 years ago
parent e27bdba048
commit 5cf0ed4942

@ -149,7 +149,7 @@ dependencies {
implementation("androidx.hilt:hilt-work:${Versions.hilt_androidx}") implementation("androidx.hilt:hilt-work:${Versions.hilt_androidx}")
implementation("androidx.hilt:hilt-lifecycle-viewmodel:${Versions.hilt_androidx}") implementation("androidx.hilt:hilt-lifecycle-viewmodel:${Versions.hilt_androidx}")
implementation("androidx.room:room-rxjava2:${Versions.room}") implementation("androidx.room:room-runtime:${Versions.room}")
kapt("androidx.room:room-compiler:${Versions.room}") kapt("androidx.room:room-compiler:${Versions.room}")
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation("io.reactivex.rxjava2:rxandroid:2.1.1") implementation("io.reactivex.rxjava2:rxandroid:2.1.1")

@ -425,12 +425,6 @@
copyrightHolder: Google Inc. copyrightHolder: Google Inc.
license: The Apache Software License, Version 2.0 license: The Apache Software License, Version 2.0
licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
- artifact: androidx.room:room-rxjava2:+
name: Android Room RXJava2
copyrightHolder: Android Open Source Project
license: The Apache Software License, Version 2.0
licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
url: https://developer.android.com/topic/libraries/architecture/index.html
- artifact: androidx.drawerlayout:drawerlayout:+ - artifact: androidx.drawerlayout:drawerlayout:+
name: Android Support Library Drawer Layout name: Android Support Library Drawer Layout
copyrightHolder: Android Open Source Project copyrightHolder: Android Open Source Project

@ -9,10 +9,8 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import io.reactivex.Single import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
import io.reactivex.functions.Function3
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import org.tasks.R import org.tasks.R
import org.tasks.data.GoogleTaskListDao
import org.tasks.data.LocationDao import org.tasks.data.LocationDao
import org.tasks.preferences.Preferences import org.tasks.preferences.Preferences
import timber.log.Timber import timber.log.Timber
@ -21,17 +19,12 @@ import javax.inject.Inject
class PlayServices @Inject constructor( class PlayServices @Inject constructor(
@param:ApplicationContext private val context: Context, @param:ApplicationContext private val context: Context,
private val preferences: Preferences, private val preferences: Preferences,
private val googleTaskListDao: GoogleTaskListDao,
private val locationDao: LocationDao) { private val locationDao: LocationDao) {
fun check(activity: Activity?): Disposable { fun check(activity: Activity?): Disposable {
return Single.zip( return Single.fromCallable(locationDao::geofenceCount)
googleTaskListDao.accountCount(), .map { it == 0 || refreshAndCheck() }
locationDao.geofenceCount(),
Single.fromCallable { preferences.getBoolean(R.string.p_google_drive_backup, false) },
Function3 { gtaskCount: Int, geofenceCount: Int, gdrive: Boolean -> gtaskCount > 0 || geofenceCount > 0 || gdrive })
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.map { !it || refreshAndCheck() }
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe { success: Boolean -> .subscribe { success: Boolean ->
if (!success && !preferences.getBoolean(R.string.warned_play_services, false)) { if (!success && !preferences.getBoolean(R.string.warned_play_services, false)) {

@ -986,20 +986,6 @@
"normalizedLicense": "apache2", "normalizedLicense": "apache2",
"libraryName": "Google OAuth Client Library for Java" "libraryName": "Google OAuth Client Library for Java"
}, },
{
"artifactId": {
"name": "room-rxjava2",
"group": "androidx.room",
"version": "+"
},
"copyrightHolder": "Android Open Source Project",
"copyrightStatement": "Copyright © Android Open Source Project. All rights reserved.",
"license": "The Apache Software License, Version 2.0",
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt",
"normalizedLicense": "apache2",
"url": "https://developer.android.com/topic/libraries/architecture/index.html",
"libraryName": "Android Room RXJava2"
},
{ {
"artifactId": { "artifactId": {
"name": "drawerlayout", "name": "drawerlayout",

@ -3,14 +3,13 @@ package org.tasks.data
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.room.* import androidx.room.*
import com.todoroo.astrid.api.FilterListItem.NO_ORDER import com.todoroo.astrid.api.FilterListItem.NO_ORDER
import io.reactivex.Single
import org.tasks.filters.GoogleTaskFilters import org.tasks.filters.GoogleTaskFilters
import org.tasks.time.DateTimeUtils.currentTimeMillis import org.tasks.time.DateTimeUtils.currentTimeMillis
@Dao @Dao
interface GoogleTaskListDao { interface GoogleTaskListDao {
@Query("SELECT COUNT(*) FROM google_task_accounts") @Query("SELECT COUNT(*) FROM google_task_accounts")
fun accountCount(): Single<Int> fun accountCount(): Int
@Query("SELECT * FROM google_task_accounts") @Query("SELECT * FROM google_task_accounts")
fun getAccounts(): List<GoogleTaskAccount> fun getAccounts(): List<GoogleTaskAccount>

@ -63,7 +63,7 @@ interface LocationDao {
fun getActiveGeofences(): List<Location> fun getActiveGeofences(): List<Location>
@Query("SELECT COUNT(*) FROM geofences") @Query("SELECT COUNT(*) FROM geofences")
fun geofenceCount(): Single<Int> fun geofenceCount(): Int
@Delete @Delete
fun delete(location: Geofence) fun delete(location: Geofence)

@ -108,7 +108,7 @@ class WorkManagerImpl constructor(
val onlyOnWifi = forceOnlyOnUnmetered val onlyOnWifi = forceOnlyOnUnmetered
?: preferences.getBoolean(R.string.p_background_sync_unmetered_only, false) ?: preferences.getBoolean(R.string.p_background_sync_unmetered_only, false)
(if (forceAccountPresent == null) Single.zip( (if (forceAccountPresent == null) Single.zip(
googleTaskListDao.accountCount(), Single.fromCallable { googleTaskListDao.accountCount() },
Single.fromCallable { caldavDao.accountCount() }, Single.fromCallable { caldavDao.accountCount() },
BiFunction { googleCount: Int, caldavCount: Int -> googleCount > 0 || caldavCount > 0 }) else Single.just(forceAccountPresent)) BiFunction { googleCount: Int, caldavCount: Int -> googleCount > 0 || caldavCount > 0 }) else Single.just(forceAccountPresent))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())

Loading…
Cancel
Save