sort instances

This commit is contained in:
Bnyro 2022-09-25 10:10:24 +02:00
parent 3911c19a77
commit 795d50c645

View File

@ -165,12 +165,14 @@ class InstanceSettings : BasePreferenceFragment() {
// fetch official public instances // fetch official public instances
val response = try { val response = try {
RetrofitInstance.externalApi.getInstances() RetrofitInstance.externalApi.getInstances().toMutableList()
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
emptyList() mutableListOf()
} }
response.sortBy { it.name }
response.forEach { response.forEach {
if (it.name != null && it.api_url != null) { if (it.name != null && it.api_url != null) {
instanceNames += it.name!! instanceNames += it.name!!