From eff661117ebddefdf201720245c6fa7e1190a8fe Mon Sep 17 00:00:00 2001 From: ashiagr Date: Thu, 1 Dec 2022 12:19:17 +0530 Subject: [PATCH] Expand stories screens which are not shareable --- .../pocketcasts/endofyear/StoriesPage.kt | 16 ++++++++-------- .../pocketcasts/endofyear/StoriesViewModel.kt | 4 ---- .../repositories/endofyear/stories/Story.kt | 1 + .../endofyear/stories/StoryEpilogue.kt | 1 + .../repositories/endofyear/stories/StoryIntro.kt | 1 + 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesPage.kt b/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesPage.kt index 26d35acf498..57717e5e69c 100644 --- a/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesPage.kt +++ b/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesPage.kt @@ -37,7 +37,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.rememberVectorPainter @@ -204,12 +203,13 @@ private fun StoriesView( } CloseButtonView(onCloseClicked) } - } - requireNotNull(onCaptureBitmap).let { - ShareButton( - onClick = { if (state.showShare) { onShareClicked.invoke(it) } }, - modifier = modifier.alpha(if (state.showShare) 1f else 0f) - ) + if (state.currentStory.shareable) { + requireNotNull(onCaptureBitmap).let { + ShareButton( + onClick = { onShareClicked.invoke(it) }, + ) + } + } } } } @@ -261,7 +261,7 @@ private fun StorySharableContent( @Composable private fun ShareButton( onClick: () -> Unit, - modifier: Modifier, + modifier: Modifier = Modifier, ) { RowOutlinedButton( text = stringResource(id = LR.string.share), diff --git a/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesViewModel.kt b/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesViewModel.kt index a3a39a8e327..65214614361 100644 --- a/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesViewModel.kt +++ b/modules/features/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/StoriesViewModel.kt @@ -11,8 +11,6 @@ import au.com.shiftyjelly.pocketcasts.endofyear.ShareableTextProvider.ShareTextD import au.com.shiftyjelly.pocketcasts.endofyear.StoriesViewModel.State.Loaded.SegmentsData import au.com.shiftyjelly.pocketcasts.repositories.endofyear.EndOfYearManager import au.com.shiftyjelly.pocketcasts.repositories.endofyear.stories.Story -import au.com.shiftyjelly.pocketcasts.repositories.endofyear.stories.StoryEpilogue -import au.com.shiftyjelly.pocketcasts.repositories.endofyear.stories.StoryIntro import au.com.shiftyjelly.pocketcasts.utils.FileUtilWrapper import au.com.shiftyjelly.pocketcasts.utils.SentryHelper import au.com.shiftyjelly.pocketcasts.utils.log.LogBuffer @@ -207,8 +205,6 @@ class StoriesViewModel @Inject constructor( val segmentsData: SegmentsData, val preparingShareText: Boolean = false, ) : State() { - val showShare: Boolean - get() = currentStory !is StoryIntro && currentStory !is StoryEpilogue data class SegmentsData( val widths: List = emptyList(), val xStartOffsets: List = emptyList(), diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/Story.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/Story.kt index ef59e041cac..e686659aeec 100644 --- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/Story.kt +++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/Story.kt @@ -8,4 +8,5 @@ abstract class Story { open val storyLength: Long = 5.seconds() open val backgroundColor: Color = Color.Black val tintColor: Color = Color.White + open val shareable: Boolean = true } diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryEpilogue.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryEpilogue.kt index f2eb67d0b76..11f75b0da62 100644 --- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryEpilogue.kt +++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryEpilogue.kt @@ -2,4 +2,5 @@ package au.com.shiftyjelly.pocketcasts.repositories.endofyear.stories class StoryEpilogue : Story() { override val identifier: String = "epilogue" + override val shareable: Boolean = false } diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryIntro.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryIntro.kt index 123bcaa00f6..cad52badf74 100644 --- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryIntro.kt +++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/endofyear/stories/StoryIntro.kt @@ -4,4 +4,5 @@ import androidx.compose.ui.graphics.Color class StoryIntro : Story() { override val identifier: String = "intro" override val backgroundColor: Color = Color(0xFF1A1A1A) + override val shareable: Boolean = false }