|
@@ -118,15 +118,15 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
sortedDistance.get(i).ping = it
|
|
|
}
|
|
|
recommendedListGlobal.add(sortedDistance.get(i))
|
|
|
- Log.d("recommendedListGlobal", "SS:: server = ${sortedDistance.get(i).server_name} ${sortedDistance.get(i).ping}")
|
|
|
+// Log.d("recommendedListGlobal", "SS:: server = ${sortedDistance.get(i).server_name} ${sortedDistance.get(i).ping}")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
recommendedListFinalGlobal = recommendedListGlobal
|
|
|
|
|
|
- recommendedListFinalGlobal.forEachIndexed { index, server ->
|
|
|
- Log.d("recommendedListGlobal F", "SS:: server = ${server.server_name} ${server.ping}")
|
|
|
- }
|
|
|
+// recommendedListFinalGlobal.forEachIndexed { index, server ->
|
|
|
+// Log.d("recommendedListGlobal F", "SS:: server = ${server.server_name} ${server.ping}")
|
|
|
+// }
|
|
|
|
|
|
// if (isAlphabetList.value) {
|
|
|
// Log.d("test_filter_list", "inside flter: setRecommendedSmartServers")
|
|
@@ -135,7 +135,7 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- Log.d("test_filter_list", "setRecommendedSmartServers")
|
|
|
+// Log.d("test_filter_list", "setRecommendedSmartServers")
|
|
|
_mutableLiveDataGetRecommendedServers.value = recommendedListGlobal
|
|
|
preferencesHelper.setRecommendedList(recommendedListGlobal)
|
|
|
|
|
@@ -244,9 +244,9 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
|
|
|
println("__testing"+entry.value.size +" : "+total_enables+" : "+value.country)
|
|
|
|
|
|
- entry.value.forEachIndexed { indexs, server ->
|
|
|
- Log.d("test_country_servers",server.country + " " + server.server_name.toString())
|
|
|
- }
|
|
|
+// entry.value.forEachIndexed { indexs, server ->
|
|
|
+// Log.d("test_country_servers",server.country + " " + server.server_name.toString())
|
|
|
+// }
|
|
|
|
|
|
// distinctBy.get(index).countryServers = entry.value
|
|
|
|
|
@@ -401,18 +401,18 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
it.protocol.equals(preferencesHelper.getProtocol().title, ignoreCase = true)
|
|
|
}
|
|
|
|
|
|
- serverprotocol.forEachIndexed { index, server ->
|
|
|
- Log.d("filter_streaming_s", "server: ${server.server_name} ${server.country_sort}")
|
|
|
- }
|
|
|
+// serverprotocol.forEachIndexed { index, server ->
|
|
|
+// Log.d("filter_streaming_s", "server: ${server.server_name} ${server.country_sort}")
|
|
|
+// }
|
|
|
|
|
|
var distinctBy: List<Server>
|
|
|
distinctBy = serverprotocol.distinctBy {
|
|
|
it.server_name
|
|
|
}
|
|
|
|
|
|
- distinctBy.forEachIndexed { index, server ->
|
|
|
- Log.d("filter_streaming_p", "server: ${server.server_name} ${server.country_sort}")
|
|
|
- }
|
|
|
+// distinctBy.forEachIndexed { index, server ->
|
|
|
+// Log.d("filter_streaming_p", "server: ${server.server_name} ${server.country_sort}")
|
|
|
+// }
|
|
|
|
|
|
serverprotocol.groupBy(Server::server_name).mapValues { entry ->
|
|
|
for ((index, value) in distinctBy.withIndex()) {
|
|
@@ -530,9 +530,9 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
it.connection_count
|
|
|
}
|
|
|
|
|
|
- tempList2.forEach {
|
|
|
- Log.d("tempList2", it.server_name + " : " + it.connection_count)
|
|
|
- }
|
|
|
+// tempList2.forEach {
|
|
|
+// Log.d("tempList2", it.server_name + " : " + it.connection_count)
|
|
|
+// }
|
|
|
|
|
|
return tempList2[0]
|
|
|
}
|
|
@@ -557,15 +557,14 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
|
|
|
for (i in tempList.indices) {
|
|
|
val obj = tempList[i]
|
|
|
- Log.d("test_ServerProtocol", "${obj.server_name} ${obj.protocol}")
|
|
|
+// Log.d("test_ServerProtocol", "${obj.server_name} ${obj.protocol}")
|
|
|
if (obj.server_name == serverObj.server_name && protocol.title.equals(obj.protocol, ignoreCase = true)) {
|
|
|
server = obj
|
|
|
isServerFound = true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Log.d("test_ServerProtocol", "is? ${server.server_name} $isServerFound")
|
|
|
-
|
|
|
+// Log.d("test_ServerProtocol", "is? ${server.server_name} $isServerFound")
|
|
|
|
|
|
return ServerProtocol(server, isServerFound)
|
|
|
}
|
|
@@ -577,12 +576,12 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
RetrofitNetworkHandling.ResponseCallback<Any> {
|
|
|
override fun onSuccess(call: Call<Any>?, response: Any?) {
|
|
|
try {
|
|
|
- Log.d("test_api_response","Response favAndUnFav = " + response.toString())
|
|
|
+// Log.d("test_api_response","Response favAndUnFav = " + response.toString())
|
|
|
val gson = Gson()
|
|
|
val jsonString = gson.toJson(response)
|
|
|
val type = object : TypeToken<ServerResponse>() {}.type
|
|
|
val data = gson.fromJson<ServerResponse>(jsonString, type)
|
|
|
- Log.d("test_api_response","favAndUnFav = " + response.toString())
|
|
|
+// Log.d("test_api_response","favAndUnFav = " + response.toString())
|
|
|
|
|
|
if (data.error == 0)
|
|
|
{
|
|
@@ -594,7 +593,7 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
mutableLiveDataFavUnFav.value = null
|
|
|
}
|
|
|
} catch (ex: Exception) {
|
|
|
- Log.d("test_api_response","favAndUnFav catch = " + response.toString())
|
|
|
+// Log.d("test_api_response","favAndUnFav catch = " + response.toString())
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -666,7 +665,7 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
|
|
|
tempList.forEachIndexed { index1, server1 ->
|
|
|
calculatePing(server1){
|
|
|
- Log.d("serverInfo_ping", "In: ${server1.server_name} $it")
|
|
|
+// Log.d("serverInfo_ping", "In: ${server1.server_name} $it")
|
|
|
server1.ping = it
|
|
|
}
|
|
|
tempList2.add(server1)
|