Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 24.2 code freeze to trunk #20128

Merged
merged 32 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5b54a1e
Implement createIntentShowReaderSubs in ReaderActivityLauncher
RenanLukas Feb 1, 2024
8066f2f
Implement ReaderSubsActivity activity result in ReaderPostListFragmen…
RenanLukas Feb 1, 2024
31d126c
Check if subscribed tags have changed in ReaderSubsActivity
RenanLukas Feb 1, 2024
ddcf6cb
Reset is first data loaded flag on onAttach
RenanLukas Feb 1, 2024
42f24c3
Check if subscribed blogs have changed in ReaderSubsActivity
RenanLukas Feb 1, 2024
beae7b9
Extract setResult and initReaderSubsActivityResultLauncher methods
RenanLukas Feb 1, 2024
39d6127
Refresh number of tags in subscriptions chip when returning from mana…
RenanLukas Feb 2, 2024
4e67cfc
Merge branch 'feature/reader-ia' into issue/20012-subscribing-tag-upd…
RenanLukas Feb 2, 2024
39bb3e7
Merge branch 'trunk' into issue/20012-subscribing-tag-update-filter-pill
RenanLukas Feb 4, 2024
f9ec236
Fix checkstyle
RenanLukas Feb 5, 2024
7b51bf2
Remove logic that makes latest added tag selected when moving to Read…
RenanLukas Feb 5, 2024
7cc8a32
Bump version number
wpmobilebot Feb 5, 2024
c54f258
Update draft release notes for 24.2.
wpmobilebot Feb 5, 2024
9f88fa5
Update draft release notes for Jetpack 24.2.
wpmobilebot Feb 5, 2024
bf06328
Release Notes: add new section for next version (24.3)
wpmobilebot Feb 5, 2024
23e8fa3
Remove hasChangedSelectedBlogs logic
RenanLukas Feb 5, 2024
b17aacc
Remove unrelated release notes for WP/JP
spencertransier Feb 5, 2024
dc9d7c1
Freeze strings for translation
wpmobilebot Feb 5, 2024
bcc72b8
Fix checkstyle
RenanLukas Feb 5, 2024
e4c4f93
Remove unused code
RenanLukas Feb 6, 2024
9196d36
Fix checkstyle
RenanLukas Feb 6, 2024
16cae76
Remove unused import from ReaderBlogAdapter
RenanLukas Feb 6, 2024
e97bad8
Delete unused old top bar and associated resources
Feb 5, 2024
b05e5f0
Change Reader quick start task strings and auto-complete it
Feb 5, 2024
448086c
Complete the Reader QS task when showing the snackbar
Feb 6, 2024
1828b60
Revert quick_start_span strings
Feb 6, 2024
eb28864
Merge pull request #20113 from wordpress-mobile/issue/20012-subscribi…
RenanLukas Feb 6, 2024
818bd93
Merge pull request #20130 from wordpress-mobile/issue/20109-reader-ia…
Feb 6, 2024
1e2fd13
Add `translatable="false"` to flagged strings
spencertransier Feb 6, 2024
ea5b49c
Freeze strings for translation
spencertransier Feb 6, 2024
43d9f5f
Freeze strings for translation
spencertransier Feb 6, 2024
69b9894
Add `translatable="false"` to the correct strings.xml file
spencertransier Feb 6, 2024
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
4 changes: 4 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]

24.3
-----


