no presence when not signed in
This commit is contained in:
parent
34a3e9e5a3
commit
ea83b722a6
2 changed files with 40 additions and 31 deletions
|
@ -998,6 +998,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
|
|||
preloading = false
|
||||
val context = this
|
||||
|
||||
if (isOnline(context) && Discord.token != null) {
|
||||
lifecycleScope.launch {
|
||||
val presence = RPC.createPresence(RPC.Companion.RPCData(
|
||||
applicationId = Discord.application_Id,
|
||||
|
@ -1008,7 +1009,12 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
|
|||
ep.number
|
||||
),
|
||||
state = "Episode : ${ep.number}/${media.anime?.totalEpisodes ?: "??"}",
|
||||
largeImage = media.cover?.let { RPC.Link(media.userPreferredName, it) },
|
||||
largeImage = media.cover?.let {
|
||||
RPC.Link(
|
||||
media.userPreferredName,
|
||||
it
|
||||
)
|
||||
},
|
||||
smallImage = RPC.Link(
|
||||
"Dantotsu",
|
||||
Discord.small_Image
|
||||
|
@ -1029,6 +1035,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
|
|||
DiscordServiceRunningSingleton.running = true
|
||||
startService(intent)
|
||||
}
|
||||
}
|
||||
|
||||
updateProgress()
|
||||
}
|
||||
|
@ -1426,9 +1433,11 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
|
|||
exoPlayer.release()
|
||||
VideoCache.release()
|
||||
mediaSession?.release()
|
||||
if(DiscordServiceRunningSingleton.running) {
|
||||
val stopIntent = Intent(this, DiscordService::class.java)
|
||||
DiscordServiceRunningSingleton.running = false
|
||||
stopService(stopIntent)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
|
||||
override fun onDestroy() {
|
||||
mangaCache.clear()
|
||||
if (isOnline(baseContext)) { //TODO:
|
||||
if (DiscordServiceRunningSingleton.running) {
|
||||
DiscordServiceRunningSingleton.running = false
|
||||
val stopIntent = Intent(this, DiscordService::class.java)
|
||||
stopService(stopIntent)
|
||||
|
@ -329,7 +329,7 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
chaptersTitleArr.getOrNull(currentChapterIndex - 1) ?: ""
|
||||
applySettings()
|
||||
val context = this
|
||||
if (isOnline(context)) {
|
||||
if (isOnline(context) && Discord.token != null) {
|
||||
lifecycleScope.launch {
|
||||
val presence = RPC.createPresence(
|
||||
RPC.Companion.RPCData(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue