mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Merge pull request #3145 from Bnyro/master
Fix that kavin.rocks is not shown as selected by default
This commit is contained in:
commit
23ba2f2503
@ -33,8 +33,8 @@ const val YOUTUBE_FRONTEND_URL = "https://www.youtube.com"
|
||||
/**
|
||||
* Retrofit Instance
|
||||
*/
|
||||
const val PIPED_API_URL = "https://pipedapi.kavin.rocks/"
|
||||
const val PIPED_INSTANCES_URL = "https://piped-instances.kavin.rocks/"
|
||||
const val PIPED_API_URL = "https://pipedapi.kavin.rocks"
|
||||
const val PIPED_INSTANCES_URL = "https://piped-instances.kavin.rocks"
|
||||
const val FALLBACK_INSTANCES_URL = "https://instances.tokhmi.xyz"
|
||||
|
||||
/**
|
||||
|
@ -122,6 +122,19 @@ class InstanceSettings : BasePreferenceFragment() {
|
||||
|
||||
private fun initInstancesPref(instancePrefs: List<ListPreference>) {
|
||||
val appContext = requireContext().applicationContext
|
||||
|
||||
instancePrefs.forEach { instancePref ->
|
||||
if (instancePref.entry.isNullOrBlank()) {
|
||||
instancePref.value = context?.resources?.getStringArray(R.array.instancesValue)?.first().orEmpty()
|
||||
}
|
||||
|
||||
instancePref.summaryProvider =
|
||||
Preference.SummaryProvider<ListPreference> { preference ->
|
||||
preference.entry.takeIf { !it.isNullOrBlank() }
|
||||
?: context?.resources?.getStringArray(R.array.instances)?.first().orEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
lifecycleScope.launchWhenCreated {
|
||||
val customInstances = withContext(Dispatchers.IO) {
|
||||
Database.customInstanceDao().getAll()
|
||||
@ -151,10 +164,6 @@ class InstanceSettings : BasePreferenceFragment() {
|
||||
// add custom instances to the list preference
|
||||
instancePref.entries = instances.map { it.name }.toTypedArray()
|
||||
instancePref.entryValues = instances.map { it.apiUrl }.toTypedArray()
|
||||
instancePref.summaryProvider =
|
||||
Preference.SummaryProvider<ListPreference> { preference ->
|
||||
preference.entry
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,16 +13,16 @@
|
||||
<item>privacy.com.de</item>
|
||||
</string-array>
|
||||
<string-array name="instancesValue">
|
||||
<item>https://pipedapi.kavin.rocks/</item>
|
||||
<item>https://pipedapi.tokhmi.xyz/</item>
|
||||
<item>https://pipedapi.moomoo.me/</item>
|
||||
<item>https://pa.mint.lgbt/</item>
|
||||
<item>https://pa.il.ax/</item>
|
||||
<item>https://pipedapi.syncpundit.com/</item>
|
||||
<item>https://api-piped.mha.fi/</item>
|
||||
<item>https://api-piped.shimul.me/</item>
|
||||
<item>https://api.yt.jae.fi/</item>
|
||||
<item>https://piped-api.privacy.com.de/</item>
|
||||
<item>https://pipedapi.kavin.rocks</item>
|
||||
<item>https://pipedapi.tokhmi.xyz</item>
|
||||
<item>https://pipedapi.moomoo.me</item>
|
||||
<item>https://pa.mint.lgbt</item>
|
||||
<item>https://pa.il.ax</item>
|
||||
<item>https://pipedapi.syncpundit.com</item>
|
||||
<item>https://api-piped.mha.fi</item>
|
||||
<item>https://api-piped.shimul.me</item>
|
||||
<item>https://api.yt.jae.fi</item>
|
||||
<item>https://piped-api.privacy.com.de</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="languages">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<ListPreference
|
||||
android:icon="@drawable/ic_server"
|
||||
app:defaultValue="https://pipedapi.kavin.rocks/"
|
||||
app:defaultValue="https://pipedapi.kavin.rocks"
|
||||
app:entries="@array/instances"
|
||||
app:entryValues="@array/instancesValue"
|
||||
app:key="selectInstance"
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
<ListPreference
|
||||
android:icon="@drawable/ic_server"
|
||||
app:defaultValue="https://pipedapi.kavin.rocks/"
|
||||
app:defaultValue="https://pipedapi.kavin.rocks"
|
||||
app:entries="@array/instances"
|
||||
app:entryValues="@array/instancesValue"
|
||||
app:key="selectAuthInstance"
|
||||
|
Loading…
Reference in New Issue
Block a user