Browse Source

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
Hugh Daschbach 5 months ago committed by Marge
parent
commit
5ee798abfb
  1. 15
      app/src/main/java/audio/funkwhale/ffa/activities/LoginActivity.kt
  2. 1
      changes/changelog.d/detect-authorization-expiration.bugfix
  3. 1
      changes/changelog.d/login-remember-form.enhancement

15
app/src/main/java/audio/funkwhale/ffa/activities/LoginActivity.kt

@ -1,9 +1,11 @@ @@ -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() { @@ -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() { @@ -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()
}
}
}
}

1
changes/changelog.d/detect-authorization-expiration.bugfix

@ -0,0 +1 @@ @@ -0,0 +1 @@
Log user out when authorization token expires (#154)

1
changes/changelog.d/login-remember-form.enhancement

@ -0,0 +1 @@ @@ -0,0 +1 @@
Remember server settings in login dialog (#154)
Loading…
Cancel
Save