From 5de7c466ebb8df6a88d90e3c957384b94f1e9c01 Mon Sep 17 00:00:00 2001 From: petersamokhin Date: Thu, 29 Dec 2022 16:03:55 +0000 Subject: [PATCH] 1.0.1 --- .github/workflows/docs_publish.yml | 2 ++ auth/CHANGELOG.md | 5 ++++ auth/gradle.properties | 2 +- .../vksdk/android/auth/VkAuth.kt | 26 ++++++++++++------- gradle.properties | 2 +- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docs_publish.yml b/.github/workflows/docs_publish.yml index 1be443e..b44429c 100644 --- a/.github/workflows/docs_publish.yml +++ b/.github/workflows/docs_publish.yml @@ -21,6 +21,8 @@ jobs: - name: 'Custom docs' run: | cp README.md docs/index.md + sed -i -e 's+docs/images+images+g' docs/index.md + cp auth/CHANGELOG.md docs/changelog-auth.md - name: 'dokka docs' diff --git a/auth/CHANGELOG.md b/auth/CHANGELOG.md index dba5bce..029c3c9 100644 --- a/auth/CHANGELOG.md +++ b/auth/CHANGELOG.md @@ -1,5 +1,10 @@ # Change log +Version 1.0.1 *(2022-12-29)* +---------------------------- + +* Switch to manual unregistering of the activity result launchers. + Version 1.0.0 *(2022-12-29)* ---------------------------- diff --git a/auth/gradle.properties b/auth/gradle.properties index baa8d44..65773d2 100644 --- a/auth/gradle.properties +++ b/auth/gradle.properties @@ -1,4 +1,4 @@ POM_ARTIFACT_ID=auth POM_NAME=VK SDK Android Auth POM_DESCRIPTION=VK SDK Android, module Auth -VERSION_NAME=1.0.0 \ No newline at end of file +VERSION_NAME=1.0.1 \ No newline at end of file diff --git a/auth/src/main/kotlin/com/petersamokhin/vksdk/android/auth/VkAuth.kt b/auth/src/main/kotlin/com/petersamokhin/vksdk/android/auth/VkAuth.kt index 02d3204..116fc53 100644 --- a/auth/src/main/kotlin/com/petersamokhin/vksdk/android/auth/VkAuth.kt +++ b/auth/src/main/kotlin/com/petersamokhin/vksdk/android/auth/VkAuth.kt @@ -37,8 +37,8 @@ public object VkAuth { public const val VK_API_VERSION_DEFAULT: String = "5.113" public const val VK_REDIRECT_URI_DEFAULT: String = "https://oauth.vk.com/blank.html" - private const val INFO_RESPONSE_TYPE_NOT_SUPPORTED = - "Specifying the response_type is not available with the official VK App, so it can not be used" + private const val INFO_RESPONSE_TYPE_NOT_SUPPORTED = "Specifying the response_type is not available " + + "with the official VK App, so it can not be used" private const val VK_EXTRA_CLIENT_ID = "client_id" private const val VK_EXTRA_REVOKE = "revoke" @@ -73,8 +73,6 @@ public object VkAuth { } activity.addOnNewIntentListener { intent -> - resultLaunchers.remove(activity) - try { listener( Result.success(VkResultParser.parseCustomTabs(intent = intent)) @@ -99,8 +97,6 @@ public object VkAuth { } catch (e: Throwable) { listener(Result.failure(e)) null - } finally { - resultLaunchers.remove(activity) } if (vkResult != null) { @@ -112,6 +108,21 @@ public object VkAuth { resultLaunchers[activity] = resultLauncher } + /** + * Unregister the activity result listeners. + * + * @param activity An activity for which to unregister the listeners. + * If null, all listeners will be unregistered. + */ + @JvmStatic + public fun unregister(activity: ComponentActivity? = null) { + if (activity != null) { + resultLaunchers.remove(activity) + } else { + resultLaunchers.clear() + } + } + /** * Checks is the official VK app installed * to be able to authorize through the app without the WebView @@ -179,7 +190,6 @@ public object VkAuth { AuthMode.RequireWeb -> { when { activity.customTabsSupported() -> { - resultLaunchers.remove(activity) activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery())) null } @@ -201,7 +211,6 @@ public object VkAuth { } activity.customTabsSupported() -> { - resultLaunchers.remove(activity) activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery())) null } @@ -226,7 +235,6 @@ public object VkAuth { when { activity.customTabsSupported() -> { - resultLaunchers.remove(activity) activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery())) } diff --git a/gradle.properties b/gradle.properties index 9e69647..2314f85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.petersamokhin.vksdk.android -VERSION_NAME=1.0.0 +VERSION_NAME=1.0.1 REPOSITORY_URL_MAVEN_STAGING_DEFAULT=https://oss.sonatype.org/service/local/staging/deploy/maven2/ REPOSITORY_URL_MAVEN_SNAPSHOT_DEFAULT=https://oss.sonatype.org/content/repositories/snapshots/