Skip to content

Remove Only the Default Initializer to Provide Custom Configuration - #16876

Closed
ParaskP7 wants to merge 1 commit into
trunkfrom
issue/16867-story-not-working
Closed

ParaskP7 wants to merge 1 commit into
trunkfrom
issue/16867-story-not-working

Conversation

@ParaskP7

@ParaskP7 ParaskP7 commented Jul 6, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #16867

This PR fixes the story regression.

This change was necessary because of the androidx.lifecycle update to 2.4.1 and the fact that with it the lifecycle-process now uses androidx.startup to initialize the ProcessLifecycleOwner. This definitely caused an issue with the Stories Uploading functionality, but it might also have caused other issues as well.

As such removing all initializers are no longer an option, as it will also remove the ProcessLifecycleInitializer initializer. Instead removing only the default WorkManagerInitializer, while keeping the rest with the tools:node="merge" option, is recommended for when using a custom configuration.

For more info visit:

PS.1: This is the PR and its specific commit that introduced this story regression.
PS.2: You will find more details about this story's regression investigation in this Slack discussion here: C011BKNU1V5/p1657026365958239


To test:

  • Open the app, while on the My Site main screen tab click on the 🔵 FAB button on the bottom right.
  • Chose Store post to compose and publish a story. Make sure the story is uploading as well as published.
  • Chose Blog post to compose and publish a post. Make sure the post is uploading as well as published.
  • Chose Page page to compose and publish a page. Make sure the page is uploading as well as published.
  • Smoke test the Posts and Pages related screen and verify that everything works as expected.
  • Smoke test anything else that you can think of that might be affecting any uploading, startup or work manager related functionality.

Regression Notes

  1. Potential unintended areas of impact

By removing only the default initializer (using merge) vs. removing all initializers (using remove) there might be other initializer apart from WorkManagerInitializer (that is removed anyway), and ProcessLifecycleInitializer (that is needed), which we might want removed as well. Thus, by not having them removed this might potentially caused us additional issues. 🤔

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

See To test section above.

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

N/A


PR submission checklist:

  • I have completed the Regression Notes.
  • 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.

This change was necessary because of the 'androidx.lifecycle' update to
'2.4.1' and the fact that with it the 'lifecycle-process' now uses
'androidx.startup' to initialize the 'ProcessLifecycleOwner'.

As such removing all initializers are no longer an option, as it will
also remove the 'ProcessLifecycleInitializer' initializer. Instead
removing only the default 'WorkManagerInitializer', while keeping the
rest with the 'tools:node="merge"' option, is recommended for when using
a custom configuration.

For more info visit:
- https://developer.android.com/topic/libraries/architecture/
workmanager/advanced/custom-configuration
- https://developer.android.com/jetpack/androidx/releases/
lifecycle#2.4.1
@ParaskP7 ParaskP7 added this to the 20.3 milestone Jul 6, 2022
@ParaskP7
ParaskP7 requested review from fluiddot and geriux July 6, 2022 13:43
@ParaskP7 ParaskP7 self-assigned this Jul 6, 2022
@peril-wordpress-mobile

Copy link
Copy Markdown

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@wpmobilebot

Copy link
Copy Markdown
Contributor
You can test the Jetpack changes on this Pull Request by downloading an installable build (jetpack-installable-build-pr16876-39b88d3.apk), or scanning this QR code:

@wpmobilebot

Copy link
Copy Markdown
Contributor
You can test the WordPress changes on this Pull Request by downloading an installable build (wordpress-installable-build-pr16876-39b88d3.apk), or scanning this QR code:

@ParaskP7
ParaskP7 requested a review from ashiagr July 6, 2022 14:37

@ashiagr ashiagr 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.

Thank you for this investigation and the fix @ParaskP7, it was actually a tricky one! I am an accomplice in not having caught it in my review. 🙈
I tested post/ page/ stories upload and publishing and found them working in this PR.

Regarding your regression note:

there might be other initializer apart from WorkManagerInitializer (that is removed anyway), and ProcessLifecycleInitializer (that is needed), which we might want removed as well.

I searched for initializers and found only two WorkManagerInitilizer and ProcessLifecycleInitializer being used currently:

initializers

so seems like we're safe as of now to remove only WorkManagerInitilizer and keep the only remaining initializer which is ProcessLifecycleInitializer.

I can also see that ProcessLifecycleOwner is being used in AppInitializer to auto-start uploads using UploadStarter and for uploading media for stories.

ProcessLifecycleOwner

I tested both these areas and found them working. I can't think of any other area that might be affected because of the changes and so giving my approval.

Thanks once again, for a quick investigation!

@ParaskP7

ParaskP7 commented Jul 7, 2022

Copy link
Copy Markdown
Contributor Author

👋 @ashiagr !

Thank you so much for reviewing and testing this PR, you are awesome! 🥇 🙇

I searched for initializers and found only two WorkManagerInitilizer and ProcessLifecycleInitializer being used currently... so seems like we're safe as of now to remove only WorkManagerInitilizer and keep the only remaining initializer which is ProcessLifecycleInitializer.

Oh nice, and yes, that gives me extra confidence that this change is safe indeed, thanks for searching for the available initializers like you did, nice thinking! ❤️ 💯

@geriux

geriux commented Jul 7, 2022 •

Copy link
Copy Markdown
Contributor

Thank you @ParaskP7 for working on this!

I tested the following using a Redmi Note 8T:

  • Post Stories outside of the editor ✅
  • Post Stories within the editor ✅
  • Post media uploads (Gallery block) within the editor ✅
  • Post media uploads (Gallery block) while the editor is closed ✅
  • Page with media uploads (Story block) ✅

LGTM! Nice work 👏

@ParaskP7

ParaskP7 commented Jul 7, 2022

Copy link
Copy Markdown
Contributor Author

👋 @geriux !

This is awesome, thank you so much for reviewing and testing this PR as well! 🥇 🙇

@ParaskP7
ParaskP7 changed the base branch from trunk to release/20.2 July 7, 2022 10:24
@peril-wordpress-mobile

Copy link
Copy Markdown
Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@ParaskP7
ParaskP7 changed the base branch from release/20.2 to trunk July 7, 2022 10:24
@ParaskP7

ParaskP7 commented Jul 7, 2022

Copy link
Copy Markdown
Contributor Author

Closing in favor of #16881 that includes these changes.

@ParaskP7 ParaskP7 closed this Jul 7, 2022
@ParaskP7
ParaskP7 deleted the issue/16867-story-not-working branch October 31, 2022 09:57
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.

Creating a Story post is not working

4 participants