Skip to content

Commit

Permalink
add login disclaimer support
Browse files Browse the repository at this point in the history
  • Loading branch information
leekleak authored and jarnedemeulemeester committed Apr 27, 2024
1 parent f470cbe commit 73c1d2e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.jdtech.jellyfin.fragments

import android.os.Bundle
import android.text.Html.fromHtml
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -132,6 +133,10 @@ class LoginFragment : Fragment() {
}
}

viewLifecycleOwner.lifecycleScope.launch {
binding.loginDisclaimer.text = fromHtml(viewModel.getLoginDisclaimer(), 0)
}

return binding.root
}

Expand Down
9 changes: 9 additions & 0 deletions app/phone/src/main/res/layout/fragment_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@
android:visibility="invisible" />
</RelativeLayout>

<TextView
android:id="@+id/login_disclaimer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp"
android:textSize="16sp"
tools:text="Sample login disclaimer" />

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jellyfin.sdk.api.client.extensions.authenticateWithQuickConnect
import org.jellyfin.sdk.api.client.extensions.brandingApi
import org.jellyfin.sdk.model.api.AuthenticateUserByName
import org.jellyfin.sdk.model.api.AuthenticationResult
import javax.inject.Inject
Expand Down Expand Up @@ -165,6 +166,8 @@ constructor(
}
}

suspend fun getLoginDisclaimer(): String? = jellyfinApi.api.brandingApi.getBrandingOptions().content.loginDisclaimer

private suspend fun saveAuthenticationResult(authenticationResult: AuthenticationResult) {
val serverInfo by jellyfinApi.systemApi.getPublicSystemInfo()

Expand Down

0 comments on commit 73c1d2e

Please sign in to comment.