Porównaj commity

...

7 Commity

Autor SHA1 Wiadomość Data
Renovate Bot 3ebf11a6f6 chore(deps): update dependency io.insert-koin:koin-core to v3.5.3
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/346>
2024-02-22 18:24:22 +00:00
Hugh Daschbach 5ee798abfb 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>
2024-02-22 18:15:04 +00:00
Hugh Daschbach 6f24535b79 Auto logout on unrecoverable authentication error.
When an unrecoverable authentication error occurs, automatically log
the user out.  This seems better than leaving the user wondering why
the UI is unresponsive or why each track they try to play fails with a
quickly disappearing toast.

Unrecoverable authentication errors typically mean the server has
timed out the session out or the session token has been deleted on the
server.  Tokens expire after 14 days without use.

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/342>
2024-02-22 18:15:04 +00:00
Hugh Daschbach 467556d75c Suppress some authentication noise in the log.
Most of this was added to debug issue !102.  So these are vestigial.

The exception here is the handling of AuthorizationException type 2.
These are produced by racing authentication requests and are
successfully managed.  So we need not report these.

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/342>
2024-02-22 18:15:04 +00:00
Renovate Bot 10035aa5fe chore(deps): update dependency io.insert-koin:koin-android to v3.5.3
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/345>
2024-02-22 09:44:21 +00:00
Georg Krause 8b9a1201af fix(copy): Use correct spelling of favorites
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/344>
2024-02-22 09:35:03 +00:00
Hugh Daschbach 2088e06a68 Do not close NowPlayingBottomSheet between tracks.
If the user opens the NowPlayingBottomSheet whilst playing a non empty
queue, leave the BottomSheet open at the end of the playing track.

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/343>
2024-02-21 21:59:28 -08:00
12 zmienionych plików z 38 dodań i 21 usunięć

Wyświetl plik

@ -189,8 +189,8 @@ dependencies {
implementation("com.google.android.exoplayer:exoplayer-ui:2.18.1") implementation("com.google.android.exoplayer:exoplayer-ui:2.18.1")
implementation("com.google.android.exoplayer:extension-mediasession:2.18.1") implementation("com.google.android.exoplayer:extension-mediasession:2.18.1")
implementation("io.insert-koin:koin-core:3.5.0") implementation("io.insert-koin:koin-core:3.5.3")
implementation("io.insert-koin:koin-android:3.5.0") implementation("io.insert-koin:koin-android:3.5.3")
testImplementation("io.insert-koin:koin-test:3.5.0") testImplementation("io.insert-koin:koin-test:3.5.0")
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-opus:789a4f83169cff5c7a91655bb828fde2cfde671a") { implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-opus:789a4f83169cff5c7a91655bb828fde2cfde671a") {

Wyświetl plik

@ -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()
}
} }
} }
} }

Wyświetl plik

