From 9657786567d503b50f2b88d6ad1b2ff12b72d676 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 15:59:13 +0200 Subject: [PATCH 1/9] Fix JetpackPoweredBottomSheetFeatureConfig - Point to build config field: JETPACK_POWERED_BOTTOM_SHEET - Uncomment the @Feature annotation - Remove the @FeatureInDevelopment annotation - Remove comments and cleanup code --- .../JetpackPoweredBottomSheetFeatureConfig.kt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt index c001db4ea749..efbeb0432191 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt @@ -1,23 +1,16 @@ package org.wordpress.android.util.config import org.wordpress.android.BuildConfig -import org.wordpress.android.annotation.FeatureInDevelopment +import org.wordpress.android.annotation.Feature import javax.inject.Inject -/** - * Configuration for Jetpack Powered Bottom Sheet - * - * TODO: When it is ready to be rolled out uncomment the lines 12 and 19, remove line 13 and this to-do - */ -// @Feature(JetpackPoweredBottomSheetFeatureConfig.JETPACK_POWERED_BOTTOM_SHEET_REMOTE_FIELD, true) -@FeatureInDevelopment -@Suppress("ForbiddenComment") +@Feature(JetpackPoweredBottomSheetFeatureConfig.JETPACK_POWERED_BOTTOM_SHEET_REMOTE_FIELD, true) class JetpackPoweredBottomSheetFeatureConfig @Inject constructor( appConfig: AppConfig ) : FeatureConfig( appConfig, - BuildConfig.JETPACK_POWERED, -// JETPACK_POWERED_BOTTOM_SHEET_REMOTE_FIELD + BuildConfig.JETPACK_POWERED_BOTTOM_SHEET, + JETPACK_POWERED_BOTTOM_SHEET_REMOTE_FIELD ) { companion object { const val JETPACK_POWERED_BOTTOM_SHEET_REMOTE_FIELD = "jetpack_powered_bottom_sheet_remote_field" From 30451b6d360a89ae33523014eb59205b0f70598a Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 17:00:29 +0200 Subject: [PATCH 2/9] Set default of JetpackPoweredBottomSheetFeatureConfig to false --- .../util/config/JetpackPoweredBottomSheetFeatureConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt index efbeb0432191..a8722318d70a 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/JetpackPoweredBottomSheetFeatureConfig.kt @@ -4,7 +4,7 @@ import org.wordpress.android.BuildConfig import org.wordpress.android.annotation.Feature import javax.inject.Inject -@Feature(JetpackPoweredBottomSheetFeatureConfig.JETPACK_POWERED_BOTTOM_SHEET_REMOTE_FIELD, true) +@Feature(JetpackPoweredBottomSheetFeatureConfig.JETPACK_POWERED_BOTTOM_SHEET_REMOTE_FIELD, false) class JetpackPoweredBottomSheetFeatureConfig @Inject constructor( appConfig: AppConfig ) : FeatureConfig( From 3706113b8a7c31c4cf1a4d9073c166239545b617 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 17:43:13 +0200 Subject: [PATCH 3/9] Conditionally show overlay when tapping " Jetpack powered" on activity log detail --- .../ui/activitylog/detail/ActivityLogDetailFragment.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/detail/ActivityLogDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/detail/ActivityLogDetailFragment.kt index 6532b8ed9995..2b57a5d88da2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/detail/ActivityLogDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/detail/ActivityLogDetailFragment.kt @@ -75,9 +75,11 @@ class ActivityLogDetailFragment : Fragment(R.layout.activity_log_item_detail) { if (jetpackBrandingUtils.shouldShowJetpackBranding()) { jetpackBadge.root.isVisible = true - jetpackBadge.jetpackPoweredBadge.setOnClickListener { - jetpackBrandingUtils.trackBadgeTapped(ACTIVITY_LOG_DETAIL) - viewModel.showJetpackPoweredBottomSheet() + if (jetpackBrandingUtils.shouldShowJetpackPoweredBottomSheet()) { + jetpackBadge.jetpackPoweredBadge.setOnClickListener { + jetpackBrandingUtils.trackBadgeTapped(ACTIVITY_LOG_DETAIL) + viewModel.showJetpackPoweredBottomSheet() + } } } } From f140874ac7f4fa1bdc51357d710aae509890d194 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 17:43:53 +0200 Subject: [PATCH 4/9] Conditionally show overlay when tapping " Jetpack powered" on app settings --- .../org/wordpress/android/ui/prefs/AppSettingsFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java index 9303ae4baa12..7e02ceac5c86 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java @@ -249,12 +249,14 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, private void addJetpackBadgeAsFooterIfEnabled(LayoutInflater inflater, ListView listView) { if (mJetpackBrandingUtils.shouldShowJetpackBranding()) { final JetpackBadgeFooterBinding binding = JetpackBadgeFooterBinding.inflate(inflater); - binding.footerJetpackBadge.jetpackPoweredBadge.setOnClickListener(v -> { + if (mJetpackBrandingUtils.shouldShowJetpackPoweredBottomSheet()) { + binding.footerJetpackBadge.jetpackPoweredBadge.setOnClickListener(v -> { mJetpackBrandingUtils.trackBadgeTapped(Screen.APP_SETTINGS); new JetpackPoweredBottomSheetFragment().show( ((AppCompatActivity) getActivity()).getSupportFragmentManager(), JetpackPoweredBottomSheetFragment.TAG); - }); + }); + } listView.addFooterView(binding.getRoot(), null, false); } } From a537badd59727132729a884cb30aaa84e3cfc8a6 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 17:44:09 +0200 Subject: [PATCH 5/9] Conditionally show overlay when tapping " Jetpack powered" on Me page --- .../main/java/org/wordpress/android/ui/main/MeFragment.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt index 6f23d59ccea3..783465ae25ea 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt @@ -129,9 +129,11 @@ class MeFragment : Fragment(R.layout.me_fragment), OnScrollToTopListener { if (jetpackBrandingUtils.shouldShowJetpackBranding()) { jetpackBadge.root.isVisible = true - jetpackBadge.footerJetpackBadge.jetpackPoweredBadge.setOnClickListener { - jetpackBrandingUtils.trackBadgeTapped(ME) - viewModel.showJetpackPoweredBottomSheet() + if (jetpackBrandingUtils.shouldShowJetpackPoweredBottomSheet()) { + jetpackBadge.footerJetpackBadge.jetpackPoweredBadge.setOnClickListener { + jetpackBrandingUtils.trackBadgeTapped(ME) + viewModel.showJetpackPoweredBottomSheet() + } } } From 5255147feb34c91eaae2ad621668f0b5b77c56a0 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 17:44:50 +0200 Subject: [PATCH 6/9] Conditionally show overlay when tapping " Jetpack powered" on notifications settings --- .../NotificationsSettingsFragment.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java index 7da38059fa26..1508540008b8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java @@ -229,12 +229,14 @@ private void addJetpackBadgeAsFooterIfEnabled(ListView listView) { if (mJetpackBrandingUtils.shouldShowJetpackBranding()) { LayoutInflater inflater = LayoutInflater.from(getContext()); final JetpackBadgeFooterBinding binding = JetpackBadgeFooterBinding.inflate(inflater); - binding.footerJetpackBadge.jetpackPoweredBadge.setOnClickListener(v -> { - mJetpackBrandingUtils.trackBadgeTapped(Screen.NOTIFICATIONS_SETTINGS); - new JetpackPoweredBottomSheetFragment().show( - ((AppCompatActivity) getActivity()).getSupportFragmentManager(), - JetpackPoweredBottomSheetFragment.TAG); - }); + if (mJetpackBrandingUtils.shouldShowJetpackPoweredBottomSheet()) { + binding.footerJetpackBadge.jetpackPoweredBadge.setOnClickListener(v -> { + mJetpackBrandingUtils.trackBadgeTapped(Screen.NOTIFICATIONS_SETTINGS); + new JetpackPoweredBottomSheetFragment().show( + ((AppCompatActivity) getActivity()).getSupportFragmentManager(), + JetpackPoweredBottomSheetFragment.TAG); + }); + } listView.addFooterView(binding.getRoot(), null, false); } } From 7424b101a63775d68dabbda5b3152475bc919045 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 17:45:09 +0200 Subject: [PATCH 7/9] Conditionally show overlay when tapping " Jetpack powered" on reader detail --- .../android/ui/reader/ReaderPostDetailFragment.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt index 840a89dce5c3..442ea286814b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt @@ -470,9 +470,10 @@ class ReaderPostDetailFragment : ViewPagerFragment(), likeFacesRecycler.addItemDecoration( AvatarItemDecorator( - RtlUtils.isRtl(activity), - contextProvider.getContext(), - AVATAR_LEFT_OFFSET_DIMEN) + RtlUtils.isRtl(activity), + contextProvider.getContext(), + AVATAR_LEFT_OFFSET_DIMEN + ) ) likeFacesRecycler.layoutManager = layoutManager @@ -715,9 +716,11 @@ class ReaderPostDetailFragment : ViewPagerFragment(), if (jetpackBrandingUtils.shouldShowJetpackBranding()) { binding.jetpackBadge.root.isVisible = true - binding.jetpackBadge.jetpackPoweredBadge.setOnClickListener { - jetpackBrandingUtils.trackBadgeTapped(READER_POST_DETAIL) - viewModel.showJetpackPoweredBottomSheet() + if (jetpackBrandingUtils.shouldShowJetpackPoweredBottomSheet()) { + binding.jetpackBadge.jetpackPoweredBadge.setOnClickListener { + jetpackBrandingUtils.trackBadgeTapped(READER_POST_DETAIL) + viewModel.showJetpackPoweredBottomSheet() + } } } From 8db63175481ec8541427517b5baeb1f1f91defdd Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 17:54:16 +0200 Subject: [PATCH 8/9] Conditionally show overlay when tapping " Jetpack powered" on my site dashboard --- .../org/wordpress/android/ui/mysite/MySiteCardAndItem.kt | 2 +- .../java/org/wordpress/android/ui/mysite/MySiteViewModel.kt | 6 +++++- .../ui/mysite/jetpackbadge/MySiteJetpackBadgeViewHolder.kt | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt index d6a77b550c4f..da2c4081de56 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt @@ -277,6 +277,6 @@ sealed class MySiteCardAndItem(open val type: Type, open val activeQuickStartIte } data class JetpackBadge( - val onClick: ListItemInteraction + val onClick: ListItemInteraction? = null ) : MySiteCardAndItem(JETPACK_BADGE) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt index 577dc95d7702..9fd8aad7945e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt @@ -497,7 +497,11 @@ class MySiteViewModel @Inject constructor( ) val jetpackBadge = JetpackBadge( - ListItemInteraction.create(this::onJetpackBadgeClick) + if (jetpackBrandingUtils.shouldShowJetpackPoweredBottomSheet()) { + ListItemInteraction.create(this::onJetpackBadgeClick) + } else { + null + } ).takeIf { jetpackBrandingUtils.shouldShowJetpackBranding() } return mapOf( diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/jetpackbadge/MySiteJetpackBadgeViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/jetpackbadge/MySiteJetpackBadgeViewHolder.kt index 854bc32972ff..a1cd8343bb39 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/jetpackbadge/MySiteJetpackBadgeViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/jetpackbadge/MySiteJetpackBadgeViewHolder.kt @@ -10,6 +10,8 @@ class MySiteJetpackBadgeViewHolder( parent: ViewGroup, ) : MySiteCardAndItemViewHolder(parent.viewBinding(JetpackBadgeBinding::inflate)) { fun bind(item: JetpackBadge) = with(binding) { - jetpackPoweredBadge.setOnClickListener { item.onClick.click() } + item.onClick?.run { + jetpackPoweredBadge.setOnClickListener { click() } + } } } From 4ec699152d236bc6c8b6dc408e9f606ce1e89da7 Mon Sep 17 00:00:00 2001 From: Ovi Trif Date: Mon, 5 Sep 2022 18:05:05 +0200 Subject: [PATCH 9/9] Revert formatting in initLikeFacesRecycler --- .../android/ui/reader/ReaderPostDetailFragment.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt index 442ea286814b..61d9f68fb86d 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt @@ -470,10 +470,9 @@ class ReaderPostDetailFragment : ViewPagerFragment(), likeFacesRecycler.addItemDecoration( AvatarItemDecorator( - RtlUtils.isRtl(activity), - contextProvider.getContext(), - AVATAR_LEFT_OFFSET_DIMEN - ) + RtlUtils.isRtl(activity), + contextProvider.getContext(), + AVATAR_LEFT_OFFSET_DIMEN) ) likeFacesRecycler.layoutManager = layoutManager