Skip to content

Commit ba70c5a

Browse files
authored
Merge pull request #1686 from DimensionDev/copilot/sub-pr-1644
Fix Kotlin 2.3.0 warnings to maintain allWarningsAsErrors
2 parents 5946594 + 1e1d4d0 commit ba70c5a

21 files changed

Lines changed: 29 additions & 54 deletions

shared/src/commonMain/kotlin/dev/dimension/flare/data/database/cache/mapper/Bluesky.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ internal fun List<ListNotificationsNotification>.toDb(
218218
when (reason) {
219219
ListNotificationsNotificationReason.Repost -> it.decodeAs<Repost>().subject
220220
ListNotificationsNotificationReason.Like -> it.decodeAs<Like>().subject
221-
else -> null
222221
}
223222
}?.uri
224223
.let {
@@ -233,7 +232,6 @@ internal fun List<ListNotificationsNotification>.toDb(
233232
when (reason) {
234233
ListNotificationsNotificationReason.Repost -> "_repost"
235234
ListNotificationsNotificationReason.Like -> "_like"
236-
else -> ""
237235
}
238236
val data =
239237
DbStatusWithUser(

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/FansPagingSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class FansPagingSource(
3434
it.follower?.render(accountKey = accountKey)
3535
},
3636
prevKey = null,
37-
nextKey = response?.lastOrNull()?.id,
37+
nextKey = response.lastOrNull()?.id,
3838
)
3939
}
4040
}

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/FavouriteTimelineRemoteMediator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ internal class FavouriteTimelineRemoteMediator(
5050
),
5151
)
5252
}
53-
} ?: return Result(
54-
endOfPaginationReached = true,
55-
)
53+
}
5654

5755
val notes = response.map { it.note }
5856
val data =

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/FollowingPagingSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ internal class FollowingPagingSource(
3535
it.followee?.render(accountKey = accountKey)
3636
},
3737
prevKey = null,
38-
nextKey = response?.lastOrNull()?.id,
38+
nextKey = response.lastOrNull()?.id,
3939
)
4040
}
4141
}

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/HomeTimelineRemoteMediator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ internal class HomeTimelineRemoteMediator(
4646
),
4747
)
4848
}
49-
} ?: return Result(
50-
endOfPaginationReached = true,
51-
)
49+
}
5250

5351
return Result(
5452
endOfPaginationReached = response.isEmpty(),

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/HybridTimelineRemoteMediator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ internal class HybridTimelineRemoteMediator(
4141
),
4242
)
4343
}
44-
} ?: return Result(
45-
endOfPaginationReached = true,
46-
)
44+
}
4745

4846
return Result(
4947
endOfPaginationReached = response.isEmpty(),

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/ListTimelineRemoteMediator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ internal class ListTimelineRemoteMediator(
5555
),
5656
)
5757
}
58-
} ?: return Result(
59-
endOfPaginationReached = true,
60-
)
58+
}
6159

6260
return Result(
6361
endOfPaginationReached = response.isEmpty(),

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/LocalTimelineRemoteMediator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ internal class LocalTimelineRemoteMediator(
4343
),
4444
)
4545
}
46-
} ?: return Result(
47-
endOfPaginationReached = true,
48-
)
46+
}
4947

5048
return Result(
5149
endOfPaginationReached = response.isEmpty(),

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/MentionTimelineRemoteMediator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ internal class MentionTimelineRemoteMediator(
4343
),
4444
)
4545
}
46-
} ?: return Result(
47-
endOfPaginationReached = true,
48-
)
46+
}
4947

5048
return Result(
5149
endOfPaginationReached = response.isEmpty(),

shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/misskey/MisskeyDataSource.kt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ internal class MisskeyDataSource(
209209
val user =
210210
service
211211
.usersShow(UsersShowRequest(username = name, host = host))
212-
213-
?.toDbUser(accountKey.host)
214-
?: throw Exception("User not found")
212+
.toDbUser(accountKey.host)
215213
database.userDao().insert(user)
216214
},
217215
cacheSource = {
@@ -231,9 +229,7 @@ internal class MisskeyDataSource(
231229
val user =
232230
service
233231
.usersShow(UsersShowRequest(userId = id))
234-
235-
?.toDbUser(accountKey.host)
236-
?: throw Exception("User not found")
232+
.toDbUser(accountKey.host)
237233
database.userDao().insert(user)
238234
},
239235
cacheSource = {
@@ -315,8 +311,7 @@ internal class MisskeyDataSource(
315311
val emojis =
316312
service
317313
.emojis()
318-
319-
?.emojis
314+
.emojis
320315
.orEmpty()
321316
.toImmutableList()
322317
database.emojiDao().insert(
@@ -921,7 +916,7 @@ internal class MisskeyDataSource(
921916
)
922917
}.fold(
923918
onSuccess = {
924-
emit(it?.isFavorited == true)
919+
emit(it.isFavorited == true)
925920
},
926921
onFailure = {
927922
emit(false)
@@ -1053,7 +1048,7 @@ internal class MisskeyDataSource(
10531048
),
10541049
)
10551050
}.onSuccess { response ->
1056-
if (response?.id != null) {
1051+
if (response.id != null) {
10571052
MemoryPagingSource.updateWith<UiList>(
10581053
key = listKey,
10591054
) {
@@ -1122,7 +1117,7 @@ internal class MisskeyDataSource(
11221117
UsersListsShowRequest(
11231118
listId = listId,
11241119
),
1125-
)?.render() ?: throw Exception("List not found")
1120+
).render()
11261121
},
11271122
)
11281123

@@ -1207,8 +1202,8 @@ internal class MisskeyDataSource(
12071202
UsersShowRequest(
12081203
userId = userKey.id,
12091204
),
1210-
)?.toDbUser(accountKey.host)
1211-
?.render(accountKey)
1205+
).toDbUser(accountKey.host)
1206+
.render(accountKey)
12121207
MemoryPagingSource.updateWith(
12131208
key = listMemberKey(listId),
12141209
) {
@@ -1224,7 +1219,7 @@ internal class MisskeyDataSource(
12241219
listId = listId,
12251220
),
12261221
)
1227-
if (list?.id != null) {
1222+
if (list.id != null) {
12281223
MemCacheable.updateWith<ImmutableList<UiList>>(
12291224
key = userListsKey(userKey),
12301225
) {

0 commit comments

Comments
 (0)