From 795d50c6452bf7a1398462120aeb23f2005b6cd1 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 25 Sep 2022 10:10:24 +0200 Subject: [PATCH] sort instances --- .../com/github/libretube/ui/preferences/InstanceSettings.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt index 7696e8fe1..0c34906fb 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt @@ -165,12 +165,14 @@ class InstanceSettings : BasePreferenceFragment() { // fetch official public instances val response = try { - RetrofitInstance.externalApi.getInstances() + RetrofitInstance.externalApi.getInstances().toMutableList() } catch (e: Exception) { e.printStackTrace() - emptyList() + mutableListOf() } + response.sortBy { it.name } + response.forEach { if (it.name != null && it.api_url != null) { instanceNames += it.name!!