Skip to content

Commit

Permalink
Merge branch 'trunk' into gutenberg/support-for-videopress-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
Siobhan committed Feb 23, 2024
2 parents 8800532 + efa163c commit a44b752
Show file tree
Hide file tree
Showing 27 changed files with 327 additions and 130 deletions.
18 changes: 7 additions & 11 deletions WordPress/jetpack_metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Jetpack - Apps - Android - Release Notes\n"

msgctxt "release_note_243"
msgid ""
"24.3:\n"
"Log in to your site with Google credentials, physical devices, and third-party passkeys. Don’t worry, the site’s still locked down tighter than the Colonel’s secret recipe.\n"
"We hid the menu icon on Stats screens so it’s only visible from the Insights tab. Ninja mode: activated.\n"
msgstr ""

msgctxt "release_note_242"
msgid ""
"24.2:\n"
Expand All @@ -19,17 +26,6 @@ msgid ""
"- We added new Site Monitoring menu items like metrics, PHP logs, and web server logs.\n"
msgstr ""

msgctxt "release_note_241"
msgid ""
"24.1:\n"
"- Get notified when you’re working offline.\n"
"- Image block uploads pause/resume with internet connection.\n"
"- See custom gradient selections in the editor.\n"
"- Fixed forward/back arrows for right-to-left readers.\n"
"- Daily Prompt tags work properly.\n"
"- Tap Site Domain cards to manage domains.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
#. translators: Title to be displayed in the Play Store. Limit to 30 characters including spaces and commas!
msgctxt "play_store_app_title"
Expand Down
5 changes: 2 additions & 3 deletions WordPress/jetpack_metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
* [**] Added support to use third-party passkey providers and other devices passkeys as a WordPress.com login option [https://github.com/wordpress-mobile/WordPress-Android/pull/20174]
* [*] [Jetpack-only] Fix the visibility issue with the menu button on the stats [https://github.com/wordpress-mobile/WordPress-Android/pull/20175]

Log in to your site with Google credentials, physical devices, and third-party passkeys. Don’t worry, the site’s still locked down tighter than the Colonel’s secret recipe.
We hid the menu icon on Stats screens so it’s only visible from the Insights tab. Ninja mode: activated.
15 changes: 6 additions & 9 deletions WordPress/metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Release Notes & Play Store Descriptions\n"

msgctxt "release_note_243"
msgid ""
"24.3:\n"
"You can log in to your WordPress website using Google credentials, physical devices, and other third-party passkeys. Don’t worry, your site is still locked down tighter than the Colonel’s secret recipe.\n"
msgstr ""

msgctxt "release_note_242"
msgid ""
"24.2:\n"
Expand All @@ -18,15 +24,6 @@ msgid ""
"The editor won’t crash anymore when you’re working on large posts. That’s right, we’ve saved your drafts and your sanity.\n"
msgstr ""

msgctxt "release_note_241"
msgid ""
"24.1:\n"
"- Get notified when you’re working offline.\n"
"- Image block uploads pause when you lose internet and resume when you reconnect.\n"
"- Select a custom gradient in the editor and see a color indicator.\n"
"- “Forward” and “back” arrows are correct for right-to-left readers.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
#. translators: Shorter Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
msgctxt "sample_post_content"
Expand Down
3 changes: 1 addition & 2 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* [**] Added support to use third-party passkey providers and other devices passkeys as a WordPress.com login option [https://github.com/wordpress-mobile/WordPress-Android/pull/20174]

You can log in to your WordPress website using Google credentials, physical devices, and other third-party passkeys. Don’t worry, your site is still locked down tighter than the Colonel’s secret recipe.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ public static ReaderTagList getBookmarkTags() {
return getTagsOfType(ReaderTagType.BOOKMARKED);
}

public static ReaderTagList getDiscoverPostCardsTags() {
return getTagsOfType(ReaderTagType.DISCOVER_POST_CARDS);
}

private static ReaderTagList getTagsOfType(ReaderTagType tagType) {
String[] args = {Integer.toString(tagType.toInt())};
Cursor c = ReaderDatabase.getReadableDb()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public boolean isSameList(ReaderTagList otherList) {
return false;
} else if (!otherTag.getTagTitle().equals(this.get(i).getTagTitle())) {
return false;
} else if (!otherTag.getTagDisplayName().equals(this.get(i).getTagDisplayName())) {
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3934,7 +3934,12 @@ public void onMediaModelsCreatedFromOptimizedUris(@NonNull Map<Uri, ? extends Me
}

@Override public void showVideoDurationLimitWarning(@NonNull String fileName) {
ToastUtils.showToast(this, R.string.error_media_video_duration_exceeds_limit, ToastUtils.Duration.LONG);
String message = getString(R.string.error_media_video_duration_exceeds_limit);
WPSnackbar.make(
findViewById(R.id.editor_activity),
message,
Snackbar.LENGTH_LONG
).show();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,27 @@ private ReaderEvents() {
throw new AssertionError();
}

public static class FollowedTagsChanged {
public static class FollowedTagsFetched {
private final boolean mDidSucceed;
private final boolean mDidChange;

public FollowedTagsChanged(boolean didSucceed) {
public FollowedTagsFetched(boolean didSucceed) {
mDidSucceed = didSucceed;
mDidChange = true;
}

public FollowedTagsFetched(boolean didSucceed, boolean didChange) {
mDidSucceed = didSucceed;
mDidChange = didChange;
}

public boolean didSucceed() {
return mDidSucceed;
}

public boolean didChange() {
return mDidChange;
}
}

public static class TagAdded {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import org.wordpress.android.ui.mysite.jetpackbadge.JetpackPoweredBottomSheetFragment;
import org.wordpress.android.ui.pages.SnackbarMessageHolder;
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsFetched;
import org.wordpress.android.ui.reader.ReaderEvents.TagAdded;
import org.wordpress.android.ui.reader.ReaderTypes.ReaderPostListType;
import org.wordpress.android.ui.reader.actions.ReaderActions;
Expand Down Expand Up @@ -934,14 +935,16 @@ private void resetPostAdapter(ReaderPostListType postListType) {

@SuppressWarnings("unused")
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ReaderEvents.FollowedTagsChanged event) {
public void onEventMainThread(FollowedTagsFetched event) {
if (getPostListType() == ReaderPostListType.TAG_FOLLOWED) {
// reload the tag filter since tags have changed
reloadTags();
if (event.didChange()) {
// reload the tag filter since tags have changed or we just opened the fragment
reloadTags();
}

// update the current tag if the list fragment is empty - this will happen if
// the tag table was previously empty (ie: first run)
if (isPostAdapterEmpty()) {
if (isPostAdapterEmpty() && (ReaderBlogTable.hasFollowedBlogs() || !mHasUpdatedPosts)) {
updateCurrentTag();
}
}
Expand Down Expand Up @@ -1724,9 +1727,6 @@ private void setEmptyTitleDescriptionAndButton(boolean requestFailed) {
// Ensure the default image is reset for empty views before applying logic
mActionableEmptyView.image.setImageResource(R.drawable.illustration_reader_empty);

// TODO thomashortadev
// try to quickly hack some way of making the button black

if (shouldShowEmptyViewForSelfHostedCta()) {
setEmptyTitleAndDescriptionForSelfHostedCta();
return;
Expand Down Expand Up @@ -1940,7 +1940,9 @@ private void showBookmarksSavedLocallyDialog(ShowBookmarkedSavedOnlyLocallyDialo
.setCancelable(false)
.create();
mBookmarksSavedLocallyDialog.show();
} /*
}

/*
* called by post adapter when data has been loaded
*/
private final ReaderInterfaces.DataLoadedListener mDataLoadedListener = new ReaderInterfaces.DataLoadedListener() {
Expand Down Expand Up @@ -2333,7 +2335,7 @@ public void run() {
mActionableEmptyView.button.setVisibility(View.GONE);
mActionableEmptyView.subtitle.setVisibility(View.GONE);
showEmptyView();
} else {
} else if (!isPostAdapterEmpty()) {
hideEmptyView();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.wordpress.android.ui.LocaleAwareActivity;
import org.wordpress.android.ui.RequestCodes;
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsFetched;
import org.wordpress.android.ui.reader.actions.ReaderActions;
import org.wordpress.android.ui.reader.actions.ReaderBlogActions;
import org.wordpress.android.ui.reader.actions.ReaderTagActions;
Expand Down Expand Up @@ -203,7 +204,7 @@ protected void onResume() {

@SuppressWarnings("unused")
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ReaderEvents.FollowedTagsChanged event) {
public void onEventMainThread(FollowedTagsFetched event) {
AppLog.d(AppLog.T.READER, "reader subs > followed tags changed");
getPageAdapter().refreshFollowedTagFragment();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.wordpress.android.models.ReaderTagList;
import org.wordpress.android.models.ReaderTagType;
import org.wordpress.android.ui.reader.ReaderConstants;
import org.wordpress.android.ui.reader.ReaderEvents;
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsFetched;
import org.wordpress.android.ui.reader.actions.ReaderActions.ActionListener;
import org.wordpress.android.ui.reader.utils.ReaderUtils;
import org.wordpress.android.util.AppLog;
Expand Down Expand Up @@ -51,7 +51,7 @@ public static boolean deleteTag(final ReaderTag tag,
private static boolean deleteTagsLocallyOnly(ActionListener actionListener, ReaderTag tag) {
ReaderTagTable.deleteTag(tag);
ReaderActions.callActionListener(actionListener, true);
EventBus.getDefault().post(new ReaderEvents.FollowedTagsChanged(true));
EventBus.getDefault().post(new FollowedTagsFetched(true));

return true;
}
Expand Down Expand Up @@ -130,7 +130,7 @@ public static boolean addTags(@NonNull final List<ReaderTag> tags,
private static boolean saveTagsLocallyOnly(ActionListener actionListener, ReaderTagList newTags) {
ReaderTagTable.addOrUpdateTags(newTags);
ReaderActions.callActionListener(actionListener, true);
EventBus.getDefault().post(new ReaderEvents.FollowedTagsChanged(true));
EventBus.getDefault().post(new FollowedTagsFetched(true));

return true;
}
Expand All @@ -147,7 +147,7 @@ private static boolean saveTagsLocallyAndRemotely(ActionListener actionListener,
if (actionListener != null) {
ReaderActions.callActionListener(actionListener, true);
}
EventBus.getDefault().post(new ReaderEvents.FollowedTagsChanged(true));
EventBus.getDefault().post(new FollowedTagsFetched(true));
};

RestRequest.ErrorListener errorListener = volleyError -> {
Expand All @@ -159,7 +159,7 @@ private static boolean saveTagsLocallyAndRemotely(ActionListener actionListener,
if (actionListener != null) {
ReaderActions.callActionListener(actionListener, true);
}
EventBus.getDefault().post(new ReaderEvents.FollowedTagsChanged(true));
EventBus.getDefault().post(new FollowedTagsFetched(true));
return;
}

Expand All @@ -171,7 +171,7 @@ private static boolean saveTagsLocallyAndRemotely(ActionListener actionListener,
if (actionListener != null) {
ReaderActions.callActionListener(actionListener, false);
}
EventBus.getDefault().post(new ReaderEvents.FollowedTagsChanged(false));
EventBus.getDefault().post(new FollowedTagsFetched(false));
};

ReaderTagTable.addOrUpdateTags(newTags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.wordpress.android.models.discover.ReaderDiscoverCards
import org.wordpress.android.modules.IO_THREAD
import org.wordpress.android.modules.UI_THREAD
import org.wordpress.android.ui.reader.ReaderEvents.FetchDiscoverCardsEnded
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsChanged
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsFetched
import org.wordpress.android.ui.reader.actions.ReaderActions.UpdateResult.CHANGED
import org.wordpress.android.ui.reader.actions.ReaderActions.UpdateResult.FAILED
import org.wordpress.android.ui.reader.actions.ReaderActions.UpdateResult.HAS_NEW
Expand Down Expand Up @@ -211,7 +211,7 @@ class ReaderDiscoverDataProvider @Inject constructor(

@Suppress("unused", "UNUSED_PARAMETER")
@Subscribe(threadMode = BACKGROUND)
fun onFollowedTagsChanged(event: FollowedTagsChanged) {
fun onFollowedTagsFetched(event: FollowedTagsFetched) {
launch {
refreshCards()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.wordpress.android.ui.reader.repository.usecases.tags

import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsChanged
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsFetched
import org.wordpress.android.ui.reader.repository.ReaderRepositoryCommunication
import org.wordpress.android.ui.reader.repository.ReaderRepositoryCommunication.Error.NetworkUnavailable
import org.wordpress.android.ui.reader.repository.ReaderRepositoryCommunication.Error.RemoteRequestFailure
Expand Down Expand Up @@ -48,7 +48,7 @@ class FetchFollowedTagsUseCase @Inject constructor(

@Suppress("unused")
@Subscribe(threadMode = ThreadMode.BACKGROUND)
fun onFollowedTagsChanged(event: FollowedTagsChanged) {
fun onFollowedTagsFetched(event: FollowedTagsFetched) {
val result = if (event.didSucceed()) {
Success
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.wordpress.android.fluxc.store.AccountStore
import org.wordpress.android.models.ReaderTag
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsChanged
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsFetched
import org.wordpress.android.ui.reader.actions.ReaderTagActions
import org.wordpress.android.ui.reader.repository.ReaderRepositoryCommunication
import org.wordpress.android.ui.reader.repository.ReaderRepositoryCommunication.Error.NetworkUnavailable
Expand Down Expand Up @@ -43,7 +43,7 @@ class FollowInterestTagsUseCase @Inject constructor(

@Suppress("unused")
@Subscribe(threadMode = ThreadMode.BACKGROUND)
fun onFollowedTagsChanged(event: FollowedTagsChanged) {
fun onFollowedTagsFetched(event: FollowedTagsFetched) {
val result = if (event.didSucceed()) {
Success
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.reader.ReaderConstants;
import org.wordpress.android.ui.reader.ReaderEvents;
import org.wordpress.android.ui.reader.ReaderEvents.FollowedTagsFetched;
import org.wordpress.android.ui.reader.ReaderEvents.InterestTagsFetchEnded;
import org.wordpress.android.ui.reader.services.ServiceCompletionListener;
import org.wordpress.android.util.AppLog;
Expand Down Expand Up @@ -122,24 +123,21 @@ public void onErrorResponse(VolleyError volleyError) {
.get("read/menu", params, null, listener, errorListener);
}

private boolean displayNameUpdateWasNeeded(ReaderTagList serverTopics) {
boolean updateDone = false;

/**
* Update the display names of the default tags (such as Subscribed and Discover) in the serverTopics list.
*
* @param serverTopics The list of default tags.
*/
private void updateDisplayNamesIfNeeded(@NonNull ReaderTagList serverTopics) {
for (ReaderTag tag : serverTopics) {
String tagNameBefore = tag.getTagDisplayName();
if (tag.isFollowedSites()) {
tag.setTagDisplayName(mContext.getString(R.string.reader_subscribed_display_name));
if (!tagNameBefore.equals(tag.getTagDisplayName())) updateDone = true;
} else if (tag.isDiscover()) {
tag.setTagDisplayName(mContext.getString(R.string.reader_discover_display_name));
if (!tagNameBefore.equals(tag.getTagDisplayName())) updateDone = true;
} else if (tag.isPostsILike()) {
tag.setTagDisplayName(mContext.getString(R.string.reader_my_likes_display_name));
if (!tagNameBefore.equals(tag.getTagDisplayName())) updateDone = true;
}
}

return updateDone;
}

private void handleUpdateTagsResponse(final JSONObject jsonObject) {
Expand All @@ -151,7 +149,7 @@ public void run() {
ReaderTagList serverTopics = new ReaderTagList();
serverTopics.addAll(parseTags(jsonObject, "default", ReaderTagType.DEFAULT));

boolean displayNameUpdateWasNeeded = displayNameUpdateWasNeeded(serverTopics);
updateDisplayNamesIfNeeded(serverTopics);

serverTopics.addAll(parseTags(jsonObject, "subscribed", ReaderTagType.FOLLOWED));

Expand All @@ -176,13 +174,11 @@ public void run() {
localTopics.addAll(ReaderTagTable.getFollowedTags());
localTopics.addAll(ReaderTagTable.getBookmarkTags());
localTopics.addAll(ReaderTagTable.getCustomListTags());
localTopics.addAll(ReaderTagTable.getDiscoverPostCardsTags());

if (
!localTopics.isSameList(serverTopics)
|| displayNameUpdateWasNeeded
) {
AppLog.d(AppLog.T.READER, "reader service > followed topics changed "
+ "updatedDisplayNames [" + displayNameUpdateWasNeeded + "]");
boolean didChangeFollowedTags = false;
if (!localTopics.isSameList(serverTopics)) {
AppLog.d(AppLog.T.READER, "reader service > followed topics changed");

if (!mAccountStore.hasAccessToken()) {
// Do not delete locally saved tags for logged out user
Expand All @@ -195,8 +191,9 @@ public void run() {
ReaderTagTable.replaceTags(serverTopics);
}
// broadcast the fact that there are changes
EventBus.getDefault().post(new ReaderEvents.FollowedTagsChanged(true));
didChangeFollowedTags = true;
}
EventBus.getDefault().post(new FollowedTagsFetched(true, didChangeFollowedTags));
AppPrefs.setReaderTagsUpdatedTimestamp(new Date().getTime());

taskCompleted(UpdateTask.TAGS);
Expand Down
Loading

0 comments on commit a44b752

Please sign in to comment.