Skip to content

Commit c326356

Browse files
some story touch-ups
1 parent 7ead504 commit c326356

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: app/src/main/java/awais/instagrabber/repositories/StoriesService.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ interface StoriesService {
1111
suspend fun fetch(@Path("mediaId") mediaId: Long): String
1212

1313
@GET("/api/v1/feed/reels_tray/")
14-
suspend fun getFeedStories(): ReelsTrayResponse
14+
suspend fun getFeedStories(): ReelsTrayResponse?
1515

1616
@GET("/api/v1/highlights/{uid}/highlights_tray/")
17-
suspend fun fetchHighlights(@Path("uid") uid: Long): ReelsTrayResponse
17+
suspend fun fetchHighlights(@Path("uid") uid: Long): ReelsTrayResponse?
1818

1919
@GET("/api/v1/archive/reel/day_shells/")
2020
suspend fun fetchArchive(@QueryMap queryParams: Map<String, String>): ArchiveResponse?

Diff for: app/src/main/java/awais/instagrabber/webservices/StoriesRepository.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ open class StoriesRepository(private val service: StoriesService) {
2626

2727
suspend fun getFeedStories(): List<Story> {
2828
val response = service.getFeedStories()
29-
val result = response.tray?.toMutableList() ?: mutableListOf()
30-
if (response.broadcasts != null) {
29+
val result: MutableList<Story> = mutableListOf()
30+
if (response?.broadcasts != null) {
3131
val length = response.broadcasts.size
3232
for (i in 0 until length) {
3333
val broadcast = response.broadcasts.get(i)
@@ -49,6 +49,7 @@ open class StoriesRepository(private val service: StoriesService) {
4949
)
5050
}
5151
}
52+
if (response?.tray != null) result.addAll(response.tray)
5253
return sort(result.toList())
5354
}
5455

0 commit comments

Comments
 (0)