How can i implement Stories in Android

I am using getActiveStories() function from AmityStoryRepository

fun getActiveStories(
storyRepository: AmityStoryRepository,
targetType: AmityStory.TargetType,
targetId: String
) {
storyRepository.getActiveStories(
targetType = targetType,
targetId = targetId,
)
.doOnNext { stories: PagingData →
// PagingData
}
.doOnError {
// Exception
}
.subscribe()
}

Currently, stories are being returned separately for each user. What we need to do is:

  1. Group all similar stories for each user into a single object.
  2. Emit the grouped stories as a single response.
  3. Apply a filter to the query as needed.

This approach ensures that each user’s stories are consolidated and easier to manage.

So can you help user according to with our use case.

Hello @Anuj_Rai , Our team recommends referring to this link for your use case: Get Global Story Targets. It should help you implement the required changes. If you have further questions, feel free to reach out!

As discussed, I am using the getGlobalStoryTargets() function:

fun getGlobalStoryTargets(
    storyRepository: AmityStoryRepository
) {
    val queryOption = AmityGlobalStoryTargetsQueryOption.SMART
                // AmityGlobalStoryTargetsQueryOption.SEEN
                // AmityGlobalStoryTargetsQueryOption.UNSEEN
                // AmityGlobalStoryTargetsQueryOption.ALL
    storyRepository.getGlobalStoryTargets(
        queryOption = queryOption
    )
        .doOnNext { stories: PagingData<AmityStoryTarget> ->
            // PagingData<AmityStoryTarget>
        }
        .doOnError {
            // Exception
        }
        .subscribe()
}

However, I am encountering difficulties with using AmityStoryTarget to retrieve all stories for each user in a list. Specifically, I need to get all active stories for each individual user.

Please advise on how to achieve this.

Hello @Anuj_Rai , Currently, the function to retrieve all active stories for each individual user is not available. We will raise this request to our product team for consideration and improvement in future updates.

In the meantime, if there’s anything else we can assist you with, please let us know!