Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
petersamokhin committed Dec 29, 2022
1 parent b722663 commit 5de7c46
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docs_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)*
----------------------------

Expand Down
2 changes: 1 addition & 1 deletion auth/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
VERSION_NAME=1.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -73,8 +73,6 @@ public object VkAuth {
}

activity.addOnNewIntentListener { intent ->
resultLaunchers.remove(activity)

try {
listener(
Result.success(VkResultParser.parseCustomTabs(intent = intent))
Expand All @@ -99,8 +97,6 @@ public object VkAuth {
} catch (e: Throwable) {
listener(Result.failure(e))
null
} finally {
resultLaunchers.remove(activity)
}

if (vkResult != null) {
Expand All @@ -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
Expand Down Expand Up @@ -179,7 +190,6 @@ public object VkAuth {
AuthMode.RequireWeb -> {
when {
activity.customTabsSupported() -> {
resultLaunchers.remove(activity)
activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery()))
null
}
Expand All @@ -201,7 +211,6 @@ public object VkAuth {
}

activity.customTabsSupported() -> {
resultLaunchers.remove(activity)
activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery()))
null
}
Expand All @@ -226,7 +235,6 @@ public object VkAuth {

when {
activity.customTabsSupported() -> {
resultLaunchers.remove(activity)
activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery()))
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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/
Expand Down

0 comments on commit 5de7c46

Please sign in to comment.