feat(Settings): Toggleable RPC (#513)
This commit is contained in:
parent
3071f88681
commit
b703337a16
7 changed files with 29 additions and 3 deletions
|
@ -1309,7 +1309,8 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
|||
val ep = episode
|
||||
val offline: Boolean = PrefManager.getVal(PrefName.OfflineMode)
|
||||
val incognito: Boolean = PrefManager.getVal(PrefName.Incognito)
|
||||
if ((isOnline(context) && !offline) && Discord.token != null && !incognito) {
|
||||
val rpcenabled: Boolean = PrefManager.getVal(PrefName.rpcEnabled)
|
||||
if ((isOnline(context) && !offline) && Discord.token != null && !incognito && rpcenabled) {
|
||||
lifecycleScope.launch {
|
||||
val discordMode = PrefManager.getCustomVal("discord_mode", "dantotsu")
|
||||
val buttons = when (discordMode) {
|
||||
|
|
|
@ -414,7 +414,8 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
val context = this
|
||||
val offline: Boolean = PrefManager.getVal(PrefName.OfflineMode)
|
||||
val incognito: Boolean = PrefManager.getVal(PrefName.Incognito)
|
||||
if ((isOnline(context) && !offline) && Discord.token != null && !incognito) {
|
||||
val rpcenabled: Boolean = PrefManager.getVal(PrefName.rpcEnabled)
|
||||
if ((isOnline(context) && !offline) && Discord.token != null && !incognito && rpcenabled) {
|
||||
lifecycleScope.launch {
|
||||
val discordMode = PrefManager.getCustomVal("discord_mode", "dantotsu")
|
||||
val buttons = when (discordMode) {
|
||||
|
|
|
@ -209,6 +209,17 @@ class SettingsAccountActivity : AppCompatActivity() {
|
|||
}
|
||||
binding.settingsRecyclerView.adapter = SettingsAdapter(
|
||||
arrayListOf(
|
||||
Settings(
|
||||
type = 2,
|
||||
name = getString(R.string.enable_rpc),
|
||||
desc = getString(R.string.enable_rpc_desc),
|
||||
icon = R.drawable.interests_24,
|
||||
isChecked = PrefManager.getVal(PrefName.rpcEnabled),
|
||||
switch = { isChecked, _ ->
|
||||
PrefManager.setVal(PrefName.rpcEnabled, isChecked)
|
||||
},
|
||||
isVisible = Discord.token != null
|
||||
),
|
||||
Settings(
|
||||
type = 1,
|
||||
name = getString(R.string.anilist_settings),
|
||||
|
|
|
@ -193,6 +193,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
|||
DownloadsDir(Pref(Location.Irrelevant, String::class, "")),
|
||||
OC(Pref(Location.Irrelevant, Boolean::class, false)),
|
||||
RefreshStatus(Pref(Location.Irrelevant, Boolean::class, false)),
|
||||
rpcEnabled(Pref(Location.Irrelevant, Boolean::class, true)),
|
||||
|
||||
//Protected
|
||||
DiscordToken(Pref(Location.Protected, String::class, "")),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue