Skip to content

Commit ea63238

Browse files
authored
What's New: Introduce Synced Transcripts feature (#5377)
1 parent 71e3296 commit ea63238

12 files changed

Lines changed: 50 additions & 55 deletions

File tree

β€Žmodules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/whatsnew/ShuffleHeader.ktβ€Ž

Lines changed: 0 additions & 46 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package au.com.shiftyjelly.pocketcasts.settings.whatsnew
2+
3+
import androidx.compose.foundation.Image
4+
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.foundation.layout.padding
6+
import androidx.compose.runtime.Composable
7+
import androidx.compose.ui.Modifier
8+
import androidx.compose.ui.res.painterResource
9+
import androidx.compose.ui.unit.dp
10+
import au.com.shiftyjelly.pocketcasts.images.R as IR
11+
12+
@Composable
13+
fun SyncedTranscriptsHeader(modifier: Modifier = Modifier) {
14+
Image(
15+
painter = painterResource(id = IR.drawable.whats_new_synced_transcripts),
16+
contentDescription = null,
17+
modifier = modifier
18+
.fillMaxWidth()
19+
.padding(bottom = 16.dp),
20+
)
21+
}

β€Žmodules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/whatsnew/WhatsNewPage.ktβ€Ž

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,23 @@ import androidx.compose.ui.graphics.Color
3030
import androidx.compose.ui.platform.LocalConfiguration
3131
import androidx.compose.ui.res.stringResource
3232
import androidx.compose.ui.text.style.TextAlign
33+
import androidx.compose.ui.tooling.preview.Preview
34+
import androidx.compose.ui.tooling.preview.PreviewParameter
3335
import androidx.compose.ui.unit.dp
3436
import androidx.compose.ui.unit.sp
3537
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
38+
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
3639
import au.com.shiftyjelly.pocketcasts.compose.bars.NavigationButton
3740
import au.com.shiftyjelly.pocketcasts.compose.bars.ThemedTopAppBar
3841
import au.com.shiftyjelly.pocketcasts.compose.buttons.RowButton
3942
import au.com.shiftyjelly.pocketcasts.compose.buttons.RowTextButton
4043
import au.com.shiftyjelly.pocketcasts.compose.components.TextH10
4144
import au.com.shiftyjelly.pocketcasts.compose.components.TextP40
45+
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
4246
import au.com.shiftyjelly.pocketcasts.compose.theme
4347
import au.com.shiftyjelly.pocketcasts.settings.whatsnew.WhatsNewViewModel.UiState
4448
import au.com.shiftyjelly.pocketcasts.settings.whatsnew.WhatsNewViewModel.WhatsNewFeature
49+
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
4550

4651
@Composable
4752
fun WhatsNewPage(
@@ -59,7 +64,7 @@ fun WhatsNewPage(
5964
state = uiState,
6065
header = {
6166
when (uiState.feature) {
62-
is WhatsNewFeature.Shuffle -> ShuffleHeader()
67+
is WhatsNewFeature.SyncedTranscripts -> SyncedTranscriptsHeader()
6368
}
6469
},
6570
onConfirm = { viewModel.onConfirm() },
@@ -141,7 +146,7 @@ private fun WhatsNewPageLoaded(
141146
TextP40(
142147
text = stringResource(state.feature.message),
143148
textAlign = TextAlign.Center,
144-
color = MaterialTheme.theme.colors.primaryText01,
149+
color = MaterialTheme.theme.colors.primaryText02,
145150
modifier = Modifier.padding(horizontal = 32.dp).padding(bottom = 8.dp),
146151
)
147152

@@ -174,3 +179,18 @@ private fun WhatsNewPageLoaded(
174179
}
175180
}
176181
}
182+
183+
@Preview(showBackground = true)
184+
@Composable
185+
private fun WhatsNewPagePreview(
186+
@PreviewParameter(ThemePreviewParameterProvider::class) themeType: Theme.ThemeType,
187+
) {
188+
AppThemeWithBackground(themeType) {
189+
WhatsNewPageLoaded(
190+
state = UiState.Loaded(feature = WhatsNewFeature.SyncedTranscripts),
191+
onConfirm = {},
192+
onClose = {},
193+
header = { SyncedTranscriptsHeader() },
194+
)
195+
}
196+
}

β€Žmodules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/whatsnew/WhatsNewViewModel.ktβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class WhatsNewViewModel @Inject constructor() : ViewModel() {
2323

2424
init {
2525
_state.value = UiState.Loaded(
26-
feature = WhatsNewFeature.Shuffle,
26+
feature = WhatsNewFeature.SyncedTranscripts,
2727
)
2828
}
2929

@@ -52,9 +52,9 @@ class WhatsNewViewModel @Inject constructor() : ViewModel() {
5252
val hasOffer: Boolean
5353
val isUserEntitled: Boolean
5454

55-
data object Shuffle : WhatsNewFeature {
56-
override val title = LR.string.shuffle_whats_new_title
57-
override val message = LR.string.shuffle_whats_new_message
55+
data object SyncedTranscripts : WhatsNewFeature {
56+
override val title = LR.string.synced_transcripts_whats_new_title
57+
override val message = LR.string.synced_transcripts_whats_new_message
5858
override val confirmButtonTitle = LR.string.got_it
5959
override val hasOffer = false
6060
override val isUserEntitled = true
14.3 KB
Loading
5.8 KB
Loading
8.73 KB
Loading
21.2 KB
Loading
32.5 KB
Loading
45.7 KB
Loading

0 commit comments

Comments
Β (0)