mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-29 21:10:24 +02:00
Channel membership support and live chat donation support fix
This commit is contained in:
parent
c47ca369e4
commit
5285eae01d
@ -159,13 +159,27 @@ class FilterCapability {
|
|||||||
|
|
||||||
|
|
||||||
class PlatformAuthorLink {
|
class PlatformAuthorLink {
|
||||||
constructor(id, name, url, thumbnail, subscribers) {
|
constructor(id, name, url, thumbnail, subscribers, membershipUrl) {
|
||||||
this.id = id ?? PlatformID(); //PlatformID
|
this.id = id ?? PlatformID(); //PlatformID
|
||||||
this.name = name ?? ""; //string
|
this.name = name ?? ""; //string
|
||||||
this.url = url ?? ""; //string
|
this.url = url ?? ""; //string
|
||||||
this.thumbnail = thumbnail; //string
|
this.thumbnail = thumbnail; //string
|
||||||
if(subscribers)
|
if(subscribers)
|
||||||
this.subscribers = subscribers;
|
this.subscribers = subscribers;
|
||||||
|
if(membershipUrl)
|
||||||
|
this.membershipUrl = membershipUrl ?? null; //string (for backcompat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class PlatformAuthorMembershipLink {
|
||||||
|
constructor(id, name, url, thumbnail, subscribers, membershipUrl) {
|
||||||
|
this.id = id ?? PlatformID(); //PlatformID
|
||||||
|
this.name = name ?? ""; //string
|
||||||
|
this.url = url ?? ""; //string
|
||||||
|
this.thumbnail = thumbnail; //string
|
||||||
|
if(subscribers)
|
||||||
|
this.subscribers = subscribers;
|
||||||
|
if(membershipUrl)
|
||||||
|
this.membershipUrl = membershipUrl ?? null; //string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class PlatformContent {
|
class PlatformContent {
|
||||||
|
@ -10,7 +10,7 @@ import com.futo.platformplayer.getOrThrow
|
|||||||
* A link to a channel, often with its own name and thumbnail
|
* A link to a channel, often with its own name and thumbnail
|
||||||
*/
|
*/
|
||||||
@kotlinx.serialization.Serializable
|
@kotlinx.serialization.Serializable
|
||||||
class PlatformAuthorLink {
|
open class PlatformAuthorLink {
|
||||||
val id: PlatformID;
|
val id: PlatformID;
|
||||||
val name: String;
|
val name: String;
|
||||||
val url: String;
|
val url: String;
|
||||||
@ -28,6 +28,9 @@ class PlatformAuthorLink {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun fromV8(config: SourcePluginConfig, value: V8ValueObject): PlatformAuthorLink {
|
fun fromV8(config: SourcePluginConfig, value: V8ValueObject): PlatformAuthorLink {
|
||||||
|
if(value.has("membershipUrl"))
|
||||||
|
return PlatformAuthorMembershipLink.fromV8(config, value);
|
||||||
|
|
||||||
val context = "AuthorLink"
|
val context = "AuthorLink"
|
||||||
return PlatformAuthorLink(PlatformID.fromV8(config, value.getOrThrow(config, "id", context, false)),
|
return PlatformAuthorLink(PlatformID.fromV8(config, value.getOrThrow(config, "id", context, false)),
|
||||||
value.getOrThrow(config ,"name", context),
|
value.getOrThrow(config ,"name", context),
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.futo.platformplayer.api.media.models
|
||||||
|
|
||||||
|
import com.caoccao.javet.values.reference.V8ValueObject
|
||||||
|
import com.futo.platformplayer.api.media.PlatformID
|
||||||
|
import com.futo.platformplayer.api.media.platforms.js.SourcePluginConfig
|
||||||
|
import com.futo.platformplayer.getOrDefault
|
||||||
|
import com.futo.platformplayer.getOrThrow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A link to a channel, often with its own name and thumbnail
|
||||||
|
*/
|
||||||
|
@kotlinx.serialization.Serializable
|
||||||
|
class PlatformAuthorMembershipLink: PlatformAuthorLink {
|
||||||
|
val membershipUrl: String?;
|
||||||
|
|
||||||
|
constructor(id: PlatformID, name: String, url: String, thumbnail: String? = null, subscribers: Long? = null, membershipUrl: String? = null): super(id, name, url, thumbnail, subscribers)
|
||||||
|
{
|
||||||
|
this.membershipUrl = membershipUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun fromV8(config: SourcePluginConfig, value: V8ValueObject): PlatformAuthorMembershipLink {
|
||||||
|
val context = "AuthorMembershipLink"
|
||||||
|
return PlatformAuthorMembershipLink(PlatformID.fromV8(config, value.getOrThrow(config, "id", context, false)),
|
||||||
|
value.getOrThrow(config ,"name", context),
|
||||||
|
value.getOrThrow(config, "url", context),
|
||||||
|
value.getOrDefault<String>(config, "thumbnail", context, null),
|
||||||
|
if(value.has("subscribers")) value.getOrThrow(config,"subscribers", context) else null,
|
||||||
|
if(value.has("membershipUrl")) value.getOrThrow(config, "membershipUrl", context) else null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -36,6 +36,8 @@ import com.futo.platformplayer.api.media.LiveChatManager
|
|||||||
import com.futo.platformplayer.api.media.PlatformID
|
import com.futo.platformplayer.api.media.PlatformID
|
||||||
import com.futo.platformplayer.api.media.exceptions.ContentNotAvailableYetException
|
import com.futo.platformplayer.api.media.exceptions.ContentNotAvailableYetException
|
||||||
import com.futo.platformplayer.api.media.exceptions.NoPlatformClientException
|
import com.futo.platformplayer.api.media.exceptions.NoPlatformClientException
|
||||||
|
import com.futo.platformplayer.api.media.models.PlatformAuthorLink
|
||||||
|
import com.futo.platformplayer.api.media.models.PlatformAuthorMembershipLink
|
||||||
import com.futo.platformplayer.api.media.models.chapters.ChapterType
|
import com.futo.platformplayer.api.media.models.chapters.ChapterType
|
||||||
import com.futo.platformplayer.api.media.models.comments.PolycentricPlatformComment
|
import com.futo.platformplayer.api.media.models.comments.PolycentricPlatformComment
|
||||||
import com.futo.platformplayer.api.media.models.live.ILiveChatWindowDescriptor
|
import com.futo.platformplayer.api.media.models.live.ILiveChatWindowDescriptor
|
||||||
@ -49,6 +51,7 @@ import com.futo.platformplayer.api.media.models.subtitles.ISubtitleSource
|
|||||||
import com.futo.platformplayer.api.media.models.video.IPlatformVideo
|
import com.futo.platformplayer.api.media.models.video.IPlatformVideo
|
||||||
import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails
|
import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails
|
||||||
import com.futo.platformplayer.api.media.models.video.SerializedPlatformVideo
|
import com.futo.platformplayer.api.media.models.video.SerializedPlatformVideo
|
||||||
|
import com.futo.platformplayer.api.media.platforms.js.models.IJSContentDetails
|
||||||
import com.futo.platformplayer.api.media.platforms.js.models.JSVideoDetails
|
import com.futo.platformplayer.api.media.platforms.js.models.JSVideoDetails
|
||||||
import com.futo.platformplayer.api.media.structures.IPager
|
import com.futo.platformplayer.api.media.structures.IPager
|
||||||
import com.futo.platformplayer.casting.CastConnectionState
|
import com.futo.platformplayer.casting.CastConnectionState
|
||||||
@ -1098,6 +1101,11 @@ class VideoDetailView : ConstraintLayout {
|
|||||||
(_channelName.layoutParams as MarginLayoutParams).setMargins(0, (DP_2).toInt(), 0, 0);
|
(_channelName.layoutParams as MarginLayoutParams).setMargins(0, (DP_2).toInt(), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
video.author.let {
|
||||||
|
if(it is PlatformAuthorMembershipLink && !it.membershipUrl.isNullOrEmpty())
|
||||||
|
_monetization.setPlatformMembership(video.id.pluginId, it.membershipUrl);
|
||||||
|
}
|
||||||
|
|
||||||
_minimize_title.text = video.name;
|
_minimize_title.text = video.name;
|
||||||
_minimize_meta.text = video.author.name;
|
_minimize_meta.text = video.author.name;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.futo.platformplayer.views
|
package com.futo.platformplayer.views
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -11,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import com.futo.platformplayer.R
|
import com.futo.platformplayer.R
|
||||||
import com.futo.platformplayer.HorizontalSpaceItemDecoration
|
import com.futo.platformplayer.HorizontalSpaceItemDecoration
|
||||||
import com.futo.platformplayer.api.http.ManagedHttpClient
|
import com.futo.platformplayer.api.http.ManagedHttpClient
|
||||||
|
import com.futo.platformplayer.api.media.platforms.js.SourcePluginConfig
|
||||||
import com.futo.platformplayer.constructs.Event0
|
import com.futo.platformplayer.constructs.Event0
|
||||||
import com.futo.platformplayer.constructs.TaskHandler
|
import com.futo.platformplayer.constructs.TaskHandler
|
||||||
import com.futo.platformplayer.logging.Logger
|
import com.futo.platformplayer.logging.Logger
|
||||||
@ -34,7 +36,8 @@ class MonetizationView : LinearLayout {
|
|||||||
private val _buttonSupport: LinearLayout;
|
private val _buttonSupport: LinearLayout;
|
||||||
private val _buttonStore: LinearLayout;
|
private val _buttonStore: LinearLayout;
|
||||||
private val _buttonMembership: LinearLayout;
|
private val _buttonMembership: LinearLayout;
|
||||||
private val _platformIndicator: PlatformIndicator;
|
private val _membershipPlatform: PlatformIndicator;
|
||||||
|
private var _membershipUrl: String? = null;
|
||||||
|
|
||||||
private val _textMerchandise: TextView;
|
private val _textMerchandise: TextView;
|
||||||
private val _recyclerMerchandise: RecyclerView;
|
private val _recyclerMerchandise: RecyclerView;
|
||||||
@ -66,7 +69,15 @@ class MonetizationView : LinearLayout {
|
|||||||
_buttonSupport = findViewById(R.id.button_support);
|
_buttonSupport = findViewById(R.id.button_support);
|
||||||
_buttonStore = findViewById(R.id.button_store);
|
_buttonStore = findViewById(R.id.button_store);
|
||||||
_buttonMembership = findViewById(R.id.button_membership);
|
_buttonMembership = findViewById(R.id.button_membership);
|
||||||
_platformIndicator = findViewById(R.id.platform_indicator);
|
_membershipPlatform = findViewById(R.id.membership_platform);
|
||||||
|
_buttonMembership.setOnClickListener {
|
||||||
|
_membershipUrl?.let {
|
||||||
|
val uri = Uri.parse(it);
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.data = uri;
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_textMerchandise = findViewById(R.id.text_merchandise);
|
_textMerchandise = findViewById(R.id.text_merchandise);
|
||||||
_recyclerMerchandise = findViewById(R.id.recycler_merchandise);
|
_recyclerMerchandise = findViewById(R.id.recycler_merchandise);
|
||||||
@ -84,8 +95,16 @@ class MonetizationView : LinearLayout {
|
|||||||
setMerchandise(null);
|
setMerchandise(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setPlatformMembership() {
|
fun setPlatformMembership(pluginId: String?, url: String? = null) {
|
||||||
//TODO:
|
if(pluginId.isNullOrEmpty() || url.isNullOrEmpty()) {
|
||||||
|
_buttonMembership.visibility = GONE;
|
||||||
|
_membershipUrl = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_membershipUrl = url;
|
||||||
|
_membershipPlatform.setPlatformFromClientID(pluginId);
|
||||||
|
_buttonMembership.visibility = VISIBLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setMerchandise(items: List<StoreItem>?) {
|
private fun setMerchandise(items: List<StoreItem>?) {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
android:background="@drawable/background_membership">
|
android:background="@drawable/background_membership">
|
||||||
|
|
||||||
<com.futo.platformplayer.views.platform.PlatformIndicator
|
<com.futo.platformplayer.views.platform.PlatformIndicator
|
||||||
android:id="@+id/platform_indicator"
|
android:id="@+id/membership_platform"
|
||||||
android:layout_width="18dp"
|
android:layout_width="18dp"
|
||||||
android:layout_height="18dp" />
|
android:layout_height="18dp" />
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit b41f7ed97675b3215ab6230ef744ae7067afa4d8
|
Subproject commit 51c249e9f49a880b8451121d396a60ff73ce5600
|
Loading…
x
Reference in New Issue
Block a user