Skip to content

task: load wp-env post types and posts in the Android demo - #824

Merged
dcalhoun merged 4 commits into
trunkfrom
task/browse-wp-env-posts-in-android-demo
Oct 23, 2026
Merged

dcalhoun merged 4 commits into
trunkfrom
task/browse-wp-env-posts-in-android-demo

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What?

Load the post types and posts in the Android demo.

Why?

This functionality was available for remote sites, but not the local wp-env site. iOS already supports this ability.

How?

Build the local wp-env credentials into to an in-memory Account.SelfHostedSite that can be utilized by the SitePreparationActivity.

Testing Instructions

  1. Start the local wp-environment via make wp-env-start
  2. Open the site in the Android demo app
  3. Verify you can browser existing posts via the Browse button

Accessibility Testing Instructions

N/A, unnecessary for the demo app.

Screenshots or screencast

N/A, no visual changes.


AI-generated details

The Android demo never stored the local WordPress (wp-env) site as an account, so every account lookup for it failed. The post type picker fell back to Post alone, and Browse was hidden. That blocks testing custom post types on wp-env, such as #794's templated post type.

Like the iOS demo (SitePreparationView.swift), it now builds an in-memory Account.SelfHostedSite from the wp-env credentials:

  • Adds the wp-env username and application password as BuildConfig fields.
  • Adds LocalWordPressCredentials.toAccount() and a reserved ACCOUNT_ID of 0. Stored accounts never use it, as wordpress-rs numbers them from 1.
  • Adds GutenbergKitApplication.findAccount(id), which the post type picker, posts list, and Save button now use.
  • Gives the wp-env entry the reserved ID, so Browse appears.

Side effect: posts opened from wp-env through Browse can now be saved from the demo app, as for other sites.

Testing

  • :app:compileDebugKotlin and make lint-android pass.
  • Not yet run on an emulator. Steps:
    1. Run make wp-env-start, then build and run the Android demo app from the same checkout, as it reads .wp-env.credentials.json at build time.
    2. Select the local WordPress site. Verify that the post type picker lists the site's post types, not only Post.
    3. Tap Browse. Verify that the site's posts load, and that one opens in the editor.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YNDBX7RNXn3NsfDuV1PkNV

@github-actions github-actions Bot added the [Type] Task Issues or PRs that have been broken down into an individual action to take label Oct 22, 2026
@wpmobilebot

wpmobilebot commented Oct 22, 2026 •

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/824")

Built from 2a8c560

dcalhoun and others added 4 commits October 23, 2026 11:33
The local WordPress site was never stored as an account, so the Android demo couldn't build an API client for it. The post type picker fell back to Post alone, and Browse was hidden. Like the iOS demo, it now builds an in-memory account from the wp-env credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNDBX7RNXn3NsfDuV1PkNV
Match the iOS demo, which computes the auth header from the credentials and
reads the editor config from the in-memory account. Also stop a missing
account ID from resolving to the local site's ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ae1XmRJfxLNoawZJQ2nYQ5
…demo

The REST route uses the post type's rest_base, which can differ from its
slug, so Browse and Save failed with rest_no_route for those types. Matches
the iOS demo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ae1XmRJfxLNoawZJQ2nYQ5
`all()` decrypts every stored account to return one, and fails outright if
any of them can't be decrypted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ae1XmRJfxLNoawZJQ2nYQ5
@dcalhoun
dcalhoun force-pushed the task/browse-wp-env-posts-in-android-demo branch from 00281fe to 2a8c560 Compare October 23, 2026 15:33
@dcalhoun
dcalhoun marked this pull request as ready for review October 23, 2026 15:50
@dcalhoun
dcalhoun requested a review from nbradbury October 23, 2026 15:52

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing steps passed :shipit:

@dcalhoun
dcalhoun merged commit df733b3 into trunk Oct 23, 2026
25 checks passed
@dcalhoun
dcalhoun deleted the task/browse-wp-env-posts-in-android-demo branch October 23, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants