Skip to content

Commit 5de7c46

Browse files
committed
1.0.1
1 parent b722663 commit 5de7c46

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

.github/workflows/docs_publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
- name: 'Custom docs'
2222
run: |
2323
cp README.md docs/index.md
24+
sed -i -e 's+docs/images+images+g' docs/index.md
25+
2426
cp auth/CHANGELOG.md docs/changelog-auth.md
2527
2628
- name: 'dokka docs'

auth/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change log
22

3+
Version 1.0.1 *(2022-12-29)*
4+
----------------------------
5+
6+
* Switch to manual unregistering of the activity result launchers.
7+
38
Version 1.0.0 *(2022-12-29)*
49
----------------------------
510

auth/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
POM_ARTIFACT_ID=auth
22
POM_NAME=VK SDK Android Auth
33
POM_DESCRIPTION=VK SDK Android, module Auth
4-
VERSION_NAME=1.0.0
4+
VERSION_NAME=1.0.1

auth/src/main/kotlin/com/petersamokhin/vksdk/android/auth/VkAuth.kt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public object VkAuth {
3737
public const val VK_API_VERSION_DEFAULT: String = "5.113"
3838
public const val VK_REDIRECT_URI_DEFAULT: String = "https://oauth.vk.com/blank.html"
3939

40-
private const val INFO_RESPONSE_TYPE_NOT_SUPPORTED =
41-
"Specifying the response_type is not available with the official VK App, so it can not be used"
40+
private const val INFO_RESPONSE_TYPE_NOT_SUPPORTED = "Specifying the response_type is not available " +
41+
"with the official VK App, so it can not be used"
4242

4343
private const val VK_EXTRA_CLIENT_ID = "client_id"
4444
private const val VK_EXTRA_REVOKE = "revoke"
@@ -73,8 +73,6 @@ public object VkAuth {
7373
}
7474

7575
activity.addOnNewIntentListener { intent ->
76-
resultLaunchers.remove(activity)
77-
7876
try {
7977
listener(
8078
Result.success(VkResultParser.parseCustomTabs(intent = intent))
@@ -99,8 +97,6 @@ public object VkAuth {
9997
} catch (e: Throwable) {
10098
listener(Result.failure(e))
10199
null
102-
} finally {
103-
resultLaunchers.remove(activity)
104100
}
105101

106102
if (vkResult != null) {
@@ -112,6 +108,21 @@ public object VkAuth {
112108
resultLaunchers[activity] = resultLauncher
113109
}
114110

111+
/**
112+
* Unregister the activity result listeners.
113+
*
114+
* @param activity An activity for which to unregister the listeners.
115+
* If null, all listeners will be unregistered.
116+
*/
117+
@JvmStatic
118+
public fun unregister(activity: ComponentActivity? = null) {
119+
if (activity != null) {
120+
resultLaunchers.remove(activity)
121+
} else {
122+
resultLaunchers.clear()
123+
}
124+
}
125+
115126
/**
116127
* Checks is the official VK app installed
117128
* to be able to authorize through the app without the WebView
@@ -179,7 +190,6 @@ public object VkAuth {
179190
AuthMode.RequireWeb -> {
180191
when {
181192
activity.customTabsSupported() -> {
182-
resultLaunchers.remove(activity)
183193
activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery()))
184194
null
185195
}
@@ -201,7 +211,6 @@ public object VkAuth {
201211
}
202212

203213
activity.customTabsSupported() -> {
204-
resultLaunchers.remove(activity)
205214
activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery()))
206215
null
207216
}
@@ -226,7 +235,6 @@ public object VkAuth {
226235

227236
when {
228237
activity.customTabsSupported() -> {
229-
resultLaunchers.remove(activity)
230238
activity.startActivity(loadCustomTabsAuthUrlIntent(authParams.asQuery()))
231239
}
232240

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=com.petersamokhin.vksdk.android
2-
VERSION_NAME=1.0.0
2+
VERSION_NAME=1.0.1
33

44
REPOSITORY_URL_MAVEN_STAGING_DEFAULT=https://oss.sonatype.org/service/local/staging/deploy/maven2/
55
REPOSITORY_URL_MAVEN_SNAPSHOT_DEFAULT=https://oss.sonatype.org/content/repositories/snapshots/

0 commit comments

Comments
 (0)