diff --git a/CHANGELOG.md b/CHANGELOG.md index 44d5b91..3bc0136 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### Fixed #### Changes +- [app-demo][tinkoff-id] bump up API versions (targetSdk and compileSdk to 31) and dependencies versions MC-5659 #### Additions ## 1.0.1 @@ -9,16 +10,13 @@ #### Fixed #### Changes #### Additions - - Added redirect_uri configuration logic - ## 1.0.0 #### Fixed #### Changes #### Additions - [app-demo]: app-demo [tinkoff-id]: tinkoff-id diff --git a/README.md b/README.md index d5a4089..cd0cf68 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ Enum со статусами пришедшими из приложения Ти SDK поставляется с примером приложения, где можно посмотреть работу авторизации. В папке [app-demo](app-demo) содержится тестовое приложение. В данном приложении можно: -- Проверить работу вашего cleintId, подставив его в необходимое поле +- Проверить работу вашего clientId, подставив его в необходимое поле - Посмотреть дизайн кнопки - Авторизоваться - Отозвать токены diff --git a/app-demo/build.gradle b/app-demo/build.gradle index 0d45d3f..f1cd99b 100644 --- a/app-demo/build.gradle +++ b/app-demo/build.gradle @@ -3,19 +3,15 @@ apply plugin: 'kotlin-android' apply from: rootProject.file('gradle/versions.gradle') apply from: rootProject.file('gradle/plugin/detekt.gradle') -def getBuildVersionCode = (project.findProperty("buildCounter") == null) - ? 1 - : Integer.parseInt(project.findProperty("buildCounter")) - android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { multiDexEnabled = true - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode getBuildVersionCode - versionName authVersion + minSdkVersion rootProject.minSdkVersion + targetSdkVersion rootProject.targetSdkVersion + versionCode rootProject.authCode + versionName rootProject.authVersion testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -34,11 +30,11 @@ android { dependencies { api project(':tinkoff-id') - api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" api "androidx.appcompat:appcompat:${appCompatVersion}" api "androidx.constraintlayout:constraintlayout:${constraintLayoutVersion}" - api "com.google.android.material:material:${material}" + api "com.google.android.material:material:${materialVersion}" //rx api "io.reactivex.rxjava2:rxjava:$rxJavaVersion" api "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion" -} \ No newline at end of file +} diff --git a/app-demo/src/main/AndroidManifest.xml b/app-demo/src/main/AndroidManifest.xml index a3640ab..faa537c 100644 --- a/app-demo/src/main/AndroidManifest.xml +++ b/app-demo/src/main/AndroidManifest.xml @@ -7,14 +7,17 @@ + tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnusedAttribute"> diff --git a/app-demo/src/main/java/ru/tinkoff/core/app_demo_partner/PartnerPresenter.kt b/app-demo/src/main/java/ru/tinkoff/core/app_demo_partner/PartnerPresenter.kt index a6b105d..6736a4a 100644 --- a/app-demo/src/main/java/ru/tinkoff/core/app_demo_partner/PartnerPresenter.kt +++ b/app-demo/src/main/java/ru/tinkoff/core/app_demo_partner/PartnerPresenter.kt @@ -2,9 +2,8 @@ package ru.tinkoff.core.app_demo_partner import android.net.Uri import android.util.Log -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleObserver -import androidx.lifecycle.OnLifecycleEvent +import androidx.lifecycle.DefaultLifecycleObserver +import androidx.lifecycle.LifecycleOwner import io.reactivex.Single import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.CompositeDisposable @@ -20,7 +19,7 @@ import ru.tinkoff.core.tinkoffId.TinkoffTokenPayload class PartnerPresenter( private val tinkoffPartnerAuth: TinkoffIdAuth, private val partnerActivity: PartnerActivity -) : LifecycleObserver { +) : DefaultLifecycleObserver { private val compositeDisposable = CompositeDisposable() private var tokenPayload: TinkoffTokenPayload? = null @@ -98,8 +97,8 @@ class PartnerPresenter( } } - @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) - fun dispose() { + override fun onDestroy(owner: LifecycleOwner) { + super.onDestroy(owner) compositeDisposable.clear() } diff --git a/app-demo/src/main/res/values/colors.xml b/app-demo/src/main/res/values/colors.xml deleted file mode 100644 index 69b2233..0000000 --- a/app-demo/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #008577 - #00574B - #D81B60 - diff --git a/app-demo/src/main/res/values/styles.xml b/app-demo/src/main/res/values/styles.xml deleted file mode 100644 index 5885930..0000000 --- a/app-demo/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/app-demo/src/main/res/xml/data_extraction_rules.xml b/app-demo/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..fe61eb7 --- /dev/null +++ b/app-demo/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle index b5ebd91..04dd7fb 100644 --- a/build.gradle +++ b/build.gradle @@ -4,13 +4,12 @@ def useMavenLocal = project.hasProperty("useMavenLocal") print("useMavenLocal = " + useMavenLocal) buildscript { - apply from: 'gradle/versions.gradle' repositories { // mavenLocal() // Uncomment when testing on Maven local repository google() - jcenter() + mavenCentral() maven { url 'https://plugins.gradle.org/m2/' } gradlePluginPortal() } @@ -26,7 +25,7 @@ allprojects { repositories { if (useMavenLocal) mavenLocal() google() - jcenter() + mavenCentral() } } diff --git a/gradle.properties b/gradle.properties index 4959339..218fbb3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,17 +11,18 @@ android.useAndroidX=true android.enableJetifier=true kotlin.code.style=official -POM_DESCRIPTION=Android library for Tinkoff authorization +POM_DESCRIPTION=Android library for Tinkoff authorization POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=https://github.com/tinkoff-mobile-tech/TinkoffID-Android/blob/master/LICENSE POM_LICENCE_DIST=repo POM_DEVELOPER_ID=tcs POM_DEVELOPER_NAME=Tinkoff Credit Systems +POM_DEVELOPER_EMAIL=Tinkoff_id@tinkoff.ru POM_URL=https://github.com/tinkoff-mobile-tech/TinkoffID-Android -POM_SCM_URL=https://github.com/tinkoff-mobile-tech/TinkoffID-Android -POM_SCM_CONNECTION=scm:git@github.com:tinkoff-mobile-tech/TinkoffID-Android -POM_SCM_DEV_CONNECTION=scm:git@github.com:tinkoff-mobile-tech/TinkoffID-Android +POM_SCM_URL=https://github.com/tinkoff-mobile-tech/TinkoffID-Android/tree/main +POM_SCM_CONNECTION=scm:git:git://github.com/tinkoff-mobile-tech/TinkoffID-Android.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com:tinkoff-mobile-tech/TinkoffID-Android.git VERSION_NAME=1.0.2 -VERSION_CODE=1 +VERSION_CODE=3 GROUP=ru.tinkoff.core.tinkoffauth diff --git a/gradle/plugin/android.gradle b/gradle/plugin/android.gradle index e96c09d..7fc3b1a 100644 --- a/gradle/plugin/android.gradle +++ b/gradle/plugin/android.gradle @@ -49,6 +49,7 @@ android { configureEach { includeNonPublic.set(false) noAndroidSdkLink.set(false) + suppressInheritedMembers.set(true) } } } diff --git a/gradle/plugin/config/detekt.yml b/gradle/plugin/config/detekt.yml index 915524e..30a2fa6 100644 --- a/gradle/plugin/config/detekt.yml +++ b/gradle/plugin/config/detekt.yml @@ -485,7 +485,7 @@ potential-bugs: LateinitUsage: active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - excludeAnnotatedProperties: [] + ignoreAnnotated: [] ignoreOnClassesPattern: '' MapGetWithNotNullAssertionOperator: active: false @@ -557,7 +557,7 @@ style: active: false ignoreOverridableFunction: true excludedFunctions: 'describeContents' - excludeAnnotatedFunction: ['dagger.Provides'] + ignoreAnnotated: ['dagger.Provides'] LibraryCodeMustSpecifyReturnType: active: true LibraryEntitiesShouldNotBePublic: @@ -634,10 +634,10 @@ style: active: false UnderscoresInNumericLiterals: active: false - acceptableDecimalLength: 5 + acceptableLength: 5 UnnecessaryAbstractClass: active: true - excludeAnnotatedClasses: ['dagger.Module'] + ignoreAnnotated: ['dagger.Module'] UnnecessaryAnnotationUseSiteTarget: active: false UnnecessaryApply: @@ -665,7 +665,7 @@ style: active: false UseDataClass: active: false - excludeAnnotatedClasses: [] + ignoreAnnotated: [] allowVars: false UseEmptyCounterpart: active: false diff --git a/gradle/plugin/detekt.gradle b/gradle/plugin/detekt.gradle index 31f3410..3d43194 100644 --- a/gradle/plugin/detekt.gradle +++ b/gradle/plugin/detekt.gradle @@ -7,16 +7,21 @@ dependencies { } detekt { - version = detektVersion - input = files('src') + toolVersion = detektVersion + source = files("src") config = rootProject.files('gradle/plugin/config/detekt.yml') +} + +tasks.named("detekt").configure { reports { - xml { - enabled = false - } - html { - enabled = true - destination = file("$project.buildDir/reports/detekt-results-${project.name}.html") - } + xml.required.set(false) + + sarif.required.set(false) + + txt.required.set(true) + txt.outputLocation.set(file("$project.buildDir/reports/detekt-results-${project.name}.txt")) + + html.required.set(true) + html.outputLocation.set(file("$project.buildDir/reports/detekt-results-${project.name}.html")) } } diff --git a/gradle/plugin/kotlin-library.gradle b/gradle/plugin/kotlin-library.gradle index 6ae4482..f61d3ec 100644 --- a/gradle/plugin/kotlin-library.gradle +++ b/gradle/plugin/kotlin-library.gradle @@ -3,5 +3,5 @@ apply from: rootProject.file('gradle/plugin/detekt.gradle') apply plugin: 'kotlin-kapt' dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" } diff --git a/gradle/plugin/publish-lib.gradle b/gradle/plugin/publish-lib.gradle index a41bda2..b4ec08d 100644 --- a/gradle/plugin/publish-lib.gradle +++ b/gradle/plugin/publish-lib.gradle @@ -14,12 +14,9 @@ * limitations under the License. */ -apply plugin: 'maven' +apply plugin: 'maven-publish' apply plugin: 'signing' -version = VERSION_NAME -group = GROUP - def isReleaseBuild() { return !VERSION_NAME.contains("SNAPSHOT") } @@ -29,11 +26,6 @@ def getReleaseRepositoryUrl() { : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" } -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL - : "https://oss.sonatype.org/content/repositories/snapshots/" -} - def getRepositoryUsername() { return hasProperty('ossrhUsername') ? ossrhUsername : '' } @@ -42,123 +34,71 @@ def getRepositoryPassword() { return hasProperty('ossrhPassword') ? ossrhPassword : '' } -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + groupId GROUP + artifactId POM_ARTIFACT_ID + version VERSION_NAME - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME + from components.release - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + afterEvaluate { + artifact androidSourcesJar + artifact androidJavadocsJar } - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - + pom { + name = POM_NAME + packaging = POM_PACKAGING + description = POM_DESCRIPTION + url = POM_URL scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION + url = POM_SCM_URL + connection = POM_SCM_CONNECTION + developerConnection = POM_SCM_DEV_CONNECTION } - licenses { license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + distribution = POM_LICENCE_DIST } } - developers { developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME + email = POM_DEVELOPER_EMAIL } } } } } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - task install(type: Upload, dependsOn: assemble) { - repositories.mavenInstaller { - configuration = configurations.archives - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } + repositories { + maven { + url = getReleaseRepositoryUrl() + credentials { + username = getRepositoryUsername() + password = getRepositoryPassword() } } } } - task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java.source - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - } - - task androidJavadocsJar(type: Jar, dependsOn: dokkaJavadoc) { - classifier = 'javadoc' - from "$buildDir/javadoc" - } - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.source + archiveClassifier.set("sources") + from android.sourceSets.main.java.srcDirs } - - if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } + task androidJavadocsJar(type: Jar, dependsOn: dokkaJavadoc) { + archiveClassifier.set("javadoc") + from dokkaJavadoc.outputDirectory } - artifacts { - archives androidSourcesJar - archives androidJavadocsJar + signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("publish") } + sign publishing.publications.release } } diff --git a/gradle/versions.gradle b/gradle/versions.gradle index ded8601..b5b808c 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -1,30 +1,29 @@ ext { - compileSdkVersion = 30 + compileSdkVersion = 31 minSdkVersion = 21 - targetSdkVersion = 30 + targetSdkVersion = 31 isRelease = project.hasProperty('release') authCode = VERSION_CODE.toInteger() authVersion = getVersionName(VERSION_NAME) - constraintLayoutVersion = '2.1.2' - rxJavaVersion = '2.2.20' + constraintLayoutVersion = '2.1.3' + rxJavaVersion = '2.2.21' rxAndroidVersion = '2.1.1' - kotlinVersion = '1.4.21' - appCompatVersion = '1.2.0' - material = '1.4.0' - okHttpVersion = '4.9.0' + kotlinVersion = '1.6.21' + appCompatVersion = '1.4.1' + materialVersion = '1.5.0' + okHttpVersion = '4.9.3' - detektVersion = '1.15.0' - dokkaVersion = '1.4.20' - androidPluginVersion = '4.1.1' + detektVersion = '1.20.0' + dokkaVersion = '1.6.21' + androidPluginVersion = '7.1.3' - junitVersion = '4.13.1' - truthVersion = '1.1.2' - robolectricVersion = '4.4' - testCoreVersion = '1.3.0' - mockwebserverVersion = '4.9.0' + junitVersion = '4.13.2' + truthVersion = '1.1.3' + robolectricVersion = '4.8' + testCoreVersion = '1.4.0-rc01' // 1.3.0 fails when targeting API 31 } def getVersionName(version) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 56a4233..78c6870 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 28 18:31:46 MSK 2020 +#Wed May 04 12:08:39 MSK 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/tinkoff-id/build.gradle b/tinkoff-id/build.gradle index eb475e0..d0d3a2d 100644 --- a/tinkoff-id/build.gradle +++ b/tinkoff-id/build.gradle @@ -2,7 +2,6 @@ apply from: '../gradle/plugin/android.gradle' apply from: '../gradle/plugin/publish-lib.gradle' android { - resourcePrefix 'tinkoff_id_' testOptions { @@ -18,7 +17,7 @@ dependencies { testImplementation "com.google.truth:truth:$truthVersion" testImplementation "org.robolectric:robolectric:$robolectricVersion" testImplementation "androidx.test:core:$testCoreVersion" - testImplementation "com.squareup.okhttp3:mockwebserver:$mockwebserverVersion" + testImplementation "com.squareup.okhttp3:mockwebserver:$okHttpVersion" } repositories { diff --git a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffPartnerApiService.kt b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffPartnerApiService.kt index 6740b7e..d332b50 100644 --- a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffPartnerApiService.kt +++ b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffPartnerApiService.kt @@ -44,14 +44,14 @@ internal class TinkoffPartnerApiService(private val api: TinkoffIdApi) { fun revokeAccessToken(accessToken: String, clientId: String): TinkoffCall { return api.revokeToken(accessToken, TOKEN_HINT_TYPE_ACCESS_TOKEN, clientId).wrapToTinkoffCall( - { Unit }, + { /* left empty intentionally */ }, { getRevokeErrorType(it) } ) } fun revokeRefreshToken(refreshToken: String, clientId: String): TinkoffCall { return api.revokeToken(refreshToken, TOKEN_HINT_TYPE_REFRESH_TOKEN, clientId).wrapToTinkoffCall( - { Unit }, + { /* left empty intentionally */ }, { getRevokeErrorType(it) } ) } diff --git a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffTokenPayload.kt b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffTokenPayload.kt index c4e8268..544f199 100644 --- a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffTokenPayload.kt +++ b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/TinkoffTokenPayload.kt @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/codeVerifier/CodeVerifierUtil.kt b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/codeVerifier/CodeVerifierUtil.kt index d3573b9..8b967b3 100644 --- a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/codeVerifier/CodeVerifierUtil.kt +++ b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/codeVerifier/CodeVerifierUtil.kt @@ -50,7 +50,7 @@ internal object CodeVerifierUtil { /** * The default entropy (in bytes) used for the code verifier. */ - const val DEFAULT_CODE_VERIFIER_ENTROPY = 64 + private const val DEFAULT_CODE_VERIFIER_ENTROPY = 64 /** * Base64 encoding settings used for generated code verifiers. diff --git a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/error/TinkoffErrorMessage.kt b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/error/TinkoffErrorMessage.kt index d7ff9aa..c46122a 100644 --- a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/error/TinkoffErrorMessage.kt +++ b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/error/TinkoffErrorMessage.kt @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/ui/TinkoffIdSignInButton.kt b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/ui/TinkoffIdSignInButton.kt index 6dc8ba0..9ce5510 100644 --- a/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/ui/TinkoffIdSignInButton.kt +++ b/tinkoff-id/src/main/java/ru/tinkoff/core/tinkoffId/ui/TinkoffIdSignInButton.kt @@ -25,6 +25,7 @@ import android.text.StaticLayout import android.text.TextPaint import android.util.AttributeSet import android.util.TypedValue +import androidx.appcompat.content.res.AppCompatResources import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import ru.tinkoff.core.tinkoffId.R @@ -32,6 +33,7 @@ import kotlin.math.roundToInt /** * @author Dmitry Naymushin + * * A button with an icon and a text which can be used for partner authorization. * Right now the icon is not customizable as well as the text (although it's open for i18n) * Text should represent a single line string. @@ -65,7 +67,7 @@ public class TinkoffIdSignInButton @JvmOverloads constructor( private val horizontalPadding = HORIZONTAL_PADDING_DP.dpToPx() private val iconTextOffset = ICON_TEXT_OFFSET_DP.dpToPx() - private val icon = ContextCompat.getDrawable(context, R.drawable.tinkoff_id_tinkoff_logo) + private val icon = AppCompatResources.getDrawable(context, R.drawable.tinkoff_id_tinkoff_logo) private val text = context.getString(R.string.tinkoff_id_sign_in) private val textPaint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply { @@ -88,7 +90,7 @@ public class TinkoffIdSignInButton @JvmOverloads constructor( isCompact = getInt(R.styleable.TinkoffIdSignInButton_tinkoff_id_size, SIZE_STANDARD) == SIZE_COMPACT recycle() } - background = ContextCompat.getDrawable(context, R.drawable.tinkoff_id_sign_in_button_background) + background = AppCompatResources.getDrawable(context, R.drawable.tinkoff_id_sign_in_button_background) } // this is done here intentionally to ignore setting of a text to a custom value diff --git a/tinkoff-id/src/test/java/TinkoffIdAuthTest.kt b/tinkoff-id/src/test/java/ru/tinkoff/core/tinkoffId/TinkoffIdAuthTest.kt similarity index 93% rename from tinkoff-id/src/test/java/TinkoffIdAuthTest.kt rename to tinkoff-id/src/test/java/ru/tinkoff/core/tinkoffId/TinkoffIdAuthTest.kt index 74158e9..303dbd0 100644 --- a/tinkoff-id/src/test/java/TinkoffIdAuthTest.kt +++ b/tinkoff-id/src/test/java/ru/tinkoff/core/tinkoffId/TinkoffIdAuthTest.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +package ru.tinkoff.core.tinkoffId + import android.content.Context import android.net.Uri import android.os.Build @@ -23,8 +25,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config -import ru.tinkoff.core.tinkoffId.TinkoffIdAuth -import ru.tinkoff.core.tinkoffId.TinkoffIdStatusCode /** * @author Stanislav Mukhametshin @@ -34,7 +34,7 @@ import ru.tinkoff.core.tinkoffId.TinkoffIdStatusCode public class TinkoffIdAuthTest { private var context: Context = ApplicationProvider.getApplicationContext() - public val tinkoffAuth: TinkoffIdAuth = TinkoffIdAuth(context, CLIENT_ID, REDIRECT_URL) + private val tinkoffAuth: TinkoffIdAuth = TinkoffIdAuth(context, CLIENT_ID, REDIRECT_URL) private val testUri: Uri = Uri.Builder() .scheme("https") .authority("www.partner.com") diff --git a/tinkoff-id/src/test/java/TinkoffPartnerApiServiceTest.kt b/tinkoff-id/src/test/java/ru/tinkoff/core/tinkoffId/TinkoffPartnerApiServiceTest.kt similarity index 96% rename from tinkoff-id/src/test/java/TinkoffPartnerApiServiceTest.kt rename to tinkoff-id/src/test/java/ru/tinkoff/core/tinkoffId/TinkoffPartnerApiServiceTest.kt index 63f35ca..34e0e42 100644 --- a/tinkoff-id/src/test/java/TinkoffPartnerApiServiceTest.kt +++ b/tinkoff-id/src/test/java/ru/tinkoff/core/tinkoffId/TinkoffPartnerApiServiceTest.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +package ru.tinkoff.core.tinkoffId + import android.os.Build import com.google.common.truth.Truth.assertThat import okhttp3.OkHttpClient @@ -26,9 +28,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config -import ru.tinkoff.core.tinkoffId.TinkoffCall -import ru.tinkoff.core.tinkoffId.TinkoffPartnerApiService -import ru.tinkoff.core.tinkoffId.TinkoffTokenPayload import ru.tinkoff.core.tinkoffId.api.TinkoffIdApi import ru.tinkoff.core.tinkoffId.error.TinkoffRequestException import ru.tinkoff.core.tinkoffId.error.TinkoffTokenErrorConstants