1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 04:22:30 +01:00

Merge pull request #7500 from TacoTheDank/bumpKtlint

Bump ktlint, Checkstyle, Java version
This commit is contained in:
litetex 2021-12-12 15:07:24 +01:00 committed by GitHub
commit b056faa97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 21 deletions

View File

@ -1,13 +1,12 @@
plugins { 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 { android {
compileSdkVersion 30 compileSdkVersion 30
buildToolsVersion '30.0.3' buildToolsVersion '30.0.3'
@ -80,13 +79,13 @@ android {
// Flag to enable support for the new language APIs // Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_11
encoding 'utf-8' encoding 'utf-8'
} }
kotlinOptions { kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8 jvmTarget = JavaVersion.VERSION_11
} }
sourceSets { sourceSets {
@ -99,7 +98,7 @@ android {
} }
ext { ext {
checkstyleVersion = '8.38' checkstyleVersion = '9.2'
androidxLifecycleVersion = '2.3.1' androidxLifecycleVersion = '2.3.1'
androidxRoomVersion = '2.3.0' androidxRoomVersion = '2.3.0'
@ -193,7 +192,7 @@ dependencies {
/** Checkstyle **/ /** Checkstyle **/
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
ktlint 'com.pinterest:ktlint:0.40.0' ktlint 'com.pinterest:ktlint:0.43.2'
/** Kotlin **/ /** Kotlin **/
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"

View File

@ -183,28 +183,23 @@ class FeedLoadService : Service() {
subscriptions subscriptions
.take(1) .take(1)
.doOnNext { .doOnNext {
currentProgress.set(0) currentProgress.set(0)
maxProgress.set(it.size) maxProgress.set(it.size)
} }
.filter { it.isNotEmpty() } .filter { it.isNotEmpty() }
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnNext { .doOnNext {
startForeground(NOTIFICATION_ID, notificationBuilder.build()) startForeground(NOTIFICATION_ID, notificationBuilder.build())
updateNotificationProgress(null) updateNotificationProgress(null)
broadcastProgress() broadcastProgress()
} }
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.flatMap { Flowable.fromIterable(it) } .flatMap { Flowable.fromIterable(it) }
.takeWhile { !cancelSignal.get() } .takeWhile { !cancelSignal.get() }
.parallel(PARALLEL_EXTRACTIONS, PARALLEL_EXTRACTIONS * 2) .parallel(PARALLEL_EXTRACTIONS, PARALLEL_EXTRACTIONS * 2)
.runOn(Schedulers.io(), PARALLEL_EXTRACTIONS * 2) .runOn(Schedulers.io(), PARALLEL_EXTRACTIONS * 2)
.filter { !cancelSignal.get() } .filter { !cancelSignal.get() }
.map { subscriptionEntity -> .map { subscriptionEntity ->
var error: Throwable? = null var error: Throwable? = null
try { try {
@ -239,14 +234,11 @@ class FeedLoadService : Service() {
} }
} }
.sequential() .sequential()
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnNext(notificationsConsumer) .doOnNext(notificationsConsumer)
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.buffer(BUFFER_COUNT_BEFORE_INSERT) .buffer(BUFFER_COUNT_BEFORE_INSERT)
.doOnNext(databaseConsumer) .doOnNext(databaseConsumer)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(resultSubscriber) .subscribe(resultSubscriber)

View File

@ -9,12 +9,12 @@ import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when`
import org.mockito.Mockito.anyBoolean import org.mockito.Mockito.anyBoolean
import org.mockito.Mockito.anyInt import org.mockito.Mockito.anyInt
import org.mockito.Mockito.anyString import org.mockito.Mockito.anyString
import org.mockito.Mockito.atLeastOnce import org.mockito.Mockito.atLeastOnce
import org.mockito.Mockito.verify import org.mockito.Mockito.verify
import org.mockito.Mockito.`when`
import org.mockito.Mockito.withSettings import org.mockito.Mockito.withSettings
import org.mockito.junit.MockitoJUnitRunner import org.mockito.junit.MockitoJUnitRunner
import org.schabi.newpipe.streams.io.StoredFileHelper import org.schabi.newpipe.streams.io.StoredFileHelper