|
@@ -7,9 +7,6 @@ import android.util.Log
|
|
|
import androidx.lifecycle.LiveData
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
import androidx.lifecycle.ViewModel
|
|
|
-import androidx.lifecycle.viewModelScope
|
|
|
-import com.google.gson.Gson
|
|
|
-import com.google.gson.reflect.TypeToken
|
|
|
import com.stealthcopter.networktools.Ping
|
|
|
import com.stealthcopter.networktools.ping.PingResult
|
|
|
import com.stealthcopter.networktools.ping.PingStats
|
|
@@ -20,8 +17,6 @@ import com.vpn.fastestvpnservice.beans.ServerDataGlobal
|
|
|
import com.vpn.fastestvpnservice.beans.ServerProtocol
|
|
|
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.isAlphabetList
|
|
|
import com.vpn.fastestvpnservice.screens.recommendedListFinalGlobal
|
|
|
import com.vpn.fastestvpnservice.screens.recommendedListGlobal
|
|
@@ -30,14 +25,8 @@ import com.vpn.fastestvpnservice.screens.serversGroupListGlobal
|
|
|
import com.vpn.fastestvpnservice.screens.serversListAllGlobal
|
|
|
import com.vpn.fastestvpnservice.screens.serversListFinalGlobal
|
|
|
import com.vpn.fastestvpnservice.screens.serversListGlobal
|
|
|
-import com.vpn.fastestvpnservice.screensTV.serversListGlobalTV
|
|
|
import com.vpn.fastestvpnservice.screens.smartLocationListGlobal
|
|
|
-import com.vpn.fastestvpnservice.sealedClass.ScreenTV
|
|
|
-import kotlinx.coroutines.Dispatchers
|
|
|
-import kotlinx.coroutines.launch
|
|
|
-import kotlinx.coroutines.withContext
|
|
|
-import retrofit2.Call
|
|
|
-import java.lang.reflect.Array
|
|
|
+import com.vpn.fastestvpnservice.screensTV.serversListGlobalTV
|
|
|
|
|
|
class ServerListViewModel(context: Context): ViewModel() {
|
|
|
|
|
@@ -755,11 +744,11 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// tempList.forEachIndexed { index, server ->
|
|
|
-// CalculatePing(server) {
|
|
|
-// server.ping = it
|
|
|
-// }
|
|
|
-// }
|
|
|
+ tempList.forEachIndexed { index, server ->
|
|
|
+ calculatePing(server) {
|
|
|
+ server.ping = it
|
|
|
+ }
|
|
|
+ }
|
|
|
//
|
|
|
// if (toReturn) {
|
|
|
// _mutableLiveDataGetFavList.value = tempList
|
|
@@ -903,6 +892,12 @@ class ServerListViewModel(context: Context): ViewModel() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ tempList.forEachIndexed { index, server ->
|
|
|
+ calculatePing(server) {
|
|
|
+ server.ping = it
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (isAlphabetList.value) {
|
|
|
tempList.sortBy {
|
|
|
it.server_name
|