Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Tracking and Prioritizing Unseen Stories #101

Open
Adil7767 opened this issue Jul 31, 2024 · 1 comment
Open

Add Support for Tracking and Prioritizing Unseen Stories #101

Adil7767 opened this issue Jul 31, 2024 · 1 comment

Comments

@Adil7767
Copy link
Contributor

Title: Add Support for Tracking and Prioritizing Unseen Stories Across Devices

Issue Text:

Enhance the story playback functionality to prioritize unseen stories and maintain a persistent record of seen stories across devices.

Current Behavior:

  • When new stories are added, the playback starts from the first story, regardless of whether it has been seen before.
  • The library does not support passing already seen stories, leading to a non-optimal user experience when switching devices.

Expected Behavior:

  • Stories with is_seen: true should be considered as already seen.
  • Unseen stories (is_seen: false) should be played first.
  • If all stories are seen, playback should start from the first story.
  • The status of seen stories should be consistent across devices by leveraging server-side storage.

Steps to Reproduce:

  1. Add 4 stories and view all of them.
  2. Add a new story and observe that playback starts from the first story instead of the unseen one.
  3. Save the status of seen stories on one device and log in on another device to see that the status is not retained.

Possible Solution:

  1. Introduce a mechanism to pass a list of stories with a key is_seen indicating whether the story has been seen.
  2. Modify the playback logic to prioritize unseen stories.
  3. Ensure that the status of seen stories can be fetched from and saved to the server, allowing for a consistent experience across devices.

Data Structure Example:

const stories = [{
  id: 'user1',
  name: 'User 1',
  imgUrl: 'user1-profile-image-url',
  stories: [
    { id: 'story1', is_seen: true, source: { uri: 'story1-image-url' } },
    { id: 'story2', is_seen: false, source: { uri: 'story2-video-url' }, mediaType: 'video' },
    // ...
  ]
}, 
// ...
];
  • If is_seen is not passed, consider it as false.

Alternative Approach:

Pass a separate array for seen stories:

const seenStories = [{
  id: 'user1',
  name: 'User 1',
  imgUrl: 'user1-profile-image-url',
  stories: [
    { id: 'story1', is_seen: true, source: { uri: 'story1-image-url' } },
    { id: 'story2', is_seen: false, source: { uri: 'story2-video-url' }, mediaType: 'video' },
    // ...
  ]
},
// ...
];

<InstagramStories
  ref={instagramStoriesRef}
  isVisible={isVisible}
  stories={stories}
  saveProgress={true}
  seenStories={seenStories}
/>

Additional Note:

The saveProgress prop is suitable for device-oriented usage but not for multiple users.

@Adil7767
Copy link
Contributor Author

Adil7767 commented Aug 6, 2024

@LukasFridmansky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant