mirror of
https://github.com/nextcloud/talk-android
synced 2025-08-07 20:15:13 +01:00
Merge pull request #5189 from nextcloud/issue-fix-login-v2-poll-url
Fixed Login V2 Bug
This commit is contained in:
commit
8203ca691d
@ -26,6 +26,8 @@ import org.junit.Before
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import java.lang.Boolean
|
import java.lang.Boolean
|
||||||
|
import kotlin.Long
|
||||||
|
import kotlin.String
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class ChatBlocksDaoTest {
|
class ChatBlocksDaoTest {
|
||||||
@ -58,6 +60,7 @@ class ChatBlocksDaoTest {
|
|||||||
val account1 = usersDao.getUserWithUserId("account1").blockingGet()
|
val account1 = usersDao.getUserWithUserId("account1").blockingGet()
|
||||||
|
|
||||||
conversationsDao.upsertConversations(
|
conversationsDao.upsertConversations(
|
||||||
|
accountId = user.id,
|
||||||
listOf(
|
listOf(
|
||||||
createConversationEntity(
|
createConversationEntity(
|
||||||
accountId = account1.id,
|
accountId = account1.id,
|
||||||
|
@ -85,6 +85,7 @@ class BrowserLoginActivity : BaseActivity() {
|
|||||||
private val loginFlowExecutorService: ScheduledExecutorService? = Executors.newSingleThreadScheduledExecutor()
|
private val loginFlowExecutorService: ScheduledExecutorService? = Executors.newSingleThreadScheduledExecutor()
|
||||||
private var isLoginProcessCompleted = false
|
private var isLoginProcessCompleted = false
|
||||||
private var token: String = ""
|
private var token: String = ""
|
||||||
|
private var pollUrl: String = ""
|
||||||
|
|
||||||
private lateinit var okHttpClient: OkHttpClient
|
private lateinit var okHttpClient: OkHttpClient
|
||||||
|
|
||||||
@ -163,6 +164,7 @@ class BrowserLoginActivity : BaseActivity() {
|
|||||||
launchDefaultWebBrowser(loginUrl)
|
launchDefaultWebBrowser(loginUrl)
|
||||||
}
|
}
|
||||||
token = jsonObject.getAsJsonObject("poll").get("token").asString
|
token = jsonObject.getAsJsonObject("poll").get("token").asString
|
||||||
|
pollUrl = jsonObject.getAsJsonObject("poll").get("endpoint").asString
|
||||||
} catch (e: SSLHandshakeException) {
|
} catch (e: SSLHandshakeException) {
|
||||||
Log.e(TAG, "Error caught at anonymouslyPostLoginRequest: $e")
|
Log.e(TAG, "Error caught at anonymouslyPostLoginRequest: $e")
|
||||||
}
|
}
|
||||||
@ -215,14 +217,12 @@ class BrowserLoginActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun performLoginFlowV2() {
|
private fun performLoginFlowV2() {
|
||||||
val postRequestUrl = "$baseUrl/login/v2/poll"
|
|
||||||
|
|
||||||
val requestBody: RequestBody = FormBody.Builder()
|
val requestBody: RequestBody = FormBody.Builder()
|
||||||
.add("token", token)
|
.add("token", token)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(postRequestUrl)
|
.url(pollUrl)
|
||||||
.post(requestBody)
|
.post(requestBody)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user