feat: 用户发贴 & 关注吧 API
This commit is contained in:
parent
4856f55b81
commit
a433c8ce6c
|
|
@ -17,10 +17,10 @@ public class UserLikeForumAdapter extends BaseSingleTypeAdapter<UserLikeForumBea
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void convert(MyViewHolder viewHolder, UserLikeForumBean.ForumBean forumBean, int position) {
|
protected void convert(MyViewHolder viewHolder, UserLikeForumBean.ForumBean forumBean, int position) {
|
||||||
viewHolder.setText(R.id.forum_item_name, forumBean.getName());
|
viewHolder.setText(R.id.forum_item_name, forumBean.name);
|
||||||
ImageUtil.load(viewHolder.getView(R.id.forum_item_avatar), ImageUtil.LOAD_TYPE_AVATAR, forumBean.getAvatar());
|
ImageUtil.load(viewHolder.getView(R.id.forum_item_avatar), ImageUtil.LOAD_TYPE_AVATAR, forumBean.avatar);
|
||||||
viewHolder.setText(R.id.forum_item_slogan, forumBean.getSlogan());
|
viewHolder.setText(R.id.forum_item_slogan, forumBean.slogan);
|
||||||
viewHolder.setVisibility(R.id.forum_item_slogan, TextUtils.isEmpty(forumBean.getSlogan()) ? View.GONE : View.VISIBLE);
|
viewHolder.setVisibility(R.id.forum_item_slogan, TextUtils.isEmpty(forumBean.slogan) ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import com.huanchengfly.tieba.post.api.models.protos.searchSug.SearchSugResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.topicList.TopicListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.topicList.TopicListResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse
|
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse
|
||||||
|
import com.huanchengfly.tieba.post.api.models.protos.userPost.UserPostResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.web.ForumBean
|
import com.huanchengfly.tieba.post.api.models.web.ForumBean
|
||||||
import com.huanchengfly.tieba.post.api.models.web.ForumHome
|
import com.huanchengfly.tieba.post.api.models.web.ForumHome
|
||||||
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
|
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
|
||||||
|
|
@ -1442,4 +1443,22 @@ interface ITiebaApi {
|
||||||
fun forumRuleDetailFlow(
|
fun forumRuleDetailFlow(
|
||||||
forumId: Long,
|
forumId: Long,
|
||||||
): Flow<ForumRuleDetailResponse>
|
): Flow<ForumRuleDetailResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看用户的所有主题贴/回复
|
||||||
|
*
|
||||||
|
* @param uid 用户 ID
|
||||||
|
* @param page 分页页码(从 1 开始)
|
||||||
|
* @param isThread 是否查看主题贴
|
||||||
|
*/
|
||||||
|
fun userPostFlow(
|
||||||
|
uid: Long,
|
||||||
|
page: Int = 1,
|
||||||
|
isThread: Boolean = true,
|
||||||
|
): Flow<UserPostResponse>
|
||||||
|
|
||||||
|
fun userLikeForumFlow(
|
||||||
|
uid: String,
|
||||||
|
page: Int = 1,
|
||||||
|
): Flow<UserLikeForumBean>
|
||||||
}
|
}
|
||||||
|
|
@ -100,6 +100,9 @@ import com.huanchengfly.tieba.post.api.models.protos.topicList.TopicListResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeRequest
|
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeRequest
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeRequestData
|
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeRequestData
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse
|
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse
|
||||||
|
import com.huanchengfly.tieba.post.api.models.protos.userPost.UserPostRequest
|
||||||
|
import com.huanchengfly.tieba.post.api.models.protos.userPost.UserPostRequestData
|
||||||
|
import com.huanchengfly.tieba.post.api.models.protos.userPost.UserPostResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.web.ForumBean
|
import com.huanchengfly.tieba.post.api.models.web.ForumBean
|
||||||
import com.huanchengfly.tieba.post.api.models.web.ForumHome
|
import com.huanchengfly.tieba.post.api.models.web.ForumHome
|
||||||
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
|
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
|
||||||
|
|
@ -1350,4 +1353,38 @@ object MixedTiebaApiImpl : ITiebaApi {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun userPostFlow(uid: Long, page: Int, isThread: Boolean): Flow<UserPostResponse> {
|
||||||
|
return RetrofitTiebaApi.OFFICIAL_PROTOBUF_TIEBA_V12_API.userPostFlow(
|
||||||
|
buildProtobufRequestBody(
|
||||||
|
UserPostRequest(
|
||||||
|
UserPostRequestData(
|
||||||
|
uid = uid,
|
||||||
|
rn = 20,
|
||||||
|
is_thread = if (isThread) 1 else 0,
|
||||||
|
need_content = 1,
|
||||||
|
pn = page,
|
||||||
|
common = buildCommonRequest(clientVersion = ClientVersion.TIEBA_V12),
|
||||||
|
scr_w = getScreenWidth(),
|
||||||
|
scr_h = getScreenHeight(),
|
||||||
|
scr_dip = App.ScreenInfo.DENSITY.toDouble(),
|
||||||
|
q_type = 1,
|
||||||
|
is_view_card = 1
|
||||||
|
)
|
||||||
|
),
|
||||||
|
clientVersion = ClientVersion.TIEBA_V12,
|
||||||
|
needSToken = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun userLikeForumFlow(uid: String, page: Int): Flow<UserLikeForumBean> {
|
||||||
|
val myUid = AccountUtil.getUid()
|
||||||
|
return RetrofitTiebaApi.OFFICIAL_TIEBA_API.userLikeForumFlow(
|
||||||
|
page = page,
|
||||||
|
uid = myUid,
|
||||||
|
friendUid = if (!TextUtils.equals(uid, myUid)) uid else null,
|
||||||
|
is_guest = if (!TextUtils.equals(uid, myUid)) "1" else null
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,102 +0,0 @@
|
||||||
package com.huanchengfly.tieba.post.api.models;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
import com.huanchengfly.tieba.post.models.BaseBean;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class UserLikeForumBean extends BaseBean {
|
|
||||||
@SerializedName("error_code")
|
|
||||||
private String errorCode;
|
|
||||||
@SerializedName("error_msg")
|
|
||||||
private String errorMsg;
|
|
||||||
@SerializedName("has_more")
|
|
||||||
private String hasMore;
|
|
||||||
@SerializedName("forum_list")
|
|
||||||
private ForumListBean forumList;
|
|
||||||
@SerializedName("common_forum_list")
|
|
||||||
private ForumListBean commonForumList;
|
|
||||||
|
|
||||||
public String getErrorCode() {
|
|
||||||
return errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMsg() {
|
|
||||||
return errorMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHasMore() {
|
|
||||||
return hasMore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForumListBean getForumList() {
|
|
||||||
return forumList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForumListBean getCommonForumList() {
|
|
||||||
return commonForumList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ForumListBean {
|
|
||||||
@SerializedName("non-gconforum")
|
|
||||||
private List<ForumBean> forumList;
|
|
||||||
|
|
||||||
public List<ForumBean> getForumList() {
|
|
||||||
return forumList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ForumBean {
|
|
||||||
private String id;
|
|
||||||
private String name;
|
|
||||||
@SerializedName("level_id")
|
|
||||||
private String levelId;
|
|
||||||
@SerializedName("favo_type")
|
|
||||||
private String favoType;
|
|
||||||
@SerializedName("level_name")
|
|
||||||
private String levelName;
|
|
||||||
@SerializedName("cur_score")
|
|
||||||
private String curScore;
|
|
||||||
@SerializedName("levelup_score")
|
|
||||||
private String levelUpScore;
|
|
||||||
private String avatar;
|
|
||||||
private String slogan;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLevelId() {
|
|
||||||
return levelId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFavoType() {
|
|
||||||
return favoType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLevelName() {
|
|
||||||
return levelName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCurScore() {
|
|
||||||
return curScore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLevelUpScore() {
|
|
||||||
return levelUpScore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAvatar() {
|
|
||||||
return avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSlogan() {
|
|
||||||
return slogan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.huanchengfly.tieba.post.api.models
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import com.huanchengfly.tieba.post.models.BaseBean
|
||||||
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class UserLikeForumBean(
|
||||||
|
@SerialName("error_code")
|
||||||
|
@SerializedName("error_code")
|
||||||
|
val errorCode: String = "-1",
|
||||||
|
|
||||||
|
@SerialName("error_msg")
|
||||||
|
@SerializedName("error_msg")
|
||||||
|
val errorMsg: String = "unknown error",
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
@SerialName("has_more")
|
||||||
|
@SerializedName("has_more")
|
||||||
|
val hasMore: String = "0",
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
@SerialName("forum_list")
|
||||||
|
@SerializedName("forum_list")
|
||||||
|
val forumList: ForumListBean = ForumListBean(),
|
||||||
|
|
||||||
|
@SerialName("common_forum_list")
|
||||||
|
@SerializedName("common_forum_list")
|
||||||
|
val commonForumList: ForumListBean = ForumListBean(),
|
||||||
|
) : BaseBean() {
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ForumListBean(
|
||||||
|
@JvmField
|
||||||
|
@SerialName("non-gconforum")
|
||||||
|
@SerializedName("non-gconforum")
|
||||||
|
val forumList: List<ForumBean> = persistentListOf(),
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ForumBean(
|
||||||
|
val id: String? = null,
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
val name: String? = null,
|
||||||
|
|
||||||
|
@SerialName("level_id")
|
||||||
|
@SerializedName("level_id")
|
||||||
|
val levelId: String? = null,
|
||||||
|
|
||||||
|
@SerialName("favo_type")
|
||||||
|
@SerializedName("favo_type")
|
||||||
|
val favoType: String? = null,
|
||||||
|
|
||||||
|
@SerialName("level_name")
|
||||||
|
@SerializedName("level_name")
|
||||||
|
val levelName: String? = null,
|
||||||
|
|
||||||
|
@SerialName("cur_score")
|
||||||
|
@SerializedName("cur_score")
|
||||||
|
val curScore: String? = null,
|
||||||
|
|
||||||
|
@SerialName("levelup_score")
|
||||||
|
@SerializedName("levelup_score")
|
||||||
|
val levelUpScore: String? = null,
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
val avatar: String? = null,
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
val slogan: String? = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ import com.huanchengfly.tieba.post.api.models.OAID
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.adapter.DeferredCallAdapterFactory
|
import com.huanchengfly.tieba.post.api.retrofit.adapter.DeferredCallAdapterFactory
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.adapter.FlowCallAdapterFactory
|
import com.huanchengfly.tieba.post.api.retrofit.adapter.FlowCallAdapterFactory
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.converter.gson.GsonConverterFactory
|
import com.huanchengfly.tieba.post.api.retrofit.converter.gson.GsonConverterFactory
|
||||||
|
import com.huanchengfly.tieba.post.api.retrofit.converter.kotlinx.serialization.asConverterFactory
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.interceptors.AddWebCookieInterceptor
|
import com.huanchengfly.tieba.post.api.retrofit.interceptors.AddWebCookieInterceptor
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.interceptors.CommonHeaderInterceptor
|
import com.huanchengfly.tieba.post.api.retrofit.interceptors.CommonHeaderInterceptor
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.interceptors.CommonParamInterceptor
|
import com.huanchengfly.tieba.post.api.retrofit.interceptors.CommonParamInterceptor
|
||||||
|
|
@ -37,6 +38,7 @@ import com.huanchengfly.tieba.post.utils.CuidUtils
|
||||||
import com.huanchengfly.tieba.post.utils.DeviceUtils
|
import com.huanchengfly.tieba.post.utils.DeviceUtils
|
||||||
import com.huanchengfly.tieba.post.utils.MobileInfoUtil
|
import com.huanchengfly.tieba.post.utils.MobileInfoUtil
|
||||||
import com.huanchengfly.tieba.post.utils.UIDUtil
|
import com.huanchengfly.tieba.post.utils.UIDUtil
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.ConnectionPool
|
import okhttp3.ConnectionPool
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
|
@ -332,12 +334,18 @@ object RetrofitTiebaApi {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val json = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
coerceInputValues = true
|
||||||
|
}
|
||||||
|
|
||||||
val SOFIRE_API: SofireApi by lazy {
|
val SOFIRE_API: SofireApi by lazy {
|
||||||
Retrofit.Builder()
|
Retrofit.Builder()
|
||||||
.baseUrl("https://sofire.baidu.com/")
|
.baseUrl("https://sofire.baidu.com/")
|
||||||
.addCallAdapterFactory(DeferredCallAdapterFactory())
|
.addCallAdapterFactory(DeferredCallAdapterFactory())
|
||||||
.addCallAdapterFactory(FlowCallAdapterFactory.create())
|
.addCallAdapterFactory(FlowCallAdapterFactory.create())
|
||||||
.addConverterFactory(NullOnEmptyConverterFactory())
|
.addConverterFactory(NullOnEmptyConverterFactory())
|
||||||
|
.addConverterFactory(json.asConverterFactory())
|
||||||
.addConverterFactory(gsonConverterFactory)
|
.addConverterFactory(gsonConverterFactory)
|
||||||
.client(OkHttpClient.Builder().apply {
|
.client(OkHttpClient.Builder().apply {
|
||||||
// addInterceptor()
|
// addInterceptor()
|
||||||
|
|
@ -355,6 +363,7 @@ object RetrofitTiebaApi {
|
||||||
.addCallAdapterFactory(DeferredCallAdapterFactory())
|
.addCallAdapterFactory(DeferredCallAdapterFactory())
|
||||||
.addCallAdapterFactory(FlowCallAdapterFactory.create())
|
.addCallAdapterFactory(FlowCallAdapterFactory.create())
|
||||||
.addConverterFactory(NullOnEmptyConverterFactory())
|
.addConverterFactory(NullOnEmptyConverterFactory())
|
||||||
|
.addConverterFactory(json.asConverterFactory())
|
||||||
.addConverterFactory(gsonConverterFactory)
|
.addConverterFactory(gsonConverterFactory)
|
||||||
.client(OkHttpClient.Builder().apply {
|
.client(OkHttpClient.Builder().apply {
|
||||||
readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)
|
readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
@file:OptIn(ExperimentalSerializationApi::class)
|
||||||
|
|
||||||
|
package com.huanchengfly.tieba.post.api.retrofit.converter.kotlinx.serialization
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
|
import kotlinx.serialization.StringFormat
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import retrofit2.Converter
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import java.lang.reflect.Type
|
||||||
|
|
||||||
|
internal class Factory(
|
||||||
|
private val serializer: Serializer,
|
||||||
|
) : Converter.Factory() {
|
||||||
|
@Suppress("RedundantNullableReturnType") // Retaining interface contract.
|
||||||
|
override fun responseBodyConverter(
|
||||||
|
type: Type,
|
||||||
|
annotations: Array<out Annotation>,
|
||||||
|
retrofit: Retrofit,
|
||||||
|
): Converter<ResponseBody, *>? {
|
||||||
|
val delegate: Converter<ResponseBody, *> =
|
||||||
|
retrofit.nextResponseBodyConverter<Any>(this, type, annotations)
|
||||||
|
val loader = runCatching { serializer.serializer(type) }.getOrNull()
|
||||||
|
return Converter { body: ResponseBody ->
|
||||||
|
loader?.let { serializer.fromResponseBody(it, body) } ?: run {
|
||||||
|
Log.d("Serializer", "Failed to deserialize, falling back to delegate.")
|
||||||
|
delegate.convert(body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmName("create")
|
||||||
|
fun StringFormat.asConverterFactory(): Converter.Factory {
|
||||||
|
return Factory(Serializer.FromString(this))
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.huanchengfly.tieba.post.api.retrofit.converter.kotlinx.serialization
|
||||||
|
|
||||||
|
import kotlinx.serialization.DeserializationStrategy
|
||||||
|
import kotlinx.serialization.KSerializer
|
||||||
|
import kotlinx.serialization.SerialFormat
|
||||||
|
import kotlinx.serialization.StringFormat
|
||||||
|
import kotlinx.serialization.serializer
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import java.lang.reflect.Type
|
||||||
|
|
||||||
|
internal sealed class Serializer {
|
||||||
|
abstract fun <T> fromResponseBody(loader: DeserializationStrategy<T>, body: ResponseBody): T
|
||||||
|
|
||||||
|
protected abstract val format: SerialFormat
|
||||||
|
|
||||||
|
fun serializer(type: Type): KSerializer<Any> = format.serializersModule.serializer(type)
|
||||||
|
|
||||||
|
class FromString(override val format: StringFormat) : Serializer() {
|
||||||
|
override fun <T> fromResponseBody(
|
||||||
|
loader: DeserializationStrategy<T>,
|
||||||
|
body: ResponseBody,
|
||||||
|
): T {
|
||||||
|
val string = body.string()
|
||||||
|
return format.decodeFromString(loader, string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ import com.huanchengfly.tieba.post.api.models.protos.searchSug.SearchSugResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.topicList.TopicListResponse
|
import com.huanchengfly.tieba.post.api.models.protos.topicList.TopicListResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse
|
import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse
|
||||||
|
import com.huanchengfly.tieba.post.api.models.protos.userPost.UserPostResponse
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.body.MyMultipartBody
|
import com.huanchengfly.tieba.post.api.retrofit.body.MyMultipartBody
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
|
|
@ -109,4 +110,9 @@ interface OfficialProtobufTiebaApi {
|
||||||
fun forumRuleDetailFlow(
|
fun forumRuleDetailFlow(
|
||||||
@Body body: MyMultipartBody,
|
@Body body: MyMultipartBody,
|
||||||
): Flow<ForumRuleDetailResponse>
|
): Flow<ForumRuleDetailResponse>
|
||||||
|
|
||||||
|
@POST("/c/u/feed/userpost?cmd=303002&format=protobuf")
|
||||||
|
fun userPostFlow(
|
||||||
|
@Body body: MyMultipartBody,
|
||||||
|
): Flow<UserPostResponse>
|
||||||
}
|
}
|
||||||
|
|
@ -523,4 +523,15 @@ interface OfficialTiebaApi {
|
||||||
@Field("delete_my_post") deleteMyPost: Int,
|
@Field("delete_my_post") deleteMyPost: Int,
|
||||||
@Field("tbs") tbs: String? = AccountUtil.getLoginInfo()?.tbs,
|
@Field("tbs") tbs: String? = AccountUtil.getLoginInfo()?.tbs,
|
||||||
): Flow<CommonResponse>
|
): Flow<CommonResponse>
|
||||||
|
|
||||||
|
@Headers("${Header.FORCE_LOGIN}: ${Header.FORCE_LOGIN_TRUE}")
|
||||||
|
@POST("/c/f/forum/like")
|
||||||
|
@FormUrlEncoded
|
||||||
|
fun userLikeForumFlow(
|
||||||
|
@Field("page_no") page: Int = 1,
|
||||||
|
@Field("page_size") pageSize: Int = 50,
|
||||||
|
@Field("uid") uid: String?,
|
||||||
|
@Field("friend_uid") friendUid: String?,
|
||||||
|
@Field("is_guest") is_guest: String?,
|
||||||
|
): Flow<UserLikeForumBean>
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ public class UserLikeForumFragment extends BaseFragment {
|
||||||
R.id.forum_item_card,
|
R.id.forum_item_card,
|
||||||
(OnItemChildClickListener<UserLikeForumBean.ForumBean>)
|
(OnItemChildClickListener<UserLikeForumBean.ForumBean>)
|
||||||
(viewHolder, forumBean, position) ->
|
(viewHolder, forumBean, position) ->
|
||||||
ForumActivity.launch(getAttachContext(), forumBean.getName())
|
ForumActivity.launch(getAttachContext(), forumBean.name)
|
||||||
);
|
);
|
||||||
recyclerView.setAdapter(userLikeForumAdapter);
|
recyclerView.setAdapter(userLikeForumAdapter);
|
||||||
}
|
}
|
||||||
|
|
@ -95,9 +95,9 @@ public class UserLikeForumFragment extends BaseFragment {
|
||||||
public void onResponse(@NotNull Call<UserLikeForumBean> call, @NotNull Response<UserLikeForumBean> response) {
|
public void onResponse(@NotNull Call<UserLikeForumBean> call, @NotNull Response<UserLikeForumBean> response) {
|
||||||
UserLikeForumBean data = response.body();
|
UserLikeForumBean data = response.body();
|
||||||
userLikeForumBean = data;
|
userLikeForumBean = data;
|
||||||
if (data.getForumList() != null) {
|
if (data.forumList != null) {
|
||||||
userLikeForumAdapter.setData(data.getForumList().getForumList());
|
userLikeForumAdapter.setData(data.forumList.forumList);
|
||||||
if ("0".equals(data.getHasMore())) {
|
if ("0".equals(data.hasMore)) {
|
||||||
//emptyTipView.setText(R.string.tip_empty);
|
//emptyTipView.setText(R.string.tip_empty);
|
||||||
refreshLayout.finishRefreshWithNoMoreData();
|
refreshLayout.finishRefreshWithNoMoreData();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -111,6 +111,7 @@ public class UserLikeForumFragment extends BaseFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NotNull Call<UserLikeForumBean> call, @NotNull Throwable t) {
|
public void onFailure(@NotNull Call<UserLikeForumBean> call, @NotNull Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
Toast.makeText(getAttachContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getAttachContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
refreshLayout.finishRefresh(false);
|
refreshLayout.finishRefresh(false);
|
||||||
}
|
}
|
||||||
|
|
@ -126,9 +127,9 @@ public class UserLikeForumFragment extends BaseFragment {
|
||||||
page += 1;
|
page += 1;
|
||||||
UserLikeForumBean data = response.body();
|
UserLikeForumBean data = response.body();
|
||||||
userLikeForumBean = data;
|
userLikeForumBean = data;
|
||||||
if (data.getForumList() != null) {
|
if (data.forumList != null) {
|
||||||
userLikeForumAdapter.insert(data.getForumList().getForumList());
|
userLikeForumAdapter.insert(data.forumList.forumList);
|
||||||
if ("0".equals(data.getHasMore())) {
|
if ("0".equals(data.hasMore)) {
|
||||||
//emptyTipView.setText(R.string.tip_empty);
|
//emptyTipView.setText(R.string.tip_empty);
|
||||||
refreshLayout.finishLoadMoreWithNoMoreData();
|
refreshLayout.finishLoadMoreWithNoMoreData();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,19 @@ import "PostInfoContent.proto";
|
||||||
import "PbContent.proto";
|
import "PbContent.proto";
|
||||||
import "Abstract.proto";
|
import "Abstract.proto";
|
||||||
import "Media.proto";
|
import "Media.proto";
|
||||||
|
import "PollInfo.proto";
|
||||||
|
import "VideoInfo.proto";
|
||||||
|
import "Agree.proto";
|
||||||
|
import "OriginThreadInfo.proto";
|
||||||
|
import "AlaLiveInfo.proto";
|
||||||
|
import "ZhiBoInfoTW.proto";
|
||||||
|
import "Quote.proto";
|
||||||
|
import "Voice.proto";
|
||||||
|
import "DealInfo.proto";
|
||||||
|
import "BaijiahaoInfo.proto";
|
||||||
|
import "Item.proto";
|
||||||
|
import "PbLinkInfo.proto";
|
||||||
|
import "HeadItem.proto";
|
||||||
|
|
||||||
package tieba;
|
package tieba;
|
||||||
|
|
||||||
|
|
@ -31,48 +44,48 @@ message PostInfoList {
|
||||||
string user_portrait = 19;
|
string user_portrait = 19;
|
||||||
string post_type = 20;
|
string post_type = 20;
|
||||||
// LbsInfo lbs_info = 21;
|
// LbsInfo lbs_info = 21;
|
||||||
// Quote quote = 22;
|
Quote quote = 22;
|
||||||
// repeated Voice voice_info = 23;
|
repeated Voice voice_info = 23;
|
||||||
// AnchorInfo anchor_info = 24;
|
// AnchorInfo anchor_info = 24;
|
||||||
// int32 hide_post = 25;
|
int32 hide_post = 25;
|
||||||
// uint64 thread_type = 26;
|
uint64 thread_type = 26;
|
||||||
// ZhiBoInfoTW twzhibo_info = 27;
|
ZhiBoInfoTW twzhibo_info = 27;
|
||||||
// PollInfo poll_info = 28;
|
PollInfo poll_info = 28;
|
||||||
// VideoInfo video_info = 29;
|
VideoInfo video_info = 29;
|
||||||
// bool is_deal = 30;
|
bool is_deal = 30;
|
||||||
// DealInfo deal_info = 31;
|
DealInfo deal_info = 31;
|
||||||
// repeated MultipleForum multiple_forum_list = 32;
|
// repeated MultipleForum multiple_forum_list = 32;
|
||||||
// int32 freq_num = 33;
|
int32 freq_num = 33;
|
||||||
// uint64 v_forum_id = 34;
|
uint64 v_forum_id = 34;
|
||||||
// string name_show = 35;
|
string name_show = 35;
|
||||||
// AlaLiveInfo ala_info = 36;
|
AlaLiveInfo ala_info = 36;
|
||||||
// int32 agree_num = 37;
|
int32 agree_num = 37;
|
||||||
// int32 view_num = 38;
|
int32 view_num = 38;
|
||||||
// int32 share_num = 39;
|
int32 share_num = 39;
|
||||||
// Agree agree = 40;
|
Agree agree = 40;
|
||||||
// int32 is_remain = 41;
|
int32 is_remain = 41;
|
||||||
// OriginThreadInfo origin_thread_info = 42;
|
OriginThreadInfo origin_thread_info = 42;
|
||||||
// int32 is_view_year = 43;
|
int32 is_view_year = 43;
|
||||||
// int32 is_share_thread = 44;
|
int32 is_share_thread = 44;
|
||||||
repeated PbContent rich_title = 45;
|
repeated PbContent rich_title = 45;
|
||||||
repeated PbContent rich_abstract = 46;
|
repeated PbContent rich_abstract = 46;
|
||||||
int32 is_ntitle = 47;
|
int32 is_ntitle = 47;
|
||||||
// string article_cover = 48;
|
string article_cover = 48;
|
||||||
repeated PbContent first_post_content = 49;
|
repeated PbContent first_post_content = 49;
|
||||||
// BaijiahaoInfo baijiahao_info = 50;
|
BaijiahaoInfo baijiahao_info = 50;
|
||||||
// string wonderful_post_info = 51;
|
string wonderful_post_info = 51;
|
||||||
// Item item = 52;
|
Item item = 52;
|
||||||
// repeated HeadItem item_star = 53;
|
repeated HeadItem item_star = 53;
|
||||||
// repeated PbLinkInfo pb_link_info = 54;
|
repeated PbLinkInfo pb_link_info = 54;
|
||||||
// repeated PbGoodsInfo pb_goods_info = 55;
|
// repeated PbGoodsInfo pb_goods_info = 55;
|
||||||
repeated PrivSets priv_sets = 56;
|
repeated PrivSets priv_sets = 56;
|
||||||
// int32 is_author_view = 57;
|
int32 is_author_view = 57;
|
||||||
// WorksInfo works_info = 58;
|
// WorksInfo works_info = 58;
|
||||||
int32 is_manager = 59;
|
int32 is_manager = 59;
|
||||||
int32 is_origin_manager = 60;
|
int32 is_origin_manager = 60;
|
||||||
// int32 good_types = 61;
|
int32 good_types = 61;
|
||||||
// int32 top_types = 62;
|
int32 top_types = 62;
|
||||||
// UserPostPerm user_post_perm = 63;
|
// UserPostPerm user_post_perm = 63;
|
||||||
// VoiceRoom voice_room = 64;
|
// VoiceRoom voice_room = 64;
|
||||||
// string target_scheme = 66;
|
string target_scheme = 66;
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tieba;
|
||||||
|
|
||||||
|
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
|
||||||
|
|
||||||
|
message Quote {
|
||||||
|
int64 post_id = 1;
|
||||||
|
string user_name = 2;
|
||||||
|
int64 user_id = 3;
|
||||||
|
string ip = 4;
|
||||||
|
string content = 5;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tieba.userPost;
|
||||||
|
|
||||||
|
option java_package = "com.huanchengfly.tieba.post.api.models.protos.userPost";
|
||||||
|
|
||||||
|
import "UserPost/UserPostRequestData.proto";
|
||||||
|
|
||||||
|
message UserPostRequest {
|
||||||
|
UserPostRequestData data = 1;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tieba.userPost;
|
||||||
|
|
||||||
|
option java_package = "com.huanchengfly.tieba.post.api.models.protos.userPost";
|
||||||
|
|
||||||
|
import "CommonRequest.proto";
|
||||||
|
|
||||||
|
message UserPostRequestData {
|
||||||
|
int64 uid = 1;
|
||||||
|
uint32 rn = 2;
|
||||||
|
uint32 offset = 3;
|
||||||
|
optional uint32 is_thread = 4;
|
||||||
|
uint32 need_content = 5;
|
||||||
|
uint64 forum_id = 6;
|
||||||
|
uint32 begin_time = 7;
|
||||||
|
uint32 end_time = 8;
|
||||||
|
uint32 subtype = 9;
|
||||||
|
uint32 check_login = 10;
|
||||||
|
string ip_str = 11;
|
||||||
|
uint32 ip_int = 12;
|
||||||
|
string module_name = 13;
|
||||||
|
uint32 st_type = 14;
|
||||||
|
uint32 st_param = 15;
|
||||||
|
uint32 smile_grade = 16;
|
||||||
|
uint32 support_noun = 17;
|
||||||
|
uint32 login = 18;
|
||||||
|
int64 user_id = 19;
|
||||||
|
string user_name = 20;
|
||||||
|
uint32 no_un = 21;
|
||||||
|
string portrait = 22;
|
||||||
|
string mobile = 23;
|
||||||
|
string email = 24;
|
||||||
|
string cookie = 25;
|
||||||
|
uint32 pn = 26;
|
||||||
|
CommonRequest common = 27;
|
||||||
|
uint32 is_twzhibo = 28;
|
||||||
|
int32 scr_w = 29;
|
||||||
|
int32 scr_h = 30;
|
||||||
|
double scr_dip = 31;
|
||||||
|
int32 q_type = 32;
|
||||||
|
int32 is_view_card = 33;
|
||||||
|
uint32 last_thread_time = 34;
|
||||||
|
uint32 work_tab_id = 35;
|
||||||
|
uint32 type = 36;
|
||||||
|
uint32 from_type = 37;
|
||||||
|
uint64 begin_thread_id = 38;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tieba.userPost;
|
||||||
|
|
||||||
|
option java_package = "com.huanchengfly.tieba.post.api.models.protos.userPost";
|
||||||
|
|
||||||
|
import "Error.proto";
|
||||||
|
import "UserPost/UserPostResponseData.proto";
|
||||||
|
|
||||||
|
message UserPostResponse {
|
||||||
|
Error error = 1;
|
||||||
|
UserPostResponseData data = 2;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tieba.userPost;
|
||||||
|
|
||||||
|
option java_package = "com.huanchengfly.tieba.post.api.models.protos.userPost";
|
||||||
|
|
||||||
|
import "PostInfoList.proto";
|
||||||
|
|
||||||
|
message UserPostResponseData {
|
||||||
|
repeated PostInfoList post_list = 1;
|
||||||
|
uint32 hide_post = 2;
|
||||||
|
uint64 time = 3;
|
||||||
|
uint64 ctime = 4;
|
||||||
|
uint64 logid = 5;
|
||||||
|
int32 mask_type = 6;
|
||||||
|
int32 view_card_num = 7;
|
||||||
|
int32 reddot_deleted_thread = 8;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue