Fixed proxy issues when starting a new multiplayer game (#6757)

* vpn/proxy issues when creating new mp game

replaced redundant ping with opening a connection to dropbox to fix the proxy issue

* updated error message to include dropbox

* check multiplayerServer url if the user is playing on it

* use `https://content.dropboxapi.com` instead of `https://www.dropbox.com`

* fixed proxy issues on android

if connected to proxy but no internet access it will freeze for a couple seconds (until it finishes the for loop) but it works

* forgot to add the imports

* removed android sdk network check to fix proxy issues

* check for internet now separate from check for multiplayerServer
removed frunctions from PlatformSpecificHelpers__

* added improvements made by touhidurrr

* removed unused imports and replaced setter with property access syntax

Co-authored-by: Md. Touhidur Rahman <46617994+touhidurrr@users.noreply.github.com>
This commit is contained in:
alexban011
2022-05-11 16:58:20 +03:00
committed by GitHub
parent e348a20d2e
commit dc8dadfcab
4 changed files with 25 additions and 31 deletions

View File

@ -1,10 +1,7 @@
package com.unciv.app
import android.app.Activity
import android.content.Context
import android.content.pm.ActivityInfo
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import com.unciv.ui.utils.GeneralPlatformSpecificHelpers
/** See also interface [GeneralPlatformSpecificHelpers].
@ -32,15 +29,4 @@ Sources for Info about current orientation in case need:
// Comparison ensures ActivityTaskManager.getService().setRequestedOrientation isn't called unless necessary
if (activity.requestedOrientation != orientation) activity.requestedOrientation = orientation
}
override fun isInternetConnected(): Boolean {
val connectivityManager = activity.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
for (network in connectivityManager.allNetworks) {
val networkCapabilities = connectivityManager.getNetworkCapabilities(network) ?: continue
val isInternet = networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
val info = connectivityManager.getNetworkInfo(network) ?: continue
if (isInternet && info.isConnected) return true
}
return false
}
}