kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale-android
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>develop
rodzic
6f24535b79
commit
5ee798abfb
|
@ -1,9 +1,11 @@
|
|||
package audio.funkwhale.ffa.activities
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -64,6 +66,13 @@ class LoginActivity : AppCompatActivity() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
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 {
|
||||
var hostname = hostname.text.toString().trim().trim('/')
|
||||
|
||||
|
@ -96,6 +105,12 @@ class LoginActivity : AppCompatActivity() {
|
|||
|
||||
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)
|
Ładowanie…
Reference in New Issue