Skip to content

Commit

Permalink
Merge pull request #4546 from Bnyro/master
Browse files Browse the repository at this point in the history
feat: show if instance registration disabled in welcome page
  • Loading branch information
Bnyro authored Aug 19, 2023
2 parents 694e317 + 0f1e50e commit f1ae519
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/src/main/java/com/github/libretube/api/obj/Instances.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ data class Instances(
@SerialName("up_to_date") val upToDate: Boolean = true,
val cdn: Boolean = false,
val registered: Long = 0,
@SerialName("last_checked") val lastChecked: Long = 0
@SerialName("last_checked") val lastChecked: Long = 0,
@SerialName("cache") val chache: Boolean = false,
@SerialName("s3_enabled") val s3Enabled: Boolean = false,
@SerialName("image_proxy_url") val imageProxyUrl: String = "",
@SerialName("registration_disabled") val registrationDisabled: Boolean = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.api.obj.Instances
import com.github.libretube.databinding.InstanceRowBinding
import com.github.libretube.ui.models.WelcomeModel
Expand All @@ -28,8 +29,11 @@ class InstancesAdapter(
override fun onBindViewHolder(holder: InstancesViewHolder, position: Int) {
val instance = instances[position]
holder.binding.apply {
val cdnText = if (instance.cdn) " (\uD83C\uDF10 CDN)" else ""
radioButton.text = "${instance.name} ${instance.locations} $cdnText"
var instanceText = "${instance.name} ${instance.locations}"
if (instance.cdn) instanceText += " (\uD83C\uDF10 CDN)"
if (instance.registrationDisabled) instanceText +=
" (${root.context.getString(R.string.registration_disabled)})"
radioButton.text = instanceText
radioButton.setOnCheckedChangeListener(null)
radioButton.isChecked = selectedInstanceIndex == position
radioButton.setOnCheckedChangeListener { _, isChecked ->
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@
<string name="screen_orientation">Screen orientation</string>
<string name="auto_generated">auto-generated</string>
<string name="resolution_limited">limited</string>
<string name="registration_disabled">Registration disabled</string>
<!-- Notification channel strings -->
<string name="download_channel_name">Download Service</string>
<string name="download_channel_description">Shows a notification when downloading media.</string>
Expand Down

0 comments on commit f1ae519

Please sign in to comment.