Upgrades dependencies. Enhanced login screen appearance. Fixed a seriously dumb issue where we would not transmit the token to the server.
This commit is contained in:
parent
aad0ec439c
commit
534e48e2c8
|
@ -61,6 +61,10 @@ android {
|
|||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
isDebuggable = true
|
||||
}
|
||||
|
||||
getByName("release") {
|
||||
if (props.hasProperty("signing.store")) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
|
@ -92,17 +96,17 @@ play {
|
|||
dependencies {
|
||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
||||
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.60")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2")
|
||||
|
||||
implementation("androidx.appcompat:appcompat:1.1.0")
|
||||
implementation("androidx.core:core-ktx:1.2.0-beta01")
|
||||
implementation("androidx.coordinatorlayout:coordinatorlayout:1.0.0")
|
||||
implementation("androidx.preference:preference:1.1.0")
|
||||
implementation("androidx.recyclerview:recyclerview:1.0.0")
|
||||
implementation("androidx.core:core-ktx:1.4.0-alpha01")
|
||||
implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
|
||||
implementation("androidx.preference:preference:1.1.1")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
|
||||
implementation("com.google.android.material:material:1.2.0-alpha01")
|
||||
implementation("com.google.android.material:material:1.2.0-alpha06")
|
||||
implementation("com.android.support.constraint:constraint-layout:1.1.3")
|
||||
|
||||
implementation("com.google.android.exoplayer:exoplayer:2.10.5")
|
||||
|
|
|
@ -19,7 +19,7 @@ import kotlinx.coroutines.Dispatchers.Main
|
|||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
data class FwCredentials(val token: String, val non_field_errors: List<String>)
|
||||
data class FwCredentials(val token: String, val non_field_errors: List<String>?)
|
||||
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -111,7 +111,7 @@ class LoginActivity : AppCompatActivity() {
|
|||
hostname_field.error = null
|
||||
username_field.error = null
|
||||
|
||||
if (error != null && error.non_field_errors.isNotEmpty()) {
|
||||
if (error != null && error.non_field_errors?.isNotEmpty() == true) {
|
||||
username_field.error = error.non_field_errors[0]
|
||||
} else {
|
||||
hostname_field.error = result.error.localizedMessage
|
||||
|
|
|
@ -68,7 +68,7 @@ class HttpUpstream<D : Any, R : FunkwhaleResponse<D>>(val behavior: Behavior, pr
|
|||
suspend fun get(url: String): Result<R, FuelError> {
|
||||
val request = Fuel.get(mustNormalizeUrl(url)).apply {
|
||||
if (!Settings.isAnonymous()) {
|
||||
header("Authorization", "Bearer ${Settings.isAnonymous()}")
|
||||
header("Authorization", "Bearer ${Settings.getAccessToken()}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ class HttpUpstream<D : Any, R : FunkwhaleResponse<D>>(val behavior: Behavior, pr
|
|||
return if (HTTP.refresh()) {
|
||||
val request = Fuel.get(mustNormalizeUrl(url)).apply {
|
||||
if (!Settings.isAnonymous()) {
|
||||
header("Authorization", "Bearer ${Settings.isAnonymous()}")
|
||||
header("Authorization", "Bearer ${Settings.getAccessToken()}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.github.apognu.otter.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.github.apognu.otter.activities.FwCredentials
|
||||
import com.github.kittinunf.fuel.Fuel
|
||||
import com.github.kittinunf.fuel.core.FuelError
|
||||
|
|
|
@ -52,6 +52,6 @@ fun toDurationString(seconds: Long): String {
|
|||
|
||||
object Settings {
|
||||
fun hasAccessToken() = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).contains("access_token")
|
||||
fun getAccessToken() = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getString("access_token", "")
|
||||
fun getAccessToken(): String = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getString("access_token", "")
|
||||
fun isAnonymous() = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getBoolean("anonymous", false)
|
||||
}
|
|
@ -1 +1 @@
|
|||
We fixed a blocking issue that would crash the app right after login.
|
||||
Several performance and UX improvements, added preliminary support for landscape mode, and sort track by album position.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Nous avons corrigé un bug où l'app crashait après le login.
|
||||
De multiples améliorations d'UX et de performances, ajout initial du support du mode paysage, and tri des pistes par leur position dans l'album.
|
||||
|
|
|
@ -29,19 +29,20 @@
|
|||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/hostname_field"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:hint="@string/login_hostname"
|
||||
android:textColorHint="@drawable/login_input"
|
||||
app:boxStrokeColor="@drawable/login_input"
|
||||
app:boxBackgroundColor="@color/controlAccent"
|
||||
app:boxBackgroundMode="filled"
|
||||
app:boxStrokeWidth="0dp"
|
||||
app:hintTextColor="@drawable/login_input">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/hostname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/login_hostname"
|
||||
android:inputType="textUri"
|
||||
android:lines="1"
|
||||
android:textColor="@android:color/white"
|
||||
|
@ -53,19 +54,21 @@
|
|||
android:id="@+id/anonymous"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_anonymous"
|
||||
android:buttonTint="@android:color/white"
|
||||
android:textColor="@android:color/white"/>
|
||||
android:text="@string/login_anonymous"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/username_field"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:hint="@string/login_username"
|
||||
android:textColorHint="@drawable/login_input"
|
||||
app:boxBackgroundColor="@color/controlAccent"
|
||||
app:boxBackgroundMode="filled"
|
||||
app:boxStrokeColor="@drawable/login_input"
|
||||
app:boxStrokeWidth="0dp"
|
||||
app:hintTextColor="@drawable/login_input">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
|
@ -81,13 +84,15 @@
|
|||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/password_field"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:hint="@string/login_password"
|
||||
android:textColorHint="@drawable/login_input"
|
||||
app:boxBackgroundColor="@color/controlAccent"
|
||||
app:boxBackgroundMode="filled"
|
||||
app:boxStrokeColor="@drawable/login_input"
|
||||
app:boxStrokeWidth="0dp"
|
||||
app:hintTextColor="@drawable/login_input"
|
||||
app:passwordToggleEnabled="true">
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
<color name="controlForeground">#caffffff</color>
|
||||
<color name="controlColor">#53bce7</color>
|
||||
<color name="controlAccent">#304A5A</color>
|
||||
|
||||
<color name="whiteWhileLight">#000000</color>
|
||||
<color name="blackWhileLight">#ffffff</color>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
<color name="controlForeground">@color/colorPrimary</color>
|
||||
<color name="controlColor">@color/colorPrimary</color>
|
||||
<color name="controlAccent">#22648E</color>
|
||||
|
||||
<color name="whiteWhileLight">#ffffff</color>
|
||||
<color name="blackWhileLight">#000000</color>
|
||||
|
|
Loading…
Reference in New Issue