kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale-android
Porównaj commity
7 Commity
22a72d9e83
...
3ebf11a6f6
Autor | SHA1 | Data |
---|---|---|
Renovate Bot | 3ebf11a6f6 | |
Hugh Daschbach | 5ee798abfb | |
Hugh Daschbach | 6f24535b79 | |
Hugh Daschbach | 467556d75c | |
Renovate Bot | 10035aa5fe | |
Georg Krause | 8b9a1201af | |
Hugh Daschbach | 2088e06a68 |
|
@ -189,8 +189,8 @@ dependencies {
|
|||
implementation("com.google.android.exoplayer:exoplayer-ui: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-android:3.5.0")
|
||||
implementation("io.insert-koin:koin-core:3.5.3")
|
||||
implementation("io.insert-koin:koin-android:3.5.3")
|
||||
testImplementation("io.insert-koin:koin-test:3.5.0")
|
||||
|
||||
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-opus:789a4f83169cff5c7a91655bb828fde2cfde671a") {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,6 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request {
|
|||
this@authorize.apply {
|
||||
if (!Settings.isAnonymous()) {
|
||||
oAuth.state().let { state ->
|
||||
state.accessTokenExpirationTime?.let {
|
||||
Log.i("Request.authorize()", "Accesstoken expiration: ${Date(it).format()}")
|
||||
}
|
||||
val old = state.accessToken
|
||||
val auth = ClientSecretPost(oAuth.state().clientSecret)
|
||||
val done = CompletableDeferred<Boolean>()
|
||||
|
@ -64,10 +61,10 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request {
|
|||
state.performActionWithFreshTokens(tokenService, auth) { token, _, e ->
|
||||
if (e != null) {
|
||||
Log.e("Request.authorize()", "performActionWithFreshToken failed: $e")
|
||||
Log.e("Request.authorize()", Log.getStackTraceString(e))
|
||||
}
|
||||
if (token == old) {
|
||||
Log.i("Request.authorize()", "Accesstoken not renewed")
|
||||
if (e.type != 2 || e.code != 2002) {
|
||||
Log.e("Request.authorize()", Log.getStackTraceString(e))
|
||||
EventBus.send(Event.LogOut)
|
||||
}
|
||||
}
|
||||
if (token != old && token != null) {
|
||||
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
|
||||
|
|
|
@ -83,7 +83,7 @@ class OAuth(private val authorizationServiceFactory: AuthorizationServiceFactory
|
|||
refreshAccessToken(state, context)
|
||||
} else {
|
||||
state.isAuthorized
|
||||
}.also { it.logInfo("tryRefreshAccessToken()") }
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ class OAuth(private val authorizationServiceFactory: AuthorizationServiceFactory
|
|||
if (e != null) {
|
||||
Log.e("OAuth", "performTokenRequest failed: $e")
|
||||
Log.e("OAuth", Log.getStackTraceString(e))
|
||||
EventBus.send(Event.LogOut)
|
||||
} else {
|
||||
state.apply {
|
||||
Log.i("OAuth", "applying new authState")
|
||||
|
|
|
@ -74,7 +74,9 @@ class NowPlayingBottomSheet @JvmOverloads constructor(
|
|||
|
||||
override fun show() {
|
||||
behavior.isHideable = false
|
||||
close()
|
||||
if (behavior.state == BottomSheetBehavior.STATE_HIDDEN) {
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
override fun hide() {
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_margin="8dp"
|
||||
android:contentDescription="@string/control_add_to_favorties"
|
||||
android:contentDescription="@string/control_add_to_favorites"
|
||||
android:src="@drawable/favorite"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/current_playing_details_artist"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -158,4 +158,4 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/now_playing_details_progress"
|
||||
app:tint="@color/controlForeground" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<string name="radio_random_title">Ausazkoa</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="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="filters">Iragazkiak</string>
|
||||
<string name="fiters_all">Musika guztia</string>
|
||||
|
@ -135,4 +135,4 @@
|
|||
<string name="track_info_details_track_title">Pistaren izenburua</string>
|
||||
<string name="control_toggle">Aldatu erreproduzitzea</string>
|
||||
<string name="radio_favorites_description">Erreproduzitu abesti gogokoenak amaierarik gabeko begizta alai batean.</string>
|
||||
</resources>
|
||||
</resources>
|
||||
|
|
|
@ -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="playlist">Liste de lecture</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>
|
||||
</resources>
|
||||
</resources>
|
||||
|
|
|
@ -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="playlist">Lista de reprodución</string>
|
||||
<string name="control_repeat_mode">Modo repetición</string>
|
||||
<string name="control_add_to_favorties">Engadir a favoritos</string>
|
||||
</resources>
|
||||
<string name="control_add_to_favorites">Engadir a favoritos</string>
|
||||
</resources>
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
<string name="control_previous">Previous track</string>
|
||||
<string name="control_next">Next track</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>
|
||||
<plurals name="album_count">
|
||||
<item quantity="one">%d album</item>
|
||||
|
|
|
@ -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