|
@@ -21,7 +21,9 @@ import com.vpn.fastestvpnservice.beans.ServerResponse
|
|
|
import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
|
|
|
import com.vpn.fastestvpnservice.retrofit.RetrofitNetworkHandling
|
|
|
import com.vpn.fastestvpnservice.retrofit.WebServiceFactory
|
|
|
+import com.vpn.fastestvpnservice.screens.CalculatePing
|
|
|
import com.vpn.fastestvpnservice.screens.isAlphabetList
|
|
|
+import com.vpn.fastestvpnservice.screens.recommendedListFinalGlobal
|
|
|
import com.vpn.fastestvpnservice.screens.recommendedListGlobal
|
|
|
import com.vpn.fastestvpnservice.screens.serverListViewModelSplash
|
|
|
import com.vpn.fastestvpnservice.screens.serversGroupListGlobal
|
|
@@ -116,11 +118,18 @@ 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}")
|
|
|
+ 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}")
|
|
|
+ }
|
|
|
+
|
|
|
if (isAlphabetList.value) {
|
|
|
+ Log.d("test_filter_list", "inside flter: setRecommendedSmartServers")
|
|
|
recommendedListGlobal.sortBy {
|
|
|
it.server_name
|
|
|
}
|
|
@@ -618,7 +627,7 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
|
|
|
}
|
|
|
|
|
|
- fun getFavList(isAlphabet: Boolean = false): ArrayList<Server> {
|
|
|
+ fun getFavList(toReturn: Boolean = false): ArrayList<Server> {
|
|
|
val tempList = ArrayList<Server>()
|
|
|
|
|
|
preferencesHelper.getServerData().let {
|
|
@@ -635,6 +644,16 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// tempList.forEachIndexed { index, server ->
|
|
|
+// CalculatePing(server) {
|
|
|
+// server.ping = it
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (toReturn) {
|
|
|
+// _mutableLiveDataGetFavList.value = tempList
|
|
|
+// }
|
|
|
+
|
|
|
return tempList
|
|
|
}
|
|
|
|
|
@@ -663,7 +682,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)
|