Skip to content

Commit

Permalink
Expand stories screens which are not shareable
Browse files Browse the repository at this point in the history
  • Loading branch information
ashiagr committed Dec 1, 2022
1 parent e4fb26e commit eff6611
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) },
)
}
}
}
}
}
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Float> = emptyList(),
val xStartOffsets: List<Float> = emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit eff6611

Please sign in to comment.