Skip to content

Commit

Permalink
Revert "Merge pull request #625 from Automattic/merge/release-7.27.1-…
Browse files Browse the repository at this point in the history
…to-main"

This reverts commit 95a487a, reversing
changes made to 4a8688a.
  • Loading branch information
ashiagr committed Dec 1, 2022
1 parent 95a487a commit 3acbfd9
Show file tree
Hide file tree
Showing 30 changed files with 94 additions and 282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,8 @@ class MainActivity :
} else if (!settings.getEndOfYearModalHasBeenShown()) {
viewModel.updateStoriesModalShowState(true)
}
} else {
settings.setEndOfYearModalHasBeenShown(false)
}

if (signinState.isSignedInAsPlus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ 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 @@ -203,13 +204,12 @@ private fun StoriesView(
}
CloseButtonView(onCloseClicked)
}
if (state.currentStory.shareable) {
requireNotNull(onCaptureBitmap).let {
ShareButton(
onClick = { onShareClicked.invoke(it) },
)
}
}
}
requireNotNull(onCaptureBitmap).let {
ShareButton(
onClick = { if (state.showShare) { onShareClicked.invoke(it) } },
modifier = modifier.alpha(if (state.showShare) 1f else 0f)
)
}
}
}
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,6 +11,8 @@ 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 @@ -205,6 +207,8 @@ 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 @@ -4,7 +4,6 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
Expand All @@ -14,8 +13,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Matrix
import androidx.compose.ui.graphics.drawscope.withTransform
Expand All @@ -33,15 +30,14 @@ import au.com.shiftyjelly.pocketcasts.compose.components.TextH30
import au.com.shiftyjelly.pocketcasts.compose.components.TextH40
import au.com.shiftyjelly.pocketcasts.compose.components.TextH70
import au.com.shiftyjelly.pocketcasts.endofyear.R
import au.com.shiftyjelly.pocketcasts.endofyear.utils.FadeDirection
import au.com.shiftyjelly.pocketcasts.endofyear.utils.dynamicBackground
import au.com.shiftyjelly.pocketcasts.utils.extensions.pxToDp

private const val PillarRotationAngle = -30f
private const val PillarTextSkew = 0.5f
private const val PillarTopAspectRatio = .58f
private val PillarBaseColor = Color(0xFFFE7E61)
private val Black24 = Color(0x3D000000)
private val PillarGradientStartColor = Color(0xFFFE7E61)
private val PillarGradientEndColor = Color(0x003C1F5D)
private val PillarColor = Color(0xFFFE7E61)

