Skip to content

Conversation

MortyFx
Copy link
Contributor

@MortyFx MortyFx commented Aug 5, 2025

Description

Currently, this plugin get the installTime by retrieving the creation date of NSDocumentDirectory on macOS. However, the path of NSDocumentDirectory varies on whether the app has the app sandbox enabled.

NSDocumentDirectory path return value when App Sandbox:

  • Enabled: ~/Library/Containers/<BundleId>/Data/Documents
  • Disabled: ~/Documents

This is leading to 2 problems when App Sandbox Disabled:

  1. The creation date of ~/Documents can't be used as app first installation time.
  2. Triggering a confirmation dialog that informs the user the app wants to access files in the User Documents folder — even though the app may not have intended to do so. See:
    image

This PR fixes the issue by returning the main bundle's last modified date as the installTime when the app is not sandboxed. Since currently there's no reliable way to get the first install time when sandbox disabled, the modified date is used as an approximate fallback.

Related Issues

Fixes #3636, #3434 (comment)

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

Copy link
Collaborator

@vbuberen vbuberen left a comment

Choose a reason for hiding this comment

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

Thank you for detailed report and for fixing the issue.
I will release this fix somewhere during next few days

@vbuberen vbuberen merged commit 2cf9297 into fluttercommunity:main Aug 10, 2025
33 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: (macOS) Incorrect Installation Date Returned by package_info_plus When App Sandbox is Disabled
2 participants