24.2
-----
* [**] Fix editor crash occurring on large posts [https://github.com/wordpress-mobile/WordPress-Android/pull/20046]
Expand Down
10 changes: 4 additions & 6 deletions WordPress/jetpack_metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
- Get notified when you’re working offline.
- Image block uploads pause/resume with internet connection.
- See custom gradient selections in the editor.
- Fixed forward/back arrows for right-to-left readers.
- Daily Prompt tags work properly.
- Tap Site Domain cards to manage domains.
* [**] Fix editor crash occurring on large posts [https://github.com/wordpress-mobile/WordPress-Android/pull/20046]
* [*] [Jetpack-only] Site Monitoring: Add Metrics, PHP Logs, and Web Server Logs under Site Monitoring [https://github.com/wordpress-mobile/WordPress-Android/issues/20067]
* [**] Prevent images from temporarily disappearing when uploading media [https://github.com/WordPress/gutenberg/pull/57869]
* [***] [Jetpack-only] Reader: introduced new UI/UX for content navigation and filtering [https://github.com/wordpress-mobile/WordPress-Android/pull/19978]
6 changes: 2 additions & 4 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- Get notified when you’re working offline.
- Image block uploads pause when you lose internet and resume when you reconnect.
- Select a custom gradient in the editor and see a color indicator.
- “Forward” and “back” arrows are correct for right-to-left readers.
* [**] Fix editor crash occurring on large posts [https://github.com/wordpress-mobile/WordPress-Android/pull/20046]
* [**] Prevent images from temporarily disappearing when uploading media [https://github.com/WordPress/gutenberg/pull/57869]
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum class QuickStartMySitePrompts constructor(
R.id.root_view_main,
R.id.bottom_nav_reader_button,
R.string.quick_start_dialog_follow_sites_message_short_reader,
R.drawable.ic_reader_white_24dp
R.drawable.ic_reader_selected
),
UPLOAD_SITE_ICON(
QuickStartStore.QUICK_START_UPLOAD_SITE_ICON_LABEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,13 @@ public static void showReaderSubs(Context context) {
}

public static void showReaderSubs(Context context, int selectPosition) {
Intent intent = new Intent(context, ReaderSubsActivity.class);
context.startActivity(createIntentShowReaderSubs(context, selectPosition));
}

public static Intent createIntentShowReaderSubs(@NonNull final Context context, final int selectPosition) {
final Intent intent = new Intent(context, ReaderSubsActivity.class);
intent.putExtra(ReaderConstants.ARG_SUBS_TAB_POSITION, selectPosition);
context.startActivity(intent);
return intent;
}

public static void showReaderInterests(Activity activity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,8 @@ private ReaderBlogAdapter getBlogAdapter() {
ReaderTracker.SOURCE_SETTINGS
);
mAdapter.setBlogClickListener(this);
mAdapter.setDataLoadedListener(new ReaderInterfaces.DataLoadedListener() {
@Override
public void onDataLoaded(boolean isEmpty) {
checkEmptyView();
}
mAdapter.setDataLoadedListener(isEmpty -> {
checkEmptyView();
});
}
return mAdapter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package org.wordpress.android.ui.reader

import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.core.view.MenuProvider
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
Expand Down Expand Up @@ -48,12 +44,11 @@ import org.wordpress.android.util.SnackbarItem.Action
import org.wordpress.android.util.SnackbarItem.Info
import org.wordpress.android.util.SnackbarSequencer
import org.wordpress.android.viewmodel.observeEvent
import org.wordpress.android.widgets.QuickStartFocusPoint
import java.util.EnumSet
import javax.inject.Inject

@AndroidEntryPoint
class ReaderFragment : Fragment(R.layout.reader_fragment_layout), MenuProvider, ScrollableViewInitializedListener {
class ReaderFragment : Fragment(R.layout.reader_fragment_layout), ScrollableViewInitializedListener {
@Inject
lateinit var viewModelFactory: ViewModelProvider.Factory

Expand All @@ -70,14 +65,9 @@ class ReaderFragment : Fragment(R.layout.reader_fragment_layout), MenuProvider,
lateinit var snackbarSequencer: SnackbarSequencer
private lateinit var viewModel: ReaderViewModel

private var searchMenuItem: MenuItem? = null
private var settingsMenuItem: MenuItem? = null
private var settingsMenuItemFocusPoint: QuickStartFocusPoint? = null

private var binding: ReaderFragmentLayoutBinding? = null

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
requireActivity().addMenuProvider(this, viewLifecycleOwner)
binding = ReaderFragmentLayoutBinding.bind(view).apply {
initTopAppBar()
initViewModel(savedInstanceState)
Expand All @@ -86,9 +76,6 @@ class ReaderFragment : Fragment(R.layout.reader_fragment_layout), MenuProvider,

override fun onDestroyView() {
super.onDestroyView()
searchMenuItem = null
settingsMenuItem = null
settingsMenuItemFocusPoint = null
binding = null
}

Expand All @@ -102,36 +89,6 @@ class ReaderFragment : Fragment(R.layout.reader_fragment_layout), MenuProvider,
activity?.let { viewModel.onScreenInBackground(it.isChangingConfigurations) }
}

override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.reader_home, menu)
menu.findItem(R.id.menu_search).apply {
searchMenuItem = this
this.isVisible = viewModel.uiState.value?.searchMenuItemUiState?.isVisible ?: false
}
menu.findItem(R.id.menu_settings).apply {
settingsMenuItem = this
settingsMenuItemFocusPoint = this.actionView?.findViewById(R.id.menu_quick_start_focus_point)
this.isVisible = viewModel.uiState.value?.settingsMenuItemUiState?.isVisible ?: false
settingsMenuItemFocusPoint?.isVisible =
viewModel.uiState.value?.settingsMenuItemUiState?.showQuickStartFocusPoint ?: false
this.actionView?.setOnClickListener { viewModel.onSettingsActionClicked() }
}
}

override fun onMenuItemSelected(menuItem: MenuItem) = when (menuItem.itemId) {
R.id.menu_search -> {
viewModel.onSearchActionClicked()
true
}

R.id.menu_settings -> {
viewModel.onSettingsActionClicked()
true
}

else -> false
}

private fun ReaderFragmentLayoutBinding.initTopAppBar() {
readerTopBarComposeView.apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
Expand Down Expand Up @@ -171,10 +128,6 @@ class ReaderFragment : Fragment(R.layout.reader_fragment_layout), MenuProvider,
ReaderActivityLauncher.showReaderSearch(context)
}

viewModel.showSettings.observeEvent(viewLifecycleOwner) {
ReaderActivityLauncher.showReaderSubs(context)
}

viewModel.showReaderInterests.observeEvent(viewLifecycleOwner) {
showReaderInterests()
}
Expand Down Expand Up @@ -225,12 +178,6 @@ class ReaderFragment : Fragment(R.layout.reader_fragment_layout), MenuProvider,
initContentContainer(uiState)
}
}
// TODO As part of Reader IA changes this view is going to be replaced
// uiHelpers.updateVisibility(tabLayout, uiState.tabLayoutVisible)
searchMenuItem?.isVisible = uiState.searchMenuItemUiState.isVisible
settingsMenuItem?.isVisible = uiState.settingsMenuItemUiState.isVisible
settingsMenuItemFocusPoint?.isVisible =
viewModel.uiState.value?.settingsMenuItemUiState?.showQuickStartFocusPoint ?: false
}

private fun initContentContainer(uiState: ContentUiState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
Expand Down Expand Up @@ -214,6 +216,7 @@ public class ReaderPostListFragment extends ViewPagerFragment
private int mSearchTabsPos = NO_POSITION;
private boolean mIsFilterableScreen;
private boolean mIsFiltered = false;
private ActivityResultLauncher<Intent> mReaderSubsActivityResultLauncher;
@NonNull private HashSet<UpdateAction> mCurrentUpdateActions = new HashSet<>();
/*
* called by post adapter to load older posts when user scrolls to the last post
Expand Down Expand Up @@ -652,9 +655,11 @@ private void initSubFilterViewModel(@Nullable Bundle savedInstanceState) {
mSubFilterViewModel.getBottomSheetAction().observe(getViewLifecycleOwner(), event -> {
event.applyIfNotHandled(action -> {
if (action instanceof OpenSubsAtPage) {
ReaderActivityLauncher.showReaderSubs(
requireActivity(),
((OpenSubsAtPage) action).getTabIndex()
mReaderSubsActivityResultLauncher.launch(
ReaderActivityLauncher.createIntentShowReaderSubs(
requireActivity(),
((OpenSubsAtPage) action).getTabIndex()
)
);
} else if (action instanceof OpenLoginPage) {
wpMainActivityViewModel.onOpenLoginPage();
Expand Down Expand Up @@ -846,6 +851,25 @@ public void onAttach(@NonNull Context context) {
if (context instanceof BottomNavController) {
mBottomNavController = (BottomNavController) context;
}

initReaderSubsActivityResultLauncher();
}

private void initReaderSubsActivityResultLauncher() {
mReaderSubsActivityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == Activity.RESULT_OK) {
final Intent data = result.getData();
if (data != null) {
final boolean shouldRefreshSubscriptions =
data.getBooleanExtra(ReaderSubsActivity.RESULT_SHOULD_REFRESH_SUBSCRIPTIONS, false);
if (shouldRefreshSubscriptions) {
mSubFilterViewModel.loadSubFilters();
}
}
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public class ReaderSubsActivity extends LocaleAwareActivity
public static final int TAB_IDX_FOLLOWED_TAGS = 0;
public static final int TAB_IDX_FOLLOWED_BLOGS = 1;

public static final String RESULT_SHOULD_REFRESH_SUBSCRIPTIONS = "should_refresh_subscriptions";

@Inject AccountStore mAccountStore;
@Inject ReaderTracker mReaderTracker;

Expand All @@ -98,10 +100,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
OnBackPressedCallback callback = new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
if (!TextUtils.isEmpty(mLastAddedTagName)) {
EventBus.getDefault().postSticky(new ReaderEvents.TagAdded(mLastAddedTagName));
}
mReaderTracker.track(Stat.READER_MANAGE_VIEW_DISMISSED);
setResult();
CompatExtensionsKt.onBackPressedCompat(getOnBackPressedDispatcher(), this);
}
};
Expand Down Expand Up @@ -171,6 +171,20 @@ public void onPageSelected(int position) {
mReaderTracker.track(Stat.READER_MANAGE_VIEW_DISPLAYED);
}

private void setResult() {
final Intent data = new Intent();
boolean shouldRefreshSubscriptions = false;
if (mPageAdapter != null) {
final ReaderTagFragment readerTagFragment = mPageAdapter.getReaderTagFragment();
final ReaderBlogFragment readerBlogFragment = mPageAdapter.getReaderBlogFragment();
if (readerTagFragment != null && readerBlogFragment != null) {
shouldRefreshSubscriptions = readerTagFragment.hasChangedSelectedTags();
}
}
data.putExtra(RESULT_SHOULD_REFRESH_SUBSCRIPTIONS, shouldRefreshSubscriptions);
setResult(RESULT_OK, data);
}

@Override
protected void onPause() {
EventBus.getDefault().unregister(this);
Expand Down Expand Up @@ -564,12 +578,30 @@ public Object instantiateItem(ViewGroup container, int position) {
}

private void refreshFollowedTagFragment() {
for (Fragment fragment : mFragments) {
final ReaderTagFragment fragment = getReaderTagFragment();
if (fragment != null) {
fragment.refresh();
}
}

@Nullable
private ReaderTagFragment getReaderTagFragment() {
for (final Fragment fragment : mFragments) {
if (fragment instanceof ReaderTagFragment) {
ReaderTagFragment tagFragment = (ReaderTagFragment) fragment;
tagFragment.refresh();
return (ReaderTagFragment) fragment;
}
}
return null;
}

@Nullable
private ReaderBlogFragment getReaderBlogFragment() {
for (final Fragment fragment : mFragments) {
if (fragment instanceof ReaderBlogFragment) {
return (ReaderBlogFragment) fragment;
}
}
return null;
}

private void refreshBlogFragments(ReaderBlogType blogType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,27 @@

import org.wordpress.android.R;
import org.wordpress.android.models.ReaderTag;
import org.wordpress.android.models.ReaderTagList;
import org.wordpress.android.ui.ActionableEmptyView;
import org.wordpress.android.ui.reader.adapters.ReaderTagAdapter;
import org.wordpress.android.ui.reader.views.ReaderRecyclerView;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.WPActivityUtils;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/*
* fragment hosted by ReaderSubsActivity which shows followed tags
*/
public class ReaderTagFragment extends Fragment implements ReaderTagAdapter.TagDeletedListener {
private ReaderRecyclerView mRecyclerView;
private ReaderTagAdapter mTagAdapter;

private boolean mIsFirstDataLoaded;
private final ReaderTagList mInitialReaderTagList = new ReaderTagList();

static ReaderTagFragment newInstance() {
AppLog.d(AppLog.T.READER, "reader tag list > newInstance");
return new ReaderTagFragment();
Expand All @@ -36,6 +44,21 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return view;
}

public boolean hasChangedSelectedTags() {
final Set<String> initialTagsSlugs = new HashSet<>();
for (final ReaderTag readerTag : mInitialReaderTagList) {
initialTagsSlugs.add(readerTag.getTagSlug());
}
final List<ReaderTag> currentReaderTagList = getTagAdapter().getItems();
final Set<String> currentTagsSlugs = new HashSet<>();
if (currentReaderTagList != null) {
for (final ReaderTag readerTag : currentReaderTagList) {
currentTagsSlugs.add(readerTag.getTagSlug());
}
}
return !(initialTagsSlugs.equals(currentTagsSlugs));
}

private void checkEmptyView() {
if (!isAdded() || getView() == null) {
return;
Expand All @@ -62,6 +85,12 @@ public void onActivityCreated(Bundle savedInstanceState) {
refresh();
}

@Override
public void onAttach(Context context) {
super.onAttach(context);
mIsFirstDataLoaded = true;
}

void refresh() {
if (hasTagAdapter()) {
AppLog.d(AppLog.T.READER, "reader subs > refreshing tag fragment");
Expand All @@ -74,10 +103,14 @@ private ReaderTagAdapter getTagAdapter() {
Context context = WPActivityUtils.getThemedContext(getActivity());
mTagAdapter = new ReaderTagAdapter(context);
mTagAdapter.setTagDeletedListener(this);
mTagAdapter.setDataLoadedListener(new ReaderInterfaces.DataLoadedListener() {
@Override
public void onDataLoaded(boolean isEmpty) {
checkEmptyView();
mTagAdapter.setDataLoadedListener(isEmpty -> {
checkEmptyView();
if (mIsFirstDataLoaded) {
mIsFirstDataLoaded = false;
mInitialReaderTagList.clear();
if (mTagAdapter != null && mTagAdapter.getItems() != null) {
mInitialReaderTagList.addAll(mTagAdapter.getItems());
}
}
});
}
Expand Down
Loading
Loading