@Composable
fun CategoryPillar(
Expand Down Expand Up @@ -118,22 +114,17 @@ private fun Pillar(
val pillarTopAspectRatio = PillarTopAspectRatio
val pillarTopHeight = width * pillarTopAspectRatio
Box {
Row {
Box(
modifier = modifier
.width(width / 2f)
.height(height)
.padding(top = pillarTopHeight / 2)
.leftPillarBackground()
)
Box(
modifier = modifier
.width(width / 2f)
.height(height)
.padding(top = pillarTopHeight / 2)
.rightPillarBackground()
)
}
Box(
modifier = modifier
.width(width)
.height(height)
.padding(top = pillarTopHeight / 2)
.dynamicBackground(
baseColor = PillarColor,
colorStops = listOf(Color.Black, Color.Transparent),
direction = FadeDirection.TopToBottom
)
)
Box {
Image(
painter = painterResource(R.drawable.rectangle),
Expand Down Expand Up @@ -173,41 +164,3 @@ private fun Pillar(
}
}
}

fun Modifier.leftPillarBackground() =
graphicsLayer {
alpha = 0.99f
}.drawWithContent {
drawRect(color = PillarBaseColor)
drawRect(
brush = Brush.verticalGradient(
listOf(Black24, Color.Black),
startY = Float.POSITIVE_INFINITY,
endY = 0f,
),
blendMode = BlendMode.DstIn
)
drawRect(
brush = Brush.verticalGradient(
listOf(PillarGradientStartColor, PillarGradientEndColor),
startY = 0f,
endY = Float.POSITIVE_INFINITY,
),
blendMode = BlendMode.DstIn
)
}

fun Modifier.rightPillarBackground() =
graphicsLayer {
alpha = 0.99f
}.drawWithContent {
drawRect(color = PillarBaseColor)
drawRect(
brush = Brush.verticalGradient(
listOf(PillarGradientStartColor, PillarGradientEndColor),
startY = 0f,
endY = Float.POSITIVE_INFINITY,
),
blendMode = BlendMode.DstIn
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.components.TextH20
import au.com.shiftyjelly.pocketcasts.compose.components.TextP40

private const val MaxFontScale = 1.15f

@Composable
fun StoryPrimaryText(
text: String,
Expand All @@ -25,7 +22,6 @@ fun StoryPrimaryText(
text = text,
textAlign = TextAlign.Center,
color = color,
disableScale = disableScale(),
modifier = modifier
.fillMaxWidth()
.padding(horizontal = 40.dp)
Expand All @@ -43,13 +39,9 @@ fun StorySecondaryText(
textAlign = TextAlign.Center,
color = color,
fontWeight = FontWeight.Bold,
disableScale = disableScale(),
modifier = modifier
.fillMaxWidth()
.alpha(0.8f)
.padding(horizontal = 40.dp)
)
}

@Composable
fun disableScale() = LocalDensity.current.fontScale > MaxFontScale
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package au.com.shiftyjelly.pocketcasts.endofyear.views.stories

import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -23,10 +17,8 @@ import androidx.compose.material.Icon
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand All @@ -36,7 +28,6 @@ import au.com.shiftyjelly.pocketcasts.endofyear.R
import au.com.shiftyjelly.pocketcasts.endofyear.components.PodcastLogoWhite
import au.com.shiftyjelly.pocketcasts.endofyear.components.StoryPrimaryText
import au.com.shiftyjelly.pocketcasts.endofyear.components.StorySecondaryText
import au.com.shiftyjelly.pocketcasts.endofyear.components.disableScale
import au.com.shiftyjelly.pocketcasts.repositories.endofyear.stories.StoryEpilogue
import au.com.shiftyjelly.pocketcasts.localization.R as LR

Expand All @@ -61,7 +52,7 @@ fun StoryEpilogueView(

Spacer(modifier = modifier.weight(1f))

PulsatingHeart()
HeartImage()

Spacer(modifier = modifier.weight(0.34f))

Expand All @@ -79,31 +70,20 @@ fun StoryEpilogueView(

PodcastLogoWhite()

Spacer(modifier = modifier.height(30.dp))
Spacer(modifier = modifier.height(40.dp))
}
}

@Composable
private fun PulsatingHeart(
private fun HeartImage(
modifier: Modifier = Modifier,
) {
val infiniteTransition = rememberInfiniteTransition()
val scale by infiniteTransition.animateFloat(
initialValue = 1f,
targetValue = 1.2f,
animationSpec = infiniteRepeatable(
animation = tween(500),
repeatMode = RepeatMode.Reverse
)
Image(
painter = painterResource(id = R.drawable.heart),
contentDescription = null,
modifier = modifier
.size(HeartImageSize)
)
Box(modifier = Modifier.scale(scale)) {
Image(
painter = painterResource(id = R.drawable.heart),
contentDescription = null,
modifier = modifier
.size(HeartImageSize)
)
}
}

@Composable
Expand Down Expand Up @@ -146,7 +126,6 @@ private fun ReplayButton(
TextP40(
text = stringResource(id = LR.string.end_of_year_replay),
color = Color.Black,
disableScale = disableScale(),
modifier = modifier.padding(2.dp)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Surface
Expand All @@ -17,7 +18,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
Expand All @@ -42,7 +42,7 @@ fun StoryIntroView(
.fillMaxSize()
.verticalScroll(rememberScrollState()),
) {
Spacer(modifier = modifier.weight(1f))
Spacer(modifier = modifier.height(40.dp))

Image(
painter = painterResource(R.drawable.img_2022_big),
Expand All @@ -59,7 +59,7 @@ fun StoryIntroView(

PodcastLogoWhite()

Spacer(modifier = modifier.height(30.dp))
Spacer(modifier = modifier.padding(bottom = 40.dp))
}
}

Expand All @@ -68,13 +68,7 @@ private fun PrimaryText(
story: StoryIntro,
modifier: Modifier,
) {
val language = Locale.current.language
val textResId = if (language == "en") {
LR.string.end_of_year_story_intro_title_english_only
} else {
LR.string.end_of_year_story_intro_title
}
val text = stringResource(id = textResId)
val text = stringResource(id = LR.string.end_of_year_story_intro_title)
StoryPrimaryText(text = text, color = story.tintColor, modifier = modifier)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.components.CoverSize
import au.com.shiftyjelly.pocketcasts.compose.components.PodcastCover
import au.com.shiftyjelly.pocketcasts.compose.components.PodcastCoverType
import au.com.shiftyjelly.pocketcasts.compose.components.transformPodcastCover
import au.com.shiftyjelly.pocketcasts.endofyear.components.PodcastLogoWhite
import au.com.shiftyjelly.pocketcasts.endofyear.components.StoryPrimaryText
Expand Down Expand Up @@ -59,7 +59,7 @@ fun StoryListenedCategoriesView(

PodcastLogoWhite()

Spacer(modifier = modifier.height(30.dp))
Spacer(modifier = modifier.height(40.dp))
}
}

Expand All @@ -70,7 +70,7 @@ private fun PodcastCoverStack(
) {
val context = LocalContext.current
val currentLocalView = LocalView.current
val coverWidth = (currentLocalView.width.pxToDp(context).dp) / 2.2f
val coverWidth = (currentLocalView.width.pxToDp(context).dp) / 2.5f

Box {
(0..2).reversed().forEach { index ->
Expand All @@ -83,7 +83,7 @@ private fun PodcastCoverStack(
PodcastCover(
uuid = story.listenedCategories[podcastIndex].mostListenedPodcastId,
coverWidth = coverWidth,
coverSize = CoverSize.BIG
coverType = PodcastCoverType.BIG
)
}
}
Expand Down
Loading

0 comments on commit 3acbfd9

Please sign in to comment.