Skip to content

Commit

Permalink
auth: Prepare for release 0.0.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersamokhin committed Apr 27, 2020
1 parent f633515 commit 88c2c7f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ See the available features below.

See the documentation: [https://vksdk.github.io/vk-sdk-android](https://vksdk.github.io/vk-sdk-android)

Latest versions: [![maven-central](https://img.shields.io/badge/Maven%20Central-0.0.1-yellowgreen?style=flat)](https://search.maven.org/search?q=g:com.petersamokhin.vksdk.android)

## Auth
[![Android minSdkVersion](https://img.shields.io/badge/minSdkVersion-16-yellowgreen)](https://img.shields.io/badge/minSdkVersion-16-yellowgreen) [![Android targetSdkVersion](https://img.shields.io/badge/targetSdkVersion-29-green)](https://img.shields.io/badge/targetSdkVersion-29-green)

Latest version: [![maven-central](https://img.shields.io/badge/Maven%20Central-0.0.2-yellowgreen?style=flat)](https://search.maven.org/search?q=g:com.petersamokhin.vksdk.android)

[Authorization code flow](https://vk.com/dev/authcode_flow_user) is not supported by the official VK SDK and by the official app.
But it is supported by this auth feature.

Expand Down
7 changes: 7 additions & 0 deletions auth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
Version 0.0.1 *(2020-04-27)*
----------------------------

* Fixed instrumental tests
* Fixed showing web page errors and retry dialog on Lollipop+
* Added return of the error description after the web page error

Version 0.0.1 *(2020-04-27)*
----------------------------

First release.
3 changes: 2 additions & 1 deletion auth/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
POM_ARTIFACT_ID=auth
POM_NAME=VK SDK Android Auth
POM_DESCRIPTION=VK SDK Android, module Auth
POM_DESCRIPTION=VK SDK Android, module Auth
VERSION_NAME=0.0.2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class VkAuthParamsInstrumentationTest {
@Test
fun shouldCorrectlyBuildBundle() {
val params = VkAuth.AuthParams(
1, VkAuth.ResponseType.AccessToken, "https://oauth.vk.com/blank.html", "offline"
1, VkAuth.ResponseType.AccessToken, "offline", "https://oauth.vk.com/blank.html"
)
val bundle = params.asBundle(false)

Expand All @@ -20,7 +20,7 @@ class VkAuthParamsInstrumentationTest {
@Test
fun shouldCorrectlyBuildBundleWithIgnored() {
val params = VkAuth.AuthParams(
1, VkAuth.ResponseType.AccessToken, "https://oauth.vk.com/blank.html", "offline"
1, VkAuth.ResponseType.AccessToken, "offline", "https://oauth.vk.com/blank.html"
)
val bundle = params.asBundle(true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class VkAuthActivityTest {
fun intent() {
val activity = mock(Activity::class.java)
val params = VkAuth.AuthParams(
1, VkAuth.ResponseType.AccessToken, "https://oauth.vk.com/blank.html", "offline"
1, VkAuth.ResponseType.AccessToken, "offline", "https://oauth.vk.com/blank.html"
)
val intent = VkAuthActivity.intent(activity, params)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ internal object VkResultParser {
private const val EMPTY_INT_PARAM = -1
private const val EMPTY_STRING_PARAM = ""

private const val ERROR_REQUEST_CODE_UNKNOWN = "requestCode is unknown"

/**
* The authorization result returned by the activity with WebView or from VK App
* can be parsed using this method.
Expand Down Expand Up @@ -62,6 +60,7 @@ internal object VkResultParser {

when {
extras.containsKey(VkAuthActivity.EXTRA_AUTH_RESULT) -> {
@Suppress("RemoveExplicitTypeArguments")
(extras.getValue(VkAuthActivity.EXTRA_AUTH_RESULT) as String).let<String, VkAuthResult> { resultUrlString ->
val params = parseVkUri(resultUrlString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal class VkAuthActivity : AppCompatActivity() {
showWebView()
}
setErrorCallback {
setResult(Activity.RESULT_CANCELED)
setResult(Activity.RESULT_CANCELED, Intent().putExtra("error_description", it.orEmpty()))
finish()
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ internal class VkAuthWebView @JvmOverloads constructor(
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
override fun onReceivedError(view: WebView?, request: WebResourceRequest?, error: WebResourceError?) {
super.onReceivedError(view, request, error)
errorCallback?.invoke(error?.description?.toString())
view?.context?.also {
showError(it, error?.description?.toString())
}
}

override fun onReceivedError(view: WebView?, errorCode: Int, description: String?, failingUrl: String?) {
Expand All @@ -125,7 +127,7 @@ internal class VkAuthWebView @JvmOverloads constructor(
d.dismiss()
}
.setNegativeButton(R.string.cancel) { d, _ ->
errorCallback?.invoke("cancel")
errorCallback?.invoke("description")
d.dismiss()
}
.show()
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=0.0.2-SNAPSHOT
VERSION_NAME=different

POM_URL=https://github.com/vksdk/vk-sdk-android/
POM_SCM_URL=https://github.com/vksdk/vk-sdk-android/
Expand Down

0 comments on commit 88c2c7f

Please sign in to comment.