Skip to content

Commit

Permalink
Support Android M
Browse files Browse the repository at this point in the history
  • Loading branch information
omralcrt committed Mar 19, 2019
1 parent 3c25ead commit 0fad184
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 128 deletions.
85 changes: 85 additions & 0 deletions .idea/markdown-navigator.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 1 addition & 83 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import java.net.URL
import java.io.*
import java.net.URLEncoder
import java.nio.charset.StandardCharsets



import android.os.Build
import android.support.annotation.RequiresApi

class LinkedinSignInActivity: Activity() {

Expand Down Expand Up @@ -56,6 +55,18 @@ class LinkedinSignInActivity: Activity() {
val url = generateUrl()
webView.settings.javaScriptEnabled = true
webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
val uri = Uri.parse( url )
val authCode = uri.getQueryParameters(CODE).getOrNull(0)

if (authCode != null) {
getAccessToken(authCode)
}

return super.shouldOverrideUrlLoading(view, url)
}

@RequiresApi(Build.VERSION_CODES.N)
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {
val authCode = request.url.getQueryParameters(CODE).getOrNull(0)

Expand Down

0 comments on commit 0fad184

Please sign in to comment.