@ -53,9 +53,6 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request {
this@authorize.apply { this@authorize.apply {
if (!Settings.isAnonymous()) { if (!Settings.isAnonymous()) {
oAuth.state().let { state -> oAuth.state().let { state ->
state.accessTokenExpirationTime?.let {
Log.i("Request.authorize()", "Accesstoken expiration: ${Date(it).format()}")
}
val old = state.accessToken val old = state.accessToken
val auth = ClientSecretPost(oAuth.state().clientSecret) val auth = ClientSecretPost(oAuth.state().clientSecret)
val done = CompletableDeferred<Boolean>() val done = CompletableDeferred<Boolean>()
@ -64,10 +61,10 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request {
state.performActionWithFreshTokens(tokenService, auth) { token, _, e -> state.performActionWithFreshTokens(tokenService, auth) { token, _, e ->
if (e != null) { if (e != null) {
Log.e("Request.authorize()", "performActionWithFreshToken failed: $e") Log.e("Request.authorize()", "performActionWithFreshToken failed: $e")
Log.e("Request.authorize()", Log.getStackTraceString(e)) if (e.type != 2 || e.code != 2002) {
} Log.e("Request.authorize()", Log.getStackTraceString(e))
if (token == old) { EventBus.send(Event.LogOut)
Log.i("Request.authorize()", "Accesstoken not renewed") }
} }
if (token != old && token != null) { if (token != old && token != null) {
state.save() state.save()
@ -150,4 +147,4 @@ inline fun <T, U, V, W, R> LiveData<T>.mergeWith(
} }
} }
public fun String?.toIntOrElse(default: Int): Int = this?.toIntOrNull(radix = 10) ?: default public fun String?.toIntOrElse(default: Int): Int = this?.toIntOrNull(radix = 10) ?: default

Wyświetl plik

@ -83,7 +83,7 @@ class OAuth(private val authorizationServiceFactory: AuthorizationServiceFactory
refreshAccessToken(state, context) refreshAccessToken(state, context)
} else { } else {
state.isAuthorized state.isAuthorized
}.also { it.logInfo("tryRefreshAccessToken()") } }
} }
return false return false
} }
@ -103,6 +103,7 @@ class OAuth(private val authorizationServiceFactory: AuthorizationServiceFactory
if (e != null) { if (e != null) {
Log.e("OAuth", "performTokenRequest failed: $e") Log.e("OAuth", "performTokenRequest failed: $e")
Log.e("OAuth", Log.getStackTraceString(e)) Log.e("OAuth", Log.getStackTraceString(e))
EventBus.send(Event.LogOut)
} else { } else {
state.apply { state.apply {
Log.i("OAuth", "applying new authState") Log.i("OAuth", "applying new authState")

Wyświetl plik

@ -74,7 +74,9 @@ class NowPlayingBottomSheet @JvmOverloads constructor(
override fun show() { override fun show() {
behavior.isHideable = false behavior.isHideable = false
close() if (behavior.state == BottomSheetBehavior.STATE_HIDDEN) {
close()
}
} }
override fun hide() { override fun hide() {

Wyświetl plik

@ -65,7 +65,7 @@
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_margin="8dp" android:layout_margin="8dp"
android:contentDescription="@string/control_add_to_favorties" android:contentDescription="@string/control_add_to_favorites"
android:src="@drawable/favorite" android:src="@drawable/favorite"
app:layout_constraintBottom_toBottomOf="@+id/current_playing_details_artist" app:layout_constraintBottom_toBottomOf="@+id/current_playing_details_artist"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -158,4 +158,4 @@
app:layout_constraintTop_toBottomOf="@+id/now_playing_details_progress" app:layout_constraintTop_toBottomOf="@+id/now_playing_details_progress"
app:tint="@color/controlForeground" /> app:tint="@color/controlForeground" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

Wyświetl plik

@ -81,7 +81,7 @@
<string name="radio_random_title">Ausazkoa</string> <string name="radio_random_title">Ausazkoa</string>
<string name="radio_random_description">Ausaz hautatutakoak, agian zerbait berria aurkituko duzu!</string> <string name="radio_random_description">Ausaz hautatutakoak, agian zerbait berria aurkituko duzu!</string>
<string name="radio_less_listened_title">Gutxien entzundakoak</string> <string name="radio_less_listened_title">Gutxien entzundakoak</string>
<string name="control_add_to_favorties">Gehitu gogokoenetara</string> <string name="control_add_to_favorites">Gehitu gogokoenetara</string>
<string name="playlist_added_to">%s zerrendan gehitu da</string> <string name="playlist_added_to">%s zerrendan gehitu da</string>
<string name="filters">Iragazkiak</string> <string name="filters">Iragazkiak</string>
<string name="fiters_all">Musika guztia</string> <string name="fiters_all">Musika guztia</string>
@ -135,4 +135,4 @@
<string name="track_info_details_track_title">Pistaren izenburua</string> <string name="track_info_details_track_title">Pistaren izenburua</string>
<string name="control_toggle">Aldatu erreproduzitzea</string> <string name="control_toggle">Aldatu erreproduzitzea</string>
<string name="radio_favorites_description">Erreproduzitu abesti gogokoenak amaierarik gabeko begizta alai batean.</string> <string name="radio_favorites_description">Erreproduzitu abesti gogokoenak amaierarik gabeko begizta alai batean.</string>
</resources> </resources>

Wyświetl plik

@ -136,6 +136,6 @@
<string name="settings_auto_skip_backwards_on_pause_summary">Nombre de secondes à revenir en arrière lorsque la lecture est en pause</string> <string name="settings_auto_skip_backwards_on_pause_summary">Nombre de secondes à revenir en arrière lorsque la lecture est en pause</string>
<string name="playlist">Liste de lecture</string> <string name="playlist">Liste de lecture</string>
<string name="hello_blank_fragment">Bonjour, fragment vide</string> <string name="hello_blank_fragment">Bonjour, fragment vide</string>
<string name="control_add_to_favorties">Ajouter aux favoris</string> <string name="control_add_to_favorites">Ajouter aux favoris</string>
<string name="control_repeat_mode">Mode répétition</string> <string name="control_repeat_mode">Mode répétition</string>
</resources> </resources>

Wyświetl plik

@ -133,5 +133,5 @@
<string name="settings_auto_skip_backwards_on_pause_summary">Número de segundos a rebobinar cando se pausou a reprodución</string> <string name="settings_auto_skip_backwards_on_pause_summary">Número de segundos a rebobinar cando se pausou a reprodución</string>
<string name="playlist">Lista de reprodución</string> <string name="playlist">Lista de reprodución</string>
<string name="control_repeat_mode">Modo repetición</string> <string name="control_repeat_mode">Modo repetición</string>
<string name="control_add_to_favorties">Engadir a favoritos</string> <string name="control_add_to_favorites">Engadir a favoritos</string>
</resources> </resources>

Wyświetl plik

@ -82,7 +82,7 @@
<string name="control_previous">Previous track</string> <string name="control_previous">Previous track</string>
<string name="control_next">Next track</string> <string name="control_next">Next track</string>
<string name="control_repeat_mode">Repeat mode</string> <string name="control_repeat_mode">Repeat mode</string>
<string name="control_add_to_favorties">Add to favorties</string> <string name="control_add_to_favorites">Add to favorites</string>
<string name="error_playback">This track could not be played</string> <string name="error_playback">This track could not be played</string>
<plurals name="album_count"> <plurals name="album_count">
<item quantity="one">%d album</item> <item quantity="one">%d album</item>

Wyświetl plik

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

Wyświetl plik

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