Remember hostname of last login.
Seed the login screen with saved host name, checkboxes. Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/342>
This commit is contained in:
parent
6f24535b79
commit
5ee798abfb
|
@ -1,9 +1,11 @@
|
||||||
package audio.funkwhale.ffa.activities
|
package audio.funkwhale.ffa.activities
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.Editable
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
|
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
@ -64,6 +66,13 @@ class LoginActivity : AppCompatActivity() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
with(binding) {
|
with(binding) {
|
||||||
|
val preferences = getPreferences(Context.MODE_PRIVATE)
|
||||||
|
val hn = preferences?.getString("hostname", "")
|
||||||
|
if (hn != null && !hn.isEmpty()) {
|
||||||
|
hostname.text = Editable.Factory.getInstance().newEditable(hn)
|
||||||
|
}
|
||||||
|
cleartext.setChecked(preferences?.getBoolean("cleartext", false) ?: false)
|
||||||
|
anonymous.setChecked(preferences?.getBoolean("anonymous", false) ?: false)
|
||||||
login.setOnClickListener {
|
login.setOnClickListener {
|
||||||
var hostname = hostname.text.toString().trim().trim('/')
|
var hostname = hostname.text.toString().trim().trim('/')
|
||||||
|
|
||||||
|
@ -96,6 +105,12 @@ class LoginActivity : AppCompatActivity() {
|
||||||
|
|
||||||
hostnameField.error = message
|
hostnameField.error = message
|
||||||
}
|
}
|
||||||
|
if (hostnameField.error == null) {
|
||||||
|
val preferences = getPreferences(Context.MODE_PRIVATE)
|
||||||
|
preferences?.edit()?.putString("hostname", hostname)?.commit()
|
||||||
|
preferences?.edit()?.putBoolean("cleartext", cleartext.isChecked)?.commit()
|
||||||
|
preferences?.edit()?.putBoolean("anonymous", anonymous.isChecked)?.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Log user out when authorization token expires (#154)
|
|
@ -0,0 +1 @@
|
||||||
|
Remember server settings in login dialog (#154)
|
Loading…
Reference in New Issue