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

In-App Updates: Add Version model #23224

Merged
merged 6 commits into from
May 23, 2024
Merged

In-App Updates: Add Version model #23224

merged 6 commits into from
May 23, 2024

Conversation

momo-ozawa
Copy link
Contributor

@momo-ozawa momo-ozawa commented May 17, 2024

Fixes #23195 (review)

Description

  • Adds the Version model, which has more robust comparison logic

How to test

  • Make sure AppUpdateCoordinatorTests is all green

Regression Notes

  1. Potential unintended areas of impact
    n/a

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

  3. 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 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)

@wpmobilebot
Copy link
Contributor

wpmobilebot commented May 17, 2024

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 Numberpr23224-a45f6ae
Version24.9
Bundle IDorg.wordpress.alpha
Commita45f6ae
App Center BuildWPiOS - One-Offs #9980
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented May 17, 2024

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 Numberpr23224-a45f6ae
Version24.9
Bundle IDcom.jetpack.alpha
Commita45f6ae
App Center Buildjetpack-installable-builds #9030
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Base automatically changed from task/iau-flexible-interval to trunk May 22, 2024 08:37
@momo-ozawa momo-ozawa requested a review from kean May 22, 2024 15:09
func isLowerThanOrEqual(to anotherVersionString: String) -> Bool {
[ComparisonResult.orderedSame, .orderedAscending].contains(self.compare(anotherVersionString, options: .numeric))
extension Version {
init?(from versionString: String) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(Nit) I would put this directly in the Version file`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed! d97c8d5

guard let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else {
DDLogError("No CFBundleShortVersionString found in Info.plist")
guard let version = Bundle.main.infoDictionary?["CFBundleVersion"] as? String else {
DDLogError("No CFBundleVersion found in Info.plist")
Copy link
Contributor

Choose a reason for hiding this comment

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

(Nit) A good place for wpAssertionFailure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed! 6b62951

prereleaseIdentifiers: [String] = [],
buildMetadataIdentifiers: [String] = []
) {
precondition(major >= 0 && minor >= 0 && patch >= 0, "Negative versioning is invalid.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest replacing precondition (crashes in prod) with safe failures and wpAssertionFailure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed! abb2724

@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 25.0. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@momo-ozawa momo-ozawa requested review from kean May 23, 2024 09:50
@momo-ozawa
Copy link
Contributor Author

@kean Thanks for reviewing - I've addressed all the comments.

@momo-ozawa momo-ozawa merged commit ec8471b into trunk May 23, 2024
24 checks passed
@momo-ozawa momo-ozawa deleted the task/iau-version branch May 23, 2024 12: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.

None yet

4 participants