fix #21
This commit is contained in:
parent
bce45d2605
commit
ac590e418d
@ -3,6 +3,7 @@ package it.unisannio.ding.ids.wedroid.app.view
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.webkit.URLUtil
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import it.unisannio.ding.ids.wedroid.app.R
|
import it.unisannio.ding.ids.wedroid.app.R
|
||||||
import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper
|
import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper
|
||||||
@ -39,10 +40,17 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
val userNameText = username.text.toString()
|
val userNameText = username.text.toString()
|
||||||
val passwordText = password.text.toString()
|
val passwordText = password.text.toString()
|
||||||
|
val instanceServerText = instanceServer.text.toString()
|
||||||
|
|
||||||
|
if (!URLUtil.isValidUrl(instanceServerText)){
|
||||||
|
Toast.makeText(this, "Formato URL non valido", Toast.LENGTH_LONG)
|
||||||
|
.show()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val service = Retrofit.Builder()
|
val service = Retrofit.Builder()
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
.baseUrl(instanceServer.text.toString())
|
.baseUrl(instanceServerText)
|
||||||
.build()
|
.build()
|
||||||
.create(LoginService::class.java)
|
.create(LoginService::class.java)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user