mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Use Kotlinx Serialization with subscription.
This commit is contained in:
parent
ae8f88f4b8
commit
e047d5babd
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.util.Log
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.api.obj.StreamItem
|
||||
import com.github.libretube.api.obj.Subscribe
|
||||
import com.github.libretube.api.obj.Subscription
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.db.DatabaseHolder.Companion.Database
|
||||
@ -25,7 +26,7 @@ object SubscriptionHelper {
|
||||
try {
|
||||
RetrofitInstance.authApi.subscribe(
|
||||
PreferenceHelper.getToken(),
|
||||
com.github.libretube.api.obj.Subscribe(channelId)
|
||||
Subscribe(channelId)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG(), e.toString())
|
||||
@ -46,7 +47,7 @@ object SubscriptionHelper {
|
||||
try {
|
||||
RetrofitInstance.authApi.unsubscribe(
|
||||
PreferenceHelper.getToken(),
|
||||
com.github.libretube.api.obj.Subscribe(channelId)
|
||||
Subscribe(channelId)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG(), e.toString())
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.github.libretube.api.obj
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
data class Subscribe(
|
||||
var channelId: String? = null
|
||||
)
|
||||
@Serializable
|
||||
data class Subscribe(val channelId: String)
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.github.libretube.api.obj
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
data class Subscribed(
|
||||
var subscribed: Boolean? = null
|
||||
)
|
||||
@Serializable
|
||||
data class Subscribed(val subscribed: Boolean? = null)
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.github.libretube.api.obj
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Serializable
|
||||
data class Subscription(
|
||||
var url: String? = null,
|
||||
var name: String? = null,
|
||||
var avatar: String? = null,
|
||||
var verified: Boolean? = null
|
||||
val url: String,
|
||||
val name: String,
|
||||
val avatar: String,
|
||||
val verified: Boolean
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user