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: Prompt update after phased release is complete #23218

Merged
merged 4 commits into from
May 22, 2024

Conversation

momo-ozawa
Copy link
Contributor

Part of https://github.com/Automattic/wordpress-mobile/issues/55
Part of https://github.com/Automattic/wordpress-mobile/issues/56

Description

  • Adds a check to only show the update prompts if it's been 7 days since the latest version was released (i.e. phased release is at 100%), to prevent showing the prompt to users who have automatic updated enabled.

How to test

Flexible update

Preconditions

  • In Xcode, change the app version to something lower than the current app store version, e.g. 24.6
  • Enable the In-App Updates remote feature flag

Test 1.1

  • Run on a real device
  • ✅ Verify the flexible update is NOT displayed

Test 1.2

  • Change delayInDays default value to 1
  • Run on a real device
  • ✅ Verify the flexible update is displayed

Blocking update

Preconditions

  • In Xcode, change the app version to something lower than the current app store version, e.g. 24.6
  • Enable the In-App Updates remote feature flag
  • Change the In-App Update Blocking Version remote config value to 24.7

Test 2.1

  • Run on a real device
  • ✅ Verify the blocking update is NOT displayed

Test 2.2

  • Change delayInDays default value to 1
  • Run on a real device
  • ✅ Verify the blocking update is displayed

Regression Notes

  1. Potential unintended areas of impact
    Showing app update prompt

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

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

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 16, 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 Numberpr23218-4842f1f
Version24.9
Bundle IDcom.jetpack.alpha
Commit4842f1f
App Center Buildjetpack-installable-builds #8982
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 16, 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 Numberpr23218-4842f1f
Version24.9
Bundle IDorg.wordpress.alpha
Commit4842f1f
App Center BuildWPiOS - One-Offs #9932
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-blocking-modal to trunk May 17, 2024 09:45
@@ -24,7 +25,8 @@ final class AppUpdateCoordinator {
remoteConfigStore: RemoteConfigStore = RemoteConfigStore(),
isJetpack: Bool = AppConfiguration.isJetpack,
isLoggedIn: Bool = AccountHelper.isLoggedIn,
isInAppUpdatesEnabled: Bool = RemoteFeatureFlag.inAppUpdates.enabled()
isInAppUpdatesEnabled: Bool = RemoteFeatureFlag.inAppUpdates.enabled(),
delayInDays: Int = 7
Copy link
Contributor

@kean kean May 20, 2024

Choose a reason for hiding this comment

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

Can we delay it by more days, just to be safe? I'd probably go with a month to let users a chance to update manually and to make sure the automatic update has enough time to run. I don't think we need to start bombarding them with the updates right away, do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This value doesn't represent how many days to wait in between showing prompts.

It represents how many days to wait until a version has been released to show a prompt to update. I chose 7 days because phased release is complete after 7 days. This delay ensures that the prompt isn't shown during the phased release period - it prevents showing the prompt to users who have automatic updates enabled.

As discussed in p1716217030223529-slack-C072JBZL84U, my plan is change the flexible update interval remote config value from 5 to 90 days.

@kean
Copy link
Contributor

kean commented May 20, 2024

I hit an assertion here:

Screenshot 2024-05-20 at 10 25 24 AM

updateRemoteConfig is called when the app enters foreground, and it performs a version check every time.

func currentVersionHasBeenReleased(for days: Int) -> Bool {
let secondsInDay: TimeInterval = 86_400
let secondsSinceRelease = -currentVersionReleaseDate.timeIntervalSinceNow
return secondsSinceRelease > Double(days) * secondsInDay
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) there is a convenience API for this:

guard let days = Calendar.current.dateComponents([.day], from: lhs, to: rhs).day else {
            return wpAssertionFailure("should-never-happen")
}
return days > 1

warning: I have not tested it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've addressed this in #23221 🙇‍♀️

@momo-ozawa
Copy link
Contributor Author

updateRemoteConfig is called when the app enters foreground, and it performs a version check every time.

@kean I've addressed this in #23221.

I changed it to fetching the app store info once a day.

@momo-ozawa momo-ozawa requested a review from kean May 21, 2024 14:51
@momo-ozawa momo-ozawa merged commit 0b3c882 into trunk May 22, 2024
24 checks passed
@momo-ozawa momo-ozawa deleted the task/iau-phased-release branch May 22, 2024 08:10
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

3 participants