MOB-23 MOB-41 small fixes related to HTTP

This commit is contained in:
Henrik Lepson
2021-11-08 20:22:33 +02:00
parent 1b79eba4a4
commit f0c7ab96bb
5 changed files with 13 additions and 8 deletions

View File

@@ -55,9 +55,9 @@ class AuthFragment : Fragment() {
override fun onTick(p0: Long) {
timeRemaining--
if (timeRemaining == 0) {
binding!!.timeCounter.text = getString(R.string.no_time)
binding?.timeCounter?.text = getString(R.string.no_time)
} else {
binding!!.timeCounter.text = getString(R.string.time_left, timeRemaining)
binding?.timeCounter?.text = getString(R.string.time_left, timeRemaining)
}
}

View File

@@ -57,8 +57,10 @@ class HomeFragment : Fragment() {
intentParams.setChallenge(requireActivity().intent.getStringExtra("challenge")!!)
intentParams.setAuthUrl(requireActivity().intent.getStringExtra("authUrl")!!)
} else { //Website
// Currently the test website won't send the authUrl parameter
//Log.i("intentDebugging", requireActivity().intent.data.toString())
intentParams.setChallenge(requireActivity().intent.data!!.getQueryParameter("challenge")!!)
intentParams.setAuthUrl(requireActivity().intent.data!!.getQueryParameter("authUrl")!!)
//intentParams.setAuthUrl(requireActivity().intent.data!!.getQueryParameter("authUrl")!!)
}
} catch (e: Exception) {
// There was a problem with parameters, which means that authentication is not possible.

View File

@@ -1,7 +1,6 @@
package com.tarkvaraprojekt.mobileauthapp.model
import androidx.lifecycle.ViewModel
import com.tarkvaraprojekt.mobileauthapp.network.TokenItem
class ParametersViewModel: ViewModel() {

View File

@@ -23,7 +23,7 @@ private val retrofit = Retrofit.Builder().addConverterFactory(MoshiConverterFact
interface TokenApiService {
@Headers("Content-Type: application/json")
@POST("authentication")
@POST("auth/authentication")
suspend fun postToken(@Body data: TokenItem): Response<TokenItem>
}