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

feat(package_info_plus): add install time #3434

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Andrew-Bekhiet
Copy link

Description

Adds package install time to iOS and Android

  • On Android: uses PackageManager.firstInstallTime
  • On iOS: gets the creation date of the app's documents directory
    • The documents directory should be created automatically when the app is installed, based on this SO answer

Related Issues

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.

@miquelbeltran
Copy link
Member

Thanks! I took a quick look and looks promising, thanks for taking the time implementing tests as well.

Some ideas to extend this:

  • Supporting web and Linux: This could be done looking at the creation or modification date of the version.json file, although this may depend on how the file was copied/if the OS preserved the creation/mod date, etc. but could give a rough idea.
  • Supporting MacOS: Should be the same as with iOS?
  • Supporting Windows: Similar to the web/linux implementation, but with the app .exe (this is how it reads the version atm)

@Andrew-Bekhiet
Copy link
Author

  • Linux: Dart doesn't provide an API for checking file creation date, so I guess I'll use stat command or something similar
  • Web: I'm not sure how would that work, as version.json would be the same for all users, right?
  • MacOS: Yeah we can do the same as iOS. I'm not very experienced with Apple ecosystem, but how about the creation date of the app bundle? Would that work? I'm going to try it anyways
  • Windows: I think there is a method that checks the windows registry, if that fails we can check the creation date of the app exe file

At first I didn't want to implement this for desktop OSes because the user could easily change files attributes and mess with this, so this shouldn't be used for anything critical like determining a free trial period or anything similar

In these cases developers are encouraged to implement this feature in their apps as it fits their needs

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.

2 participants