-
Notifications
You must be signed in to change notification settings - Fork 224
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: Share text #570
Conversation
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 looking good. The 403 errors I was getting is a bit concerning, but that may just be something weird going on with my setup, so I'll go ahead and approve. Let me know if you have any ideas about what might be causing that for me. 🤔
try { | ||
listServerManager.createPodcastList( | ||
title = context.resources.getString( | ||
LR.string.end_of_year_story_top_podcasts_share_text, | ||
"" | ||
), | ||
description = "", | ||
podcasts = story.topPodcasts.map { it.toPodcast() } | ||
) ?: shortURL | ||
} catch (ex: Exception) { | ||
Timber.e(ex) | ||
shortURL | ||
} |
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 api call failed for me with a 403 everytime I tried to share the top 5 podcasts, so I fell through to the generic PC link each time. Not sure what is causing that. I tried both logged-in and logged-out on the staging and prod server with the same result each time. 🤔
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.
Can you confirm if you can share podcasts and episodes in general (from podcasts or episode fragments)?
I'll merge this PR for now. Based on your response, I'll recheck what might be going wrong with this.
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.
Can you confirm if you can share podcasts and episodes in general
Good idea. I'm also getting an error when I try to create a shared list of podcasts from the podcasts page, so I don't think this is an issue with your EOY work (and fwiw, I can share a list with our current production builds, so I must be doing something weird locally).
val currentState = (state.value as State.Loaded) | ||
mutableState.value = currentState.copy(preparingShareText = true) | ||
|
||
val shareTextData = shareableTextProvider.getShareableDataForStory(story) | ||
mutableState.value = currentState.copy(preparingShareText = false) |
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 wonder if there's any way the state could get mutated while we're waiting for the suspended shareableTextProvicer.getShareableDataForStory
call? It doesn't seem likely, but I was able to get a bit of weird behavior by quickly tapping on Story after tapping the Share button (it would jump back to the beginning of the Story sequence). That's probably unrelated to this, but figured I'd mention it.
device-2022-11-14-112608.mp4
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 because StoriesViewModel
initialized inside the StoriesPage
dialog composable is not scoped to it but to the activity/ fragment that contains it. As a workaround, I manually call viewmodel's clear()
and start()
which doesn't seem to be working well.
This SO answer helped me understand it:
Compose does not offer any mechanism to scope ViewModels to an individual @composable - any ViewModels you create outside of a NavHost's destination is scoped to the activity/fragment that contains your ComposeView/where you call setContent and, thus, lives for the entire lifetime of your Compose hierarchy - that's why you always get the same instance back.
Feature request: https://issuetracker.google.com/issues/165642391
I'll open another PR with a fix or temporary workaround.
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.
Do you think that disabling the UI as soon as the Share button is touched might help?
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 switched to DialogFragment
with composable content in #581. I'll shortly make it ready for review and we can test it again if it fixes the issue.
de64293
to
91bbac9
Compare
iOS PR: Automattic/pocket-casts-ios#478
Description
Adds text content for each story shared and for the top podcast(s) and longest episode add a link to them.
How the shared content is handled is up to the app. Some apps work fine with images + text, and some do not. E.g. Facebook app only allows sharing an image.
Testing Instructions
END_OF_YEAR_ENABLED
feature flag totrue
in base.gradleAdditional Tests
Share Text
Checklist
modules/services/localization/src/main/res/values/strings.xml
I have tested any UI changes...