-
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: Story snapshot and share #505
Conversation
Use stateIn on the resulting flow returned by combine https://rb.gy/ew2iqy
6fff28a
to
94276c7
Compare
If true - StoryView is a child of StorySwitcher, all inputs to interactive elements of StoryView are consumed by the elements and other inputs are passed to the parent. If false - StorySwitcher is laid over StoryView and it takes all inputs.
Temporary changes to fit layout to screen size
intent.type = "image/png" | ||
val uri = FileUtil.createUriWithReadPermissions(file, intent, requireContext()) | ||
intent.putExtra(Intent.EXTRA_STREAM, uri) | ||
shareLauncher.launch(Intent.createChooser(intent, context.getString(LR.string.end_of_year_share_via))) |
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 launches share intent with an edit button. On clicking "edit" from the chooser, an exception is seen in logcat:
Writing exception to parcel
java.lang.SecurityException: Permission Denial: writing androidx.core.content.FileProvider uri content://<path > requires the provider be exported, or grantUriPermission()
I tried to grant FLAG_GRANT_WRITE_URI_PERMISSION
locally but it didn't help. Strangely, testing on an emulator shows logs even for reading the file. Also see related SO discussions link 1, link2.
Sharing and editing work without problems. I still have to see why these logs are shown. Let me know if you have any suggestions. Another option is to not show the edit button, the share dialog will look this way then:
.../features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/views/SnapShot.kt
Outdated
Show resolved
Hide resolved
items(story.podcasts.size) { index -> | ||
PodcastItem( | ||
podcast = story.podcasts[index], | ||
iconSize = getIconSize(screenHeight, textFieldHeight, context), |
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 an adjustment for the icon size for the "fake story view" so that the entire list is visible on the screen for taking a snapshot.
Note that iOS locks the screen to portrait and captures only the visible screen. Unlike Android, they don't seem to have split screen feature on mobile which can reduce the screen height considerably. They also convert the dialog to a small modal on iPad. This is not yet done on Android.
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 looks good and is working well. I left a few comments, but they're mostly related to code style and I don't consider any of them blockers, so I'll go ahead and approve.
There were a couple of odd things I ran across in testing this...
1. Sudden speed up in Stories
Exactly one time while testing this, I found that after I returned from Sharing a story that the Stories started to run extremely fast (If I tapped to go back to the first story, the little slider for that story would complete in well under 1 second).
I have not been able to reproduce this, so it may be nothing, but I wanted to mention it in case you see it too at some point.
2. It is possible to open the full screen player behind the "Your Year in Podcasts" bottom sheet
When the "Your Year in Podcasts" bottom sheet shows, it is possible to swipe up to open the full screen player. This certainly doesn't need to be addressed in this PR.
device-2022-10-31-132159.mp4
.../features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/views/SnapShot.kt
Outdated
Show resolved
Hide resolved
.../features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/views/SnapShot.kt
Outdated
Show resolved
Hide resolved
...s/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesScreen.kt
Outdated
Show resolved
Hide resolved
...s/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesScreen.kt
Outdated
Show resolved
Hide resolved
.../features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/views/SnapShot.kt
Outdated
Show resolved
Hide resolved
modules/services/utils/src/main/java/au/com/shiftyjelly/pocketcasts/utils/FileUtilWrapper.kt
Outdated
Show resolved
Hide resolved
…casts/utils/FileUtilWrapper.kt Co-authored-by: Matt Chowning <[email protected]>
Thank you for all the great suggestions, @mchowning! I've addressed your comments except the following:
I'll add them to the main task and address them in future PRs. |
iOS PR: Automattic/pocket-casts-ios#404
Description
This PR
Generates an image for the latest story and passes it to the share intent.
The image generation uses Android's
view.drawToBitmap()
function. Selected story's sharable composable is converted toComposeView
and laid out intoAndroidView
otherwise an exception is thrown:java.lang.IllegalStateException: View needs to be laid out before calling drawToBitmap()
It only captures the visible screen.
The share button click action invokes a callback that generates the bitmap, saves it, and opens it in
share
view.Includes two other changes:
isInteractive
story 052069bTesting Instructions
END_OF_YEAR_ENABLED
feature flag totrue
inbase.gradle
Screenshots or Screencast
Checklist
modules/services/localization/src/main/res/values/strings.xml
I have tested any UI changes...