From cf2beb8aac404c3422a13cd1b7f62181755fcbea Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 8 Mar 2020 06:52:10 +0800 Subject: [PATCH] Update dependencies --- build.gradle | 8 +-- detekt.yml | 66 ++++++++++--------- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew.bat | 3 + mobile/build.gradle | 18 ++--- .../be/mygod/vpnhotspot/RepeaterService.kt | 2 +- .../vpnhotspot/manage/BluetoothTethering.kt | 3 +- .../mygod/vpnhotspot/net/TetheringManager.kt | 3 +- 8 files changed, 56 insertions(+), 49 deletions(-) diff --git a/build.gradle b/build.gradle index 5fe694e2..446ae84a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,16 +3,16 @@ apply plugin: 'com.github.ben-manes.versions' buildscript { - ext.kotlinVersion = '1.3.61' + ext.kotlinVersion = '1.3.72' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0-beta01' + classpath 'com.android.tools.build:gradle:4.0.0-beta04' classpath 'com.github.ben-manes:gradle-versions-plugin:0.28.0' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta02' - classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta04' + classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2' classpath 'com.google.gms:google-services:4.3.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } diff --git a/detekt.yml b/detekt.yml index 235590d0..4874946f 100644 --- a/detekt.yml +++ b/detekt.yml @@ -1,4 +1,4 @@ -# https://github.com/arturbosch/detekt/blob/1.5.0/detekt-cli/src/main/resources/default-detekt-config.yml +# https://github.com/arturbosch/detekt/blob/1.7.1/detekt-cli/src/main/resources/default-detekt-config.yml comments: active: false @@ -12,6 +12,7 @@ complexity: active: true threshold: 10 includeStaticDeclarations: false + includePrivateDeclarations: false ComplexMethod: active: true threshold: 15 @@ -21,7 +22,7 @@ complexity: nestingFunctions: run,let,apply,with,also,use,forEach,isNotNull,ifNull LabeledExpression: active: false - ignoredLabels: "" + ignoredLabels: '' LargeClass: active: true threshold: 600 @@ -30,8 +31,10 @@ complexity: threshold: 60 LongParameterList: active: true - threshold: 6 + functionThreshold: 6 + constructorThreshold: 7 ignoreDefaultParameters: true + ignoreDataClasses: true MethodOverloading: active: false NestedBlockDepth: @@ -39,14 +42,14 @@ complexity: threshold: 4 StringLiteralDuplication: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' threshold: 3 ignoreAnnotation: true excludeStringsWithLessThan5Characters: true ignoreStringsRegex: '$^' TooManyFunctions: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' thresholdInFiles: 11 thresholdInClasses: 11 thresholdInInterfaces: 11 @@ -67,7 +70,7 @@ empty-blocks: active: true EmptyCatchBlock: active: true - allowedExceptionNameRegex: "^(_|(ignore|expected).*)" + allowedExceptionNameRegex: '^(_|(ignore|expected).*)' EmptyClassBlock: active: true EmptyDefaultConstructor: @@ -91,6 +94,8 @@ empty-blocks: active: true EmptySecondaryConstructor: active: true + EmptyTryBlock: + active: true EmptyWhenBlock: active: true EmptyWhileBlock: @@ -115,7 +120,7 @@ exceptions: SwallowedException: active: true ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException' - allowedExceptionNameRegex: "^(_|(ignore|expected).*)" + allowedExceptionNameRegex: '^(_|(ignore|expected).*)' ThrowingExceptionFromFinally: active: false ThrowingExceptionInMain: @@ -127,7 +132,7 @@ exceptions: active: true TooGenericExceptionCaught: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' exceptionNames: - ArrayIndexOutOfBoundsException - Error @@ -137,7 +142,7 @@ exceptions: - IndexOutOfBoundsException - RuntimeException - Throwable - allowedExceptionNameRegex: "^(_|(ignore|expected).*)" + allowedExceptionNameRegex: '^(_|(ignore|expected).*)' TooGenericExceptionThrown: active: true exceptionNames: @@ -166,6 +171,7 @@ formatting: FinalNewline: active: true autoCorrect: true + insertFinalNewLine: true ImportOrdering: active: false Indentation: @@ -253,37 +259,37 @@ naming: ClassNaming: active: true classPattern: '[A-Z$][a-zA-Z0-9$]*' - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' ConstructorParameterNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' parameterPattern: '[a-z][A-Za-z0-9]*' privateParameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' ignoreOverridden: true EnumNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*' ForbiddenClassName: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' forbiddenName: '' FunctionMaxLength: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' maximumFunctionNameLength: 30 FunctionMinLength: active: false FunctionNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$' excludeClassPattern: '$^' ignoreOverridden: true FunctionParameterNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' parameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' ignoreOverridden: true @@ -292,33 +298,34 @@ naming: rootPackage: '' MatchingDeclarationName: active: true + mustBeFirst: true MemberNameEqualsClassName: active: false ObjectPropertyNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' constantPattern: '[A-Za-z][_A-Za-z0-9]*' propertyPattern: '[A-Za-z][_A-Za-z0-9]*' privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' PackageNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$' TopLevelPropertyNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' constantPattern: '[A-Z][_A-Z0-9]*' propertyPattern: '[A-Za-z][_A-Za-z0-9]*' privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' VariableMaxLength: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' maximumVariableNameLength: 64 VariableMinLength: active: false VariableNaming: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' variablePattern: '[a-z][A-Za-z0-9]*' privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' @@ -330,10 +337,10 @@ performance: active: true ForEachOnRange: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' SpreadOperator: active: true - excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' UnnecessaryTemporaryInstantiation: active: true @@ -402,11 +409,11 @@ style: ForbiddenComment: active: true values: 'TODO:,FIXME:,STOPSHIP:' - allowedPatterns: "" + allowedPatterns: '' ForbiddenImport: active: true - imports: '' - forbiddenPatterns: "" + imports: [] + forbiddenPatterns: '' ForbiddenMethodCall: active: true methods: '' @@ -421,7 +428,7 @@ style: active: true ignoreOverridableFunction: true excludedFunctions: 'describeContents' - excludeAnnotatedFunction: "dagger.Provides" + excludeAnnotatedFunction: 'dagger.Provides' LibraryCodeMustSpecifyReturnType: active: true LoopWithTooManyJumpStatements: @@ -477,8 +484,7 @@ style: UnderscoresInNumericLiterals: active: false UnnecessaryAbstractClass: - active: true - excludeAnnotatedClasses: "dagger.Module" + active: false UnnecessaryAnnotationUseSiteTarget: active: true UnnecessaryApply: @@ -497,7 +503,7 @@ style: active: true UnusedPrivateMember: active: true - allowedNames: "(_|ignored|expected|serialVersionUID)" + allowedNames: '(_|ignored|expected|serialVersionUID)' UseArrayLiteralsInAnnotations: active: true UseCheckOrError: diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6254d2d4..6623300b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew.bat b/gradlew.bat index 24467a14..9109989e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" diff --git a/mobile/build.gradle b/mobile/build.gradle index 1b0035fd..d4577318 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -65,34 +65,34 @@ androidExtensions { } def lifecycleVersion = '2.2.0' -def roomVersion = '2.2.4' +def roomVersion = '2.2.5' dependencies { - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.4' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.5' kapt "androidx.room:room-compiler:$roomVersion" implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.browser:browser:1.2.0' implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.emoji:emoji:1.0.0' - implementation 'androidx.fragment:fragment-ktx:1.2.2' + implementation 'androidx.fragment:fragment-ktx:1.2.4' implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion" - implementation 'androidx.preference:preference:1.1.0' + implementation 'androidx.preference:preference:1.1.1' implementation "androidx.room:room-ktx:$roomVersion" - implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' - implementation 'com.android.billingclient:billing-ktx:2.1.0' + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-rc01' + implementation 'com.android.billingclient:billing-ktx:2.2.0' implementation 'com.github.topjohnwu.libsu:core:2.5.1' implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' implementation 'com.google.android.material:material:1.1.0' - implementation 'com.google.firebase:firebase-analytics:17.2.3' - implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01' + implementation 'com.google.firebase:firebase-analytics:17.3.0' + implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04' implementation 'com.google.zxing:core:3.4.0' implementation 'com.jakewharton.timber:timber:4.7.1' implementation 'com.linkedin.dexmaker:dexmaker:2.25.1' implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.1.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" implementation 'org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5' testImplementation 'junit:junit:4.13' androidTestImplementation "androidx.room:room-testing:$roomVersion" androidTestImplementation 'androidx.test:runner:1.2.0' diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index a6de2d58..bc1913a7 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -50,7 +50,7 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene */ private val p2pManager: WifiP2pManager? by lazy { try { - app.getSystemService() + app.getSystemService() } catch (e: RuntimeException) { Timber.w(e) null diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/BluetoothTethering.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/BluetoothTethering.kt index b496bf63..19cef53d 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/BluetoothTethering.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/BluetoothTethering.kt @@ -1,6 +1,5 @@ package be.mygod.vpnhotspot.manage -import android.annotation.SuppressLint import android.annotation.TargetApi import android.bluetooth.BluetoothAdapter import android.bluetooth.BluetoothProfile @@ -27,7 +26,7 @@ class BluetoothTethering(context: Context, val stateListener: (Int) -> Unit) : * From BluetoothProfile.java. */ private const val PAN = 5 - private val isTetheringOn by lazy @SuppressLint("PrivateApi") { + private val isTetheringOn by lazy { Class.forName("android.bluetooth.BluetoothPan").getDeclaredMethod("isTetheringOn") } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt index 23d5b9d2..72bfb6a0 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt @@ -1,6 +1,5 @@ package be.mygod.vpnhotspot.net -import android.annotation.SuppressLint import android.content.Intent import android.net.ConnectivityManager import android.os.Build @@ -84,7 +83,7 @@ object TetheringManager { */ const val TETHERING_BLUETOOTH = 2 - private val classOnStartTetheringCallback by lazy @SuppressLint("PrivateApi") { + private val classOnStartTetheringCallback by lazy { Class.forName("android.net.ConnectivityManager\$OnStartTetheringCallback") } private val startTethering by lazy {