Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ lifecycleViewmodelComposeVersion = "2.9.6"
minSdk = "23"
java = "21"
agp = "8.13.2"
kotlin = "2.2.21"
kotlin = "2.3.0"
core-ktx = "1.17.0"
junit = "4.13.2"
androidx-test-ext-junit = "1.3.0"
Expand Down
4 changes: 4 additions & 0 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ room {
schemaDirectory("$projectDir/schemas")
}

ktorfit {
compilerPluginVersion.set("2.3.3")
}

ktlint {
version.set(libs.versions.ktlint)
filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ internal fun List<ListNotificationsNotification>.toDb(
when (reason) {
ListNotificationsNotificationReason.Repost -> it.decodeAs<Repost>().subject
ListNotificationsNotificationReason.Like -> it.decodeAs<Like>().subject
else -> null
}
}?.uri
.let {
Expand All @@ -233,7 +232,6 @@ internal fun List<ListNotificationsNotification>.toDb(
when (reason) {
ListNotificationsNotificationReason.Repost -> "_repost"
ListNotificationsNotificationReason.Like -> "_like"
else -> ""
}
val data =
DbStatusWithUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class FansPagingSource(
it.follower?.render(accountKey = accountKey)
},
prevKey = null,
nextKey = response?.lastOrNull()?.id,
nextKey = response.lastOrNull()?.id,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ internal class FavouriteTimelineRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

val notes = response.map { it.note }
val data =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class FollowingPagingSource(
it.followee?.render(accountKey = accountKey)
},
prevKey = null,
nextKey = response?.lastOrNull()?.id,
nextKey = response.lastOrNull()?.id,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ internal class HomeTimelineRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ internal class HybridTimelineRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ internal class ListTimelineRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ internal class LocalTimelineRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ internal class MentionTimelineRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ internal class MisskeyDataSource(
val user =
service
.usersShow(UsersShowRequest(username = name, host = host))

?.toDbUser(accountKey.host)
?: throw Exception("User not found")
.toDbUser(accountKey.host)
database.userDao().insert(user)
},
cacheSource = {
Expand All @@ -231,9 +229,7 @@ internal class MisskeyDataSource(
val user =
service
.usersShow(UsersShowRequest(userId = id))

?.toDbUser(accountKey.host)
?: throw Exception("User not found")
.toDbUser(accountKey.host)
database.userDao().insert(user)
},
cacheSource = {
Expand Down Expand Up @@ -315,8 +311,7 @@ internal class MisskeyDataSource(
val emojis =
service
.emojis()

?.emojis
.emojis
.orEmpty()
.toImmutableList()
database.emojiDao().insert(
Expand Down Expand Up @@ -921,7 +916,7 @@ internal class MisskeyDataSource(
)
}.fold(
onSuccess = {
emit(it?.isFavorited == true)
emit(it.isFavorited == true)
},
onFailure = {
emit(false)
Expand Down Expand Up @@ -1053,7 +1048,7 @@ internal class MisskeyDataSource(
),
)
}.onSuccess { response ->
if (response?.id != null) {
if (response.id != null) {
MemoryPagingSource.updateWith<UiList>(
key = listKey,
) {
Expand Down Expand Up @@ -1122,7 +1117,7 @@ internal class MisskeyDataSource(
UsersListsShowRequest(
listId = listId,
),
)?.render() ?: throw Exception("List not found")
).render()
},
)

Expand Down Expand Up @@ -1207,8 +1202,8 @@ internal class MisskeyDataSource(
UsersShowRequest(
userId = userKey.id,
),
)?.toDbUser(accountKey.host)
?.render(accountKey)
).toDbUser(accountKey.host)
.render(accountKey)
MemoryPagingSource.updateWith(
key = listMemberKey(listId),
) {
Expand All @@ -1224,7 +1219,7 @@ internal class MisskeyDataSource(
listId = listId,
),
)
if (list?.id != null) {
if (list.id != null) {
MemCacheable.updateWith<ImmutableList<UiList>>(
key = userListsKey(userKey),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ internal class NotificationRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ internal class PublicTimelineRemoteMediator(
),
)
}
} ?: return Result(
endOfPaginationReached = true,
)
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal class SearchStatusRemoteMediator(
),
)
}
} ?: emptyList()
}

return Result(
endOfPaginationReached = response.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class SearchUserPagingSource(
limit = params.loadSize,
offset = params.key ?: 0,
),
)?.let {
).let {
return LoadResult.Page(
data = it.map { it.render(accountKey) },
prevKey = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ internal class TrendHashtagPagingSource(
override suspend fun doLoad(params: LoadParams<Int>): LoadResult<Int, UiHashtag> {
service
.hashtagsTrend()

?.map {
.map {
UiHashtag(
hashtag = it.tag,
description = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ internal class TrendsUserPagingSource(
override suspend fun doLoad(params: LoadParams<Int>): LoadResult<Int, UiUserV2> {
service
.pinnedUsers(PinnedUsersRequest(limit = params.loadSize))

?.map {
.map {
it.render(accountKey)
}.let {
return LoadResult.Page(
data = it ?: emptyList(),
data = it,
prevKey = null,
nextKey = null,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ internal class VVODataSource(
?.user
requireNotNull(user) { "user not found" }
UiRelation(
following = user.following ?: false,
following = user.following,
isFans = user.followMe ?: false,
)
}.toUi()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal data class VVOResponse<T>(
)

@OptIn(ExperimentalSerializationApi::class)
private class VVOResponseSerializer<T>(
internal class VVOResponseSerializer<T>(
private val dataSer: KSerializer<T>,
) : KSerializer<VVOResponse<T>> {
override val descriptor: SerialDescriptor =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ private fun parseName(status: Account): Element {
"<img src=\"${it.url}\" alt=\"${it.shortcode}\" />",
)
}
return parseHtml(content) as? Element ?: Element("body")
return parseHtml(content) as Element
}

internal fun parseMastodonContent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ private fun parseName(
if (name.isEmpty()) {
return Element("body")
}
return misskeyNameParser.parse(name).toHtml(accountKey, emojis, accountKey.host) as? Element ?: Element("body")
return misskeyNameParser.parse(name).toHtml(accountKey, emojis, accountKey.host) as Element
}

private fun moe.tlaster.mfm.parser.tree.Node.toHtml(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ internal fun TopLevel.renderNotifications(
val users =
data?.template?.aggregateUserActionsV1?.fromUsers?.mapNotNull { ref ->
globalObjects
?.users
.users
?.get(ref.user?.id)
?.let { userLegacy ->
User(
Expand Down
Loading