-
Notifications
You must be signed in to change notification settings - Fork 226
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
End of Year: Add stories datasource + gestures #486
Conversation
import au.com.shiftyjelly.pocketcasts.utils.seconds | ||
|
||
abstract class Story { | ||
val storyLength: Long = 2.seconds() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Story length is currently the same for all stories. It'll be made dynamic in a future PR.
} | ||
} | ||
}, | ||
onLongPress = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used onLongPress
tap gesture to pause the story. It takes sometime for the story to pause while the tap qualifies as a long press tap. I can improve this behavior later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working great. Nice work Ashita!
.pointerInput(Unit) { | ||
detectTapGestures( | ||
onTap = { | ||
if (!isPaused) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to find a way to trigger onTap
while onPause
was true
. This obviously isn't doing any harm, but maybe with the press and long press handling we don't need to track the onPause
state manually anymore? Or maybe I just didn't find the right way to trigger it. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onPress
gets triggered for both onTap
and onLongPress
and I want to re-start the timer only when onLongPress
is triggered which is why I'm manually tracking onPause
state. I'll see if I can improve this behavior as I noted here.
Thank you for finding all these discussion points!
|
||
private var currentIndex: Int = 0 | ||
private val nextIndex | ||
get() = (currentIndex.plus(1)).coerceAtMost(numOfStories.minus(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping the next index at the last story means that skipping forward on the last story restarts the last story. This might be fine, but I just wanted to mention it because I could see it being a bit confusing to a user. Of course, skipping to the end and having nothing else to play could also be confusing, so I don't really have a specific suggestion here, more just food for thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep the current behavior for now. I thought of starting from the beginning for this scenario but if there are several stories, it might not be a pleasant experience going through all stories. And as you mentioned, skipping to the end and having nothing else to play could also be confusing.
iOS PR: Automattic/pocket-casts-ios#389
Description
This PR adds a data source to populate the Stories view with stories and also adds a few gestures.
Currently, it just updates the background color of the StoryView. Different story views will be added in future PRs.
story_datasource_and_gestures.mp4
To test
END_OF_YEAR_ENABLED
feature flag totrue
inbase.gradle
Loading and error
EndOfYearStoriesDataSource.loadStories
stories_loading_and_error.mp4
Checklist