Skip to content

Commit

Permalink
汐洛链滴社区客户端 #57
Browse files Browse the repository at this point in the history
  • Loading branch information
Soltus committed May 25, 2024
1 parent 6153c14 commit 7aedcfe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/org/b3log/siyuan/ld246/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ class HomeActivity : ComponentActivity() {
fun NotificationsScreen(n: State<List<ld246_Response_Data_Notification>?>) {
// 观察LiveData并更新状态
val v = n.value
if (v?.isEmpty() == true) {
if (v.isNullOrEmpty()) {
// 显示空数据状态的占位符
LazyColumn {
items(13) { index ->
Expand Down Expand Up @@ -866,19 +866,19 @@ class HomeActivity : ComponentActivity() {
) {
job = viewModelScope.launch {
try {
if (state == null || state.isRefreshing || !__init__ || map[isTabChanged.value]!!.isEmpty()) {
if (state == null || state.isRefreshing || !__init__ || map[isTabChanged.value].isNullOrEmpty()) {
// 执行网络请求
val caller: Call<ld246_Response>? = when (isTabChanged.value) {
val caller: Call<ld246_Response> = when (isTabChanged.value) {
"回帖" -> apiService.apiV2NotificationsCommentedGet(1, token, ua)
"评论" -> apiService.apiV2NotificationsComment2edGet(1, token, ua)
"回复" -> apiService.apiV2NotificationsReplyGet(1, token, ua)
"提及" -> apiService.apiV2NotificationsAtGet(1, token, ua)
"关注" -> apiService.apiV2NotificationsFollowingGet(1, token, ua)
"积分" -> apiService.apiV2NotificationsPointGet(1, token, ua)
else -> null
}
} ?: return@launch
// enqueue 方法通常用于将一个网络请求加入到请求队列中,准备异步执行
caller?.enqueue(object : Callback<ld246_Response> {
caller.enqueue(object : Callback<ld246_Response> {
override fun onResponse(
call: Call<ld246_Response>,
response: Response<ld246_Response>
Expand Down

0 comments on commit 7aedcfe

Please sign in to comment.