Skip to content

Commit

Permalink
Merge branch 'main' into issue/303-sync-skip-time-settings
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
ashiagr committed Dec 9, 2022
2 parents 8331086 + a0a30d5 commit 07b004e
Show file tree
Hide file tree
Showing 43 changed files with 702 additions and 204 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
7.29
-----
* Bug Fixes:

* Bug Fixes:
* Fixed podcast date format
([#477](https://github.com/Automattic/pocket-casts-android/pull/477)).
* Fix unable to permanently change "Skip back time" setting
([#632](https://github.com/Automattic/pocket-casts-android/pull/632)).

Expand All @@ -11,8 +14,10 @@
([#575](https://github.com/Automattic/pocket-casts-android/pull/575)).
* Fixed miniplayer play icon animation on theme change
([#527](https://github.com/Automattic/pocket-casts-android/pull/527)).
* Fixed podcast date format
([#477](https://github.com/Automattic/pocket-casts-android/pull/477)).
* Fixed talkback issues
([#630](https://github.com/Automattic/pocket-casts-android/pull/630)).
* Fixed skip forward/ backward buttons not showing in media notification while casting
([#630](https://github.com/Automattic/pocket-casts-android/pull/630)).

7.27
-----
Expand Down
44 changes: 26 additions & 18 deletions app/src/main/java/au/com/shiftyjelly/pocketcasts/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.widget.Toolbar
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.platform.ComposeView
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import androidx.fragment.app.Fragment
Expand All @@ -32,7 +33,6 @@ import au.com.shiftyjelly.pocketcasts.account.onboarding.OnboardingActivityContr
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsTrackerWrapper
import au.com.shiftyjelly.pocketcasts.analytics.FirebaseAnalyticsTracker
import au.com.shiftyjelly.pocketcasts.compose.AppTheme
import au.com.shiftyjelly.pocketcasts.databinding.ActivityMainBinding
import au.com.shiftyjelly.pocketcasts.discover.view.DiscoverFragment
import au.com.shiftyjelly.pocketcasts.endofyear.StoriesFragment
Expand Down Expand Up @@ -202,7 +202,9 @@ class MainActivity :
lifecycleScope.launchWhenCreated {
val isEligible = viewModel.isEndOfYearStoriesEligible()
if (isEligible) {
showEndOfYearLaunchBottomSheet()
if (!settings.getEndOfYearModalHasBeenShown()) {
setupEndOfYearLaunchBottomSheet()
}
if (settings.getEndOfYearShowBadge2022()) {
binding.bottomNavigation.getOrCreateBadge(VR.id.navigation_profile)
}
Expand Down Expand Up @@ -505,23 +507,28 @@ class MainActivity :
showBottomSheet(UpNextFragment.newInstance(source = source))
}

private fun showEndOfYearLaunchBottomSheet() {
binding.modalBottomSheet.setContent {
AppTheme(theme.activeTheme) {
val shouldShow by viewModel.shouldShowStoriesModal.collectAsState()
EndOfYearLaunchBottomSheet(
shouldShow = shouldShow,
onClick = {
showStoriesOrAccount(StoriesSource.MODAL.value)
},
onExpanded = {
analyticsTracker.track(AnalyticsEvent.END_OF_YEAR_MODAL_SHOWN)
settings.setEndOfYearModalHasBeenShown(true)
viewModel.updateStoriesModalShowState(false)
}
)
private fun setupEndOfYearLaunchBottomSheet() {
val viewGroup = binding.modalBottomSheet
viewGroup.removeAllViews()
viewGroup.addView(
ComposeView(viewGroup.context).apply {
setContent {
val shouldShow by viewModel.shouldShowStoriesModal.collectAsState()
EndOfYearLaunchBottomSheet(
parent = viewGroup,
shouldShow = shouldShow,
onClick = {
showStoriesOrAccount(StoriesSource.MODAL.value)
},
onExpanded = {
analyticsTracker.track(AnalyticsEvent.END_OF_YEAR_MODAL_SHOWN)
settings.setEndOfYearModalHasBeenShown(true)
viewModel.updateStoriesModalShowState(false)
}
)
}
}
}
)
}

override fun showStoriesOrAccount(source: String) {
Expand Down Expand Up @@ -599,6 +606,7 @@ class MainActivity :
viewModel.waitingForSignInToShowStories = false
} else if (!settings.getEndOfYearModalHasBeenShown()) {
viewModel.updateStoriesModalShowState(true)
setupEndOfYearLaunchBottomSheet()
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
android:clickable="true"
android:translationZ="200dp"/>

<androidx.compose.ui.platform.ComposeView
<FrameLayout
android:id="@+id/modalBottomSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
1 change: 1 addition & 0 deletions base.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ dependencies {
implementation androidLibs.flexbox
implementation androidLibs.composeActivity
implementation androidLibs.composeAnimation
implementation androidLibs.composeConstraint
implementation androidLibs.composeIcons
implementation androidLibs.composeLiveData
implementation androidLibs.composeMaterial
Expand Down
3 changes: 2 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ project.ext {
browser: "androidx.browser:browser:1.4.0",
percent: "androidx.percentlayout:percentlayout:1.0.0-rc02",
preference: "androidx.preference:preference:1.2.0",
cast: "com.google.android.gms:play-services-cast-framework:21.1.0",
cast: "com.google.android.gms:play-services-cast-framework:21.2.0",
desugarJdk: "com.android.tools:desugar_jdk_libs:1.1.5",
// Firebase BoM (Bill of Materials enables you to manage all your Firebase library versions by specifying only one version)
firebaseBom: "com.google.firebase:firebase-bom:30.5.0",
Expand Down Expand Up @@ -157,6 +157,7 @@ project.ext {
viewPager: "androidx.viewpager2:viewpager2:1.0.0",
composeActivity: "androidx.activity:activity-compose:1.5.1",
composeAnimation: "androidx.compose.animation:animation:$versionCompose",
composeConstraint: "androidx.constraintlayout:constraintlayout-compose:1.0.1",
composeIcons: "androidx.compose.material:material-icons-extended:$versionCompose",
composeLiveData: "androidx.compose.runtime:runtime-livedata:$versionCompose",
composeMaterial: "androidx.compose.material:material:$versionCompose",
Expand Down
28 changes: 28 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ PLAY_STORE_TRACK_AUTOMOTIVE_BETA = "automotive:beta"
PLAY_STORE_TRACK_AUTOMOTIVE_PRODUCTION = "automotive:production"
PLAY_STORE_TRACK_BETA = "beta"
PLAY_STORE_TRACK_PRODUCTION = "production"
GLOTPRESS_APP_STRINGS_PROJECT_URL = 'https://translate.wordpress.com/projects/pocket-casts/android/'

SUPPORTED_LOCALES = [
{ glotpress: "ar", android: "ar", google_play: "ar", promo_config: {}},
{ glotpress: "de", android: "de", google_play: "de-DE", promo_config: {} },
{ glotpress: "es", android: "es", google_play: "es-ES", promo_config: {} },
{ glotpress: "es", android: "es-rMX", google_play: "es-MX", promo_config: {} },
{ glotpress: "en-gb", android: "en-rGB", google_play: "en-GB", promo_config: {} },
{ glotpress: "fr", android: "fr", google_play: "fr-FR", promo_config: {} },
{ glotpress: "fr", android: "fr-rCA", google_play: "fr-CA", promo_config: {} },
{ glotpress: "it", android: "it", google_play: "it-IT", promo_config: {} },
{ glotpress: "ja", android: "ja", google_play: "ja-JP", promo_config: {} },
{ glotpress: "nl", android: "nl", google_play: "nl-NL", promo_config: {} },
{ glotpress: "nl", android: "nb", google_play: "nb-NB", promo_config: {} },
{ glotpress: "pt-br", android: "pt-rBR", google_play: "pt-BR", promo_config: {} },
{ glotpress: "ru", android: "ru", google_play: "ru-RU", promo_config: {} },
{ glotpress: "sv", android: "sv", google_play: "sv-SE", promo_config: {} },
{ glotpress: "zh-cn", android: "zh", google_play: "zh-CN", promo_config: {} },
{ glotpress: "zh-tw", android: "zh-rTW", google_play: "zh-TW", promo_config: {} },
].freeze

########################################################################
# Environment
Expand Down Expand Up @@ -169,6 +189,14 @@ platform :android do

version = android_get_release_version()

# Download Localizations
android_download_translations(
res_dir: File.join('modules', 'services', 'localization', 'src', 'main', 'res'),
glotpress_url: GLOTPRESS_APP_STRINGS_PROJECT_URL,
locales: SUPPORTED_LOCALES,
lint_task: 'lintRelease'
)

# Wrap up
removebranchprotection(repository:GH_REPOSITORY, branch: "release/#{version["name"]}")
setfrozentag(repository:GH_REPOSITORY, milestone: version["name"], freeze: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import au.com.shiftyjelly.pocketcasts.account.onboarding.import.OnboardingImportFlow
import au.com.shiftyjelly.pocketcasts.account.onboarding.import.OnboardingImportFlow.importFlowGraph
import au.com.shiftyjelly.pocketcasts.account.onboarding.recommendations.OnboardingRecommendationsFlow
import au.com.shiftyjelly.pocketcasts.account.onboarding.recommendations.OnboardingRecommendationsFlow.onboardingRecommendationsFlowGraph
import au.com.shiftyjelly.pocketcasts.account.onboarding.upgrade.OnboardingPlusUpgradeFlow
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsTrackerWrapper
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
Expand Down Expand Up @@ -47,6 +51,21 @@ fun OnboardingFlowComposable(
navController = navController,
startDestination = OnboardingNavRoute.logInOrSignUp
) {

importFlowGraph(navController)

onboardingRecommendationsFlowGraph(
onShown = { analyticsTracker.track(AnalyticsEvent.RECOMMENDATIONS_SHOWN) },
onBackPressed = {
analyticsTracker.track(AnalyticsEvent.RECOMMENDATIONS_DISMISSED)
completeOnboarding()
},
onComplete = {
navController.navigate(OnboardingNavRoute.plusUpgrade)
},
navController = navController,
)

composable(OnboardingNavRoute.logInOrSignUp) {
OnboardingLoginOrSignUpPage(
onNotNowClicked = {
Expand Down Expand Up @@ -77,7 +96,7 @@ fun OnboardingFlowComposable(
navController.popBackStack()
},
onAccountCreated = {
navController.navigate(OnboardingNavRoute.recommendationsFlow) {
navController.navigate(OnboardingRecommendationsFlow.route) {
// clear backstack after account is created
popUpTo(OnboardingNavRoute.logInOrSignUp) {
inclusive = true
Expand Down Expand Up @@ -114,27 +133,6 @@ fun OnboardingFlowComposable(
)
}

composable(OnboardingNavRoute.recommendationsFlow) {
OnboardingRecommendationsFlow(
onShown = {
analyticsTracker.track(AnalyticsEvent.RECOMMENDATIONS_SHOWN)
},
onBackPressed = {
analyticsTracker.track(AnalyticsEvent.RECOMMENDATIONS_DISMISSED)
completeOnboarding()
},
onComplete = {
navController.navigate(
if (signInState?.isSignedInAsPlus == false) {
OnboardingNavRoute.plusUpgrade
} else {
OnboardingNavRoute.welcome
}
)
}
)
}

composable(OnboardingNavRoute.plusUpgrade) {
OnboardingPlusUpgradeFlow(
onBackPressed = { navController.popBackStack() },
Expand All @@ -149,11 +147,13 @@ fun OnboardingFlowComposable(
},
)
}

composable(OnboardingNavRoute.welcome) {
OnboardingWelcomePage(
isSignedInAsPlus = signInState?.isSignedInAsPlus ?: false,
onContinue = completeOnboarding,
onContinueToDiscover = completeOnboardingToDiscover,
onImportTapped = { navController.navigate(OnboardingImportFlow.route) },
onBackPressed = { navController.popBackStack() },
)
}
Expand All @@ -172,12 +172,11 @@ private object AnalyticsProp {
}

private object OnboardingNavRoute {
const val logInOrSignUp = "log_in_or_sign_up"
const val createFreeAccount = "create_free_account"
const val forgotPassword = "forgot_password"
const val logIn = "log_in"
const val logInGoogle = "log_in_google"
const val forgotPassword = "forgot_password"
const val recommendationsFlow = "recommendationsFlow"
const val logInOrSignUp = "log_in_or_sign_up"
const val plusUpgrade = "upgrade_upgrade"
const val welcome = "welcome"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Card
import androidx.compose.material.Divider
import androidx.compose.material.Icon
Expand All @@ -34,6 +37,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import au.com.shiftyjelly.pocketcasts.account.onboarding.upgrade.OnboardingPlusFeatures
import au.com.shiftyjelly.pocketcasts.account.viewmodel.OnboardingWelcomeState
import au.com.shiftyjelly.pocketcasts.account.viewmodel.OnboardingWelcomeViewModel
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
Expand All @@ -53,6 +57,7 @@ fun OnboardingWelcomePage(
isSignedInAsPlus: Boolean,
onContinue: () -> Unit,
onContinueToDiscover: () -> Unit,
onImportTapped: () -> Unit,
onBackPressed: () -> Unit,
) {

Expand All @@ -78,6 +83,7 @@ fun OnboardingWelcomePage(
Content(
isSignedInAsPlus = isSignedInAsPlus,
onContinueToDiscover = onContinueToDiscover,
onImportTapped = onImportTapped,
state = state,
onContinue = onContinue,
onNewsletterCheckedChanged = viewModel::updateNewsletter
Expand All @@ -88,11 +94,17 @@ fun OnboardingWelcomePage(
private fun Content(
isSignedInAsPlus: Boolean,
onContinueToDiscover: () -> Unit,
onImportTapped: () -> Unit,
state: OnboardingWelcomeState,
onContinue: () -> Unit,
onNewsletterCheckedChanged: (Boolean) -> Unit
onNewsletterCheckedChanged: (Boolean) -> Unit,
) {
Column(Modifier.padding(horizontal = 24.dp)) {
Column(
Modifier
.padding(horizontal = 24.dp)
.fillMaxHeight()
.verticalScroll(rememberScrollState())
) {
Spacer(modifier = Modifier.weight(1f))

if (isSignedInAsPlus) {
Expand All @@ -113,6 +125,15 @@ private fun Content(
modifier = Modifier.padding(end = 8.dp)
)

Spacer(Modifier.height(24.dp))
CardSection(
titleRes = LR.string.onboarding_import_podcasts_title,
descriptionRes = LR.string.onboarding_import_podcasts_text,
actionRes = LR.string.onboarding_import_podcasts_button,
iconRes = IR.drawable.pc_bw_import,
onClick = onImportTapped
)

Spacer(Modifier.height(24.dp))
CardSection(
titleRes = LR.string.onboarding_welcome_recommendations_title,
Expand Down Expand Up @@ -277,6 +298,7 @@ private fun OnboardingWelcomePagePreview(@PreviewParameter(ThemePreviewParameter
OnboardingWelcomePage(
onContinue = {},
onContinueToDiscover = {},
onImportTapped = {},
onBackPressed = {},
isSignedInAsPlus = false
)
Expand All @@ -288,12 +310,13 @@ private fun OnboardingWelcomePagePreview(@PreviewParameter(ThemePreviewParameter
private fun OnboardingWelcomePagePlusPreview(@PreviewParameter(ThemePreviewParameterProvider::class) themeType: Theme.ThemeType) {
AppThemeWithBackground(themeType) {
Content(
onContinue = {},
onContinueToDiscover = {},
isSignedInAsPlus = true,
onContinueToDiscover = {},
onImportTapped = {},
state = OnboardingWelcomeState(
newsletter = false
),
onContinue = {},
onNewsletterCheckedChanged = {},
)
}
Expand Down
Loading

0 comments on commit 07b004e

Please sign in to comment.