diff --git a/app/build.gradle b/app/build.gradle index 35bdd998e..07c34281d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,12 @@ plugins { - id "org.sonarqube" version "3.1.1" + id "com.android.application" + id "kotlin-android" + id "kotlin-kapt" + id "kotlin-parcelize" + id "checkstyle" + id "org.sonarqube" version "3.3" } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-parcelize' -apply plugin: 'kotlin-kapt' -apply plugin: 'checkstyle' - android { compileSdkVersion 30 buildToolsVersion '30.0.3' @@ -80,13 +79,13 @@ android { // Flag to enable support for the new language APIs coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 encoding 'utf-8' } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = JavaVersion.VERSION_11 } sourceSets { @@ -99,7 +98,7 @@ android { } ext { - checkstyleVersion = '8.38' + checkstyleVersion = '9.2' androidxLifecycleVersion = '2.3.1' androidxRoomVersion = '2.3.0' @@ -193,7 +192,7 @@ dependencies { /** Checkstyle **/ checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" - ktlint 'com.pinterest:ktlint:0.40.0' + ktlint 'com.pinterest:ktlint:0.43.2' /** Kotlin **/ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}" diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt b/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt index 98ff5914d..5bc097fe5 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt @@ -183,28 +183,23 @@ class FeedLoadService : Service() { subscriptions .take(1) - .doOnNext { currentProgress.set(0) maxProgress.set(it.size) } .filter { it.isNotEmpty() } - .observeOn(AndroidSchedulers.mainThread()) .doOnNext { startForeground(NOTIFICATION_ID, notificationBuilder.build()) updateNotificationProgress(null) broadcastProgress() } - .observeOn(Schedulers.io()) .flatMap { Flowable.fromIterable(it) } .takeWhile { !cancelSignal.get() } - .parallel(PARALLEL_EXTRACTIONS, PARALLEL_EXTRACTIONS * 2) .runOn(Schedulers.io(), PARALLEL_EXTRACTIONS * 2) .filter { !cancelSignal.get() } - .map { subscriptionEntity -> var error: Throwable? = null try { @@ -239,14 +234,11 @@ class FeedLoadService : Service() { } } .sequential() - .observeOn(AndroidSchedulers.mainThread()) .doOnNext(notificationsConsumer) - .observeOn(Schedulers.io()) .buffer(BUFFER_COUNT_BEFORE_INSERT) .doOnNext(databaseConsumer) - .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(resultSubscriber) diff --git a/app/src/test/java/org/schabi/newpipe/settings/ContentSettingsManagerTest.kt b/app/src/test/java/org/schabi/newpipe/settings/ContentSettingsManagerTest.kt index 2311b41ce..ec41a77f8 100644 --- a/app/src/test/java/org/schabi/newpipe/settings/ContentSettingsManagerTest.kt +++ b/app/src/test/java/org/schabi/newpipe/settings/ContentSettingsManagerTest.kt @@ -9,12 +9,12 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito -import org.mockito.Mockito.`when` import org.mockito.Mockito.anyBoolean import org.mockito.Mockito.anyInt import org.mockito.Mockito.anyString import org.mockito.Mockito.atLeastOnce import org.mockito.Mockito.verify +import org.mockito.Mockito.`when` import org.mockito.Mockito.withSettings import org.mockito.junit.MockitoJUnitRunner import org.schabi.newpipe.streams.io.StoredFileHelper