Skip to content

Commit

Permalink
Merge pull request #966 from Bnyro/master
Browse files Browse the repository at this point in the history
more fixes
  • Loading branch information
Bnyro authored Aug 4, 2022
2 parents 02f0bb5 + 2c22978 commit fd00deb
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class PlayerFragment : Fragment() {
*/
private var videoId: String? = null
private var playlistId: String? = null
private var channelId: String? = null
private var isSubscribed: Boolean? = false
private var isLive = false
private lateinit var streams: Streams
Expand Down Expand Up @@ -1558,8 +1557,9 @@ class PlayerFragment : Fragment() {

private fun isSubscribed() {
fun run() {
val channelId = streams.uploaderUrl.toID()
lifecycleScope.launchWhenCreated {
isSubscribed = SubscriptionHelper.isSubscribed(channelId!!)
isSubscribed = SubscriptionHelper.isSubscribed(channelId)

if (isSubscribed == null) return@launchWhenCreated

Expand All @@ -1569,11 +1569,13 @@ class PlayerFragment : Fragment() {
}
binding.playerSubscribe.setOnClickListener {
if (isSubscribed == true) {
SubscriptionHelper.unsubscribe(channelId!!)
SubscriptionHelper.unsubscribe(channelId)
binding.playerSubscribe.text = getString(R.string.subscribe)
isSubscribed = false
} else {
SubscriptionHelper.subscribe(channelId!!)
SubscriptionHelper.subscribe(channelId)
binding.playerSubscribe.text = getString(R.string.unsubscribe)
isSubscribed = true
}
}
}
Expand Down

0 comments on commit fd00deb

Please sign in to comment.