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

Enable remote search in Themes if custom themes are supported #24262

Open
wants to merge 10 commits into
base: trunk
Choose a base branch
from

Conversation

pmusolino
Copy link
Member

Fixes #23153

Dependent on this PR wordpress-mobile/WordPressKit-iOS#834

This PR partially improves the search functionality within the Theme by enhancing its capabilities. Previously, the search was limited to locally fetched themes and did not include elements that had not been paginated. Now, it works remotely for blogs that support custom themes. The endpoint used for this case supports search, whereas other endpoints, such as the one utilized by the getThemesForBlogId method, do not support remote search functionality.

However, the search is available for getWPThemesPage (which calls the v2.0/themes endpoint) only if at least 3 characters are added in the search bar. For this reason, this limitation has also been handled in the app. For all other endpoints where remote searching is not available, the search continues to work locally.

Keep in mind during your tests that searching through the API does not only look for matches in the title of the theme. Therefore, when you type a string, you may see other related themes as well.

To test:

Custom Themes not supported

  1. Create a new blog in WP.com.
  2. Navigate to Themes view.
  3. Try searching by a keyword. You should be able to search only through locally fetched themes.

Custom Themes supported

  1. Select a blog where Custom Themes are enabled.
  2. Navigate to Themes view.
  3. While typing, you can filter themes in both sections: uploaded themes and WordPress.com themes. Try to search specifically for a theme that does not appear in the first page of WordPress.com themes, like the one mentioned in the original issue: scrawl.

Regression Notes

  1. Potential unintended areas of impact

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

…wift

- Apply immediate local search when search text changes
- Perform remote search for WordPress.com themes with 3+ characters
- Update predicates to include local search conditions for custom themes
- Refactor comments for clarity on search behavior and conditions
- Modify `ThemeBrowserViewController.swift` to include `resetRemoteSearch` method
- Integrate `resetRemoteSearch` in search logic to reset search state upon search text changes
- Adjust logic to handle shorter search queries that follow longer ones by resetting remote search
- Ensure local results reload consistently after search operations
- Update test to use nil instead of empty string for search in ThemeServiceTests.m
- Change `fileprivate` to `private` for several functions and variables in ThemeBrowserViewController.swift
- Simplify guard statement in `updateSearchName` function
- Update comment in `customThemesBrowsePredicate` function
@dangermattic
Copy link
Collaborator

2 Warnings
⚠️ Modules/Package.swift was changed without updating its corresponding Package.resolved. Please resolve the Swift packages as appropriate to your project setup (e.g. in Xcode or by running swift package resolve).
⚠️ This PR is assigned to the milestone 25.9. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr24262-25a0f8e
Version25.8
Bundle IDorg.wordpress.alpha
Commit25a0f8e
App Center BuildWPiOS - One-Offs #11745
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr24262-25a0f8e
Version25.8
Bundle IDcom.jetpack.alpha
Commit25a0f8e
App Center Buildjetpack-installable-builds #10771
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find Seedlet theme
3 participants