ertgrulll / advstory

An advanced, complete story viewer for Flutter. Has support for images, videos, custom widget contents, gestures, interceptors, listeners, manipulators and much more.
https://advstory.sourcekod.com
MIT License
41 stars 33 forks source link

Naming is a bit confusing #2

Closed jtkeyva closed 2 years ago

jtkeyva commented 2 years ago

Is your feature request related to a problem? Please describe. The terms cluster and story are a bit confusing the way you are using them. I think of a Cluster as a set of Stories. I think of a Story as a set of items/pages/slides. It seems that you are calling each item/slide a story, rather than a story item or page or slide.

storyCount to me would actually be what makes up a cluster. ex a cluster may have 7 stories. so that would be clusterCount: 7 but then that sounds like there are 7 clusters when it actually means there are 7 stories.

Describe the solution you'd like Redefine/rename clusterCount to storyCount ex: how many stories are in tray

Redefine/rename storyCount to storyItemCount ex: how many items within a story

Describe alternatives you've considered N/A

Additional context You may not even need the name cluster anywhere, it's a bit confusing.

Awesome job BTW!

ertgrulll commented 2 years ago

cluster may seem a bit abstract, but it's really necessary. For example, let's say you have users and their stories. Tapping a story tray sends a request to your database to fetch the user's stories. In such a case, you can create story trays without consuming resource and only create groups of stories (clusters) as needed.

clusterCount is the same as the number of trays. Let's say you have 10 users and each has 3 stories, cluster represents a user's all stories. clusterCount should be 10 in this case and storyCount is 3 for each cluster.

jtkeyva commented 2 years ago

Thanks for the explanation, gonna ponder this a bit, but here's my initial thoughts.

I think Cluster is a good concept. It's essentially a group of stories right?

A story is a group of items/content/slides/pages right? Traditionally, a user only ever has 1 never ending story where content evaporates after 24 hours. A user doesn't necessarily have more than 1 story. However, they continually add content to their story. However, even if a user does have more than 1 story; say "my trip to the grocery store" and "me playing the piano". The trip Story has 7 items: walking, the stoplight, a dog, the storefront, in the store, picking fruit, checkout. The paino Story has 5 items: warming up, sheet music, playing chopsticks, playing mozart, laughing at a screw up.

"August 02, 2016. Today, we're introducing Instagram Stories, a new feature that lets you share all the moments of your day, not just the ones you want to keep on your profile. As you share multiple photos and videos, they appear together in a slideshow format: your story."

I think of the tray as a collection of different user's stories. Which to me sounds the same as what a cluster is. So a tray holds a cluster? So then essentially, a page could have 1,3,5,20,100+ different trays/clusters correct?

ertgrulll commented 2 years ago

I think you are talking about something like:

// Somewhere in code
final trays = await myApi.getFeedTrays();

AdvStory(
  // 5 user shared 1 or more pics/videos.
  storyCount: 5,
  storyBuilder: (storyIndex) async {
    // Fetch user story, this story can include 1-20 media.
    final story = await myApi.getStory(id: trays[storyIndex].owner.id);

    return Story(
      itemCount: story.itemCount,
      itemBuilder: (itemIndex) => ImageItem(url: story.items[itemIndex].url),
    );
  },
  trayBuilder: (storyIndex) => AdvStoryTray(url: trays[storyIndex].coverImage),
);

clusterCount -> storyCount clusterBuilder -> storyBuilder Cluster -> Story

storyCount -> itemCount storyBuilder -> itemBuilder Story -> Item

Am I right? If that's less confusing, I can change names in next version. I just used 'story' as the sole media and 'cluster' as the media group. Story seems like a singular word to me, so I used the term 'cluster' to represent a media group owned by the same user, whether that group contains 1 or 100 images/videos.

jtkeyva commented 2 years ago

Yeah, you got it. I think that fully makes sense. I'm wondering if "item" is the right word? I dunno, naming is pretty tough sometimes. Up to you but I think I'm leaning a bit towards slide or content.

Generic, but not vert indicative storyCount -> itemCount storyBuilder -> itemBuilder Story -> Item

Content is decent storyCount -> contentCount storyBuilder -> contentBuilder Story -> Content

Slide is a bit more descriptive storyCount -> slideCount storyBuilder -> slideBuilder Story -> Slide

Page might be a bit confusing storyCount -> pageCount storyBuilder -> pageBuilder Story -> Page

Thanks for your efforts and taking feedback :) I'll try to contribute code too, but I've never submitted a PR

jtkeyva commented 2 years ago

Also I think this is confusing as well:

ImageStory, VideoStory or WidgetStory

I think ImageSlide, VideoSlide or WidgetSlide or ImageContent, VideoContent or WidgetContent makes more sense.

ertgrulll commented 2 years ago

Confusing names changed, changelog includes details. I'm closing issue.

jtkeyva commented 2 years ago

Awesome, congrats on all the progress! Gonna try it out today :)

jtkeyva commented 2 years ago

Awesome!