mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
update
This commit is contained in:
parent
ee4517093f
commit
1ae7307892
3 changed files with 15 additions and 3 deletions
|
@ -82,6 +82,7 @@ import com.lagradost.cloudstream3.ui.setup.SetupFragmentExtensions
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.html
|
import com.lagradost.cloudstream3.utils.AppUtils.html
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.isNetworkAvailable
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.loadCache
|
import com.lagradost.cloudstream3.utils.AppUtils.loadCache
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.loadRepository
|
import com.lagradost.cloudstream3.utils.AppUtils.loadRepository
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.loadResult
|
import com.lagradost.cloudstream3.utils.AppUtils.loadResult
|
||||||
|
@ -720,15 +721,15 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
changeStatusBarState(isEmulatorSettings())
|
changeStatusBarState(isEmulatorSettings())
|
||||||
|
|
||||||
// Automatically enable jsdelivr if cant connect to raw.githubusercontent.com
|
// Automatically enable jsdelivr if cant connect to raw.githubusercontent.com
|
||||||
if (!settingsManager.contains("jsdelivr_proxy_key")) {
|
if (!settingsManager.contains("jsdelivr_proxy_key") && isNetworkAvailable()) {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
if (checkGithubConnectivity()) {
|
if (checkGithubConnectivity()) {
|
||||||
setKey("jsdelivr_proxy_key", false)
|
setKey("jsdelivr_proxy_key", false)
|
||||||
} else {
|
} else {
|
||||||
setKey("jsdelivr_proxy_key", true)
|
setKey("jsdelivr_proxy_key", true)
|
||||||
val parentView = findViewById(android.R.id.content)
|
val parentView = findViewById(android.R.id.content)
|
||||||
Snackbar.make(parentView, getString(R.string.jsdelivr_enabled), Snackbar.LENGTH_LONG)
|
Snackbar.make(parentView, R.string.jsdelivr_enabled, Snackbar.LENGTH_LONG)
|
||||||
.setAction("Revert", v -> {
|
.setAction(R.string.revert, v -> {
|
||||||
setKey("jsdelivr_proxy_key", false)
|
setKey("jsdelivr_proxy_key", false)
|
||||||
})
|
})
|
||||||
.setBackgroundTint(ContextCompat.getColor(this@MainActivity, R.color.primaryGrayBackground))
|
.setBackgroundTint(ContextCompat.getColor(this@MainActivity, R.color.primaryGrayBackground))
|
||||||
|
|
|
@ -456,6 +456,16 @@ object AppUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Context.isNetworkAvailable(): Boolean {
|
||||||
|
val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
|
val activeNetworkInfo = manager.activeNetworkInfo
|
||||||
|
var connected = activeNetworkInfo != null && activeNetworkInfo.isConnected
|
||||||
|
if (!connected) {
|
||||||
|
connected = manager.allNetworkInfo?.any { it.isConnected } ?: false
|
||||||
|
}
|
||||||
|
return connected
|
||||||
|
}
|
||||||
|
|
||||||
fun splitQuery(url: URL): Map<String, String> {
|
fun splitQuery(url: URL): Map<String, String> {
|
||||||
val queryPairs: MutableMap<String, String> = LinkedHashMap()
|
val queryPairs: MutableMap<String, String> = LinkedHashMap()
|
||||||
val query: String = url.query
|
val query: String = url.query
|
||||||
|
|
|
@ -640,4 +640,5 @@
|
||||||
<string name="empty_library_no_accounts_message">Looks like your library is empty :(\nLogin to a library account or add shows to your local library</string>
|
<string name="empty_library_no_accounts_message">Looks like your library is empty :(\nLogin to a library account or add shows to your local library</string>
|
||||||
<string name="empty_library_logged_in_message">Looks like this list is empty, try switching to another one</string>
|
<string name="empty_library_logged_in_message">Looks like this list is empty, try switching to another one</string>
|
||||||
<string name="safe_mode_file">Safe mode file found!\nNot loading any extensions on startup until file is removed.</string>
|
<string name="safe_mode_file">Safe mode file found!\nNot loading any extensions on startup until file is removed.</string>
|
||||||
|
<string name="revert">Revert</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Add table
Add a link
Reference in a new issue