mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
add snackbar and fix blocking
This commit is contained in:
parent
be2eec7ee9
commit
9a7401c77a
2 changed files with 19 additions and 3 deletions
|
@ -32,6 +32,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
|||
import com.google.android.gms.cast.framework.*
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.google.android.material.navigationrail.NavigationRailView
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.jaredrummler.android.colorpicker.ColorPickerDialogListener
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.APIHolder.allProviders
|
||||
|
@ -719,9 +720,23 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
|
||||
// Automatically enable jsdelivr if cant connect to raw.githubusercontent.com
|
||||
if (!settingsManager.contains("jsdelivr_proxy_key")) {
|
||||
settingsManager.edit()
|
||||
.putBool("jsdelivr_proxy_key", !checkGithubConnectivity())
|
||||
.apply()
|
||||
runBlocking {
|
||||
if (checkGithubConnectivity()) {
|
||||
setKey("jsdelivr_proxy_key", false)
|
||||
} else {
|
||||
setKey("jsdelivr_proxy_key", true)
|
||||
val parentView = findViewById(android.R.id.content)
|
||||
Snackbar.make(parentView, getString(R.string.jsdelivr_enabled), Snackbar.LENGTH_LONG)
|
||||
.setAction("Revert", v -> {
|
||||
setKey("jsdelivr_proxy_key", false)
|
||||
})
|
||||
.setBackgroundTint(0xffffbb33)
|
||||
.setTextColor(Color.BLACK)
|
||||
.setActionTextColor(Color.BLACK)
|
||||
.show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -374,6 +374,7 @@
|
|||
<string name="dns_pref">DNS over HTTPS</string>
|
||||
<string name="dns_pref_summary">Useful for bypassing ISP blocks</string>
|
||||
<string name="jsdelivr_proxy">raw.githubusercontent.com Proxy</string>
|
||||
<string name="jsdelivr_enabled">Failed to reach GitHub, enabling jsdelivr proxy.</string>
|
||||
<string name="jsdelivr_proxy_summary">Bypasses blocking of GitHub using jsdelivr, may cause updates to be delayed by few days.</string>
|
||||
<string name="add_site_pref">Clone site</string>
|
||||
<string name="remove_site_pref">Remove site</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue