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

Add the ability to define app permissions #1599

Merged
merged 16 commits into from
Jan 15, 2024

Conversation

freakboy3742
Copy link
Member

@freakboy3742 freakboy3742 commented Jan 12, 2024

Adds the ability for an app to declare permissions, as well as some related extension points.

Adds initial cross-platform permissions for camera, microphone, fine_location, coarse_location, background_location, and photo_library. This is done by adding entries to pyproject.toml like:

permission.camera = "You can use the camera to take photos of cats".

The cross-platform definitions are converted into platform-specific interpretations:

  • iOS - adds keys to the Info.plist
  • macOS - adds keys to the Info.plist and Entitlements.plist
  • Android - adds <uses-permission> and <uses-feature> content to AndroidManifest.xml
  • Flatpak - adds finish-args to the manifest.yml

In addition, the platform-specific mechanisms (Info.plist etc) have been exposed so that apps can define platform-specific modifications and extensions that aren't covered by the cross-platform capabilities.

  • iOS - info definitions
  • macOS - info and entitlement definitions
  • Android - permission and feature definitions, plus extension points thats allow injection of arbitrary content into AndroidManifest.xml
  • Flatpak - finish_arg definitions, plus modules_extra_content to allow injection of arbitrary build rules into the Flatpak manifest.

Requires the use of updated templates:

The tests (including app build tests) all pass because the extra template context generated by Briefcase is ignored if the template doesn't support the key. The template PRs are all based on this PR, so they're exercising the new template variables - although they're not actually doing anything with them (other than the defaults injected on macOS, Android and Flatpak)

Fixes #547.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

docs/reference/configuration.rst Outdated Show resolved Hide resolved
docs/reference/platforms/android/gradle.rst Outdated Show resolved Hide resolved
@mhsmith mhsmith merged commit 246ce7d into beeware:main Jan 15, 2024
44 checks passed
@freakboy3742 freakboy3742 deleted the permissions branch January 15, 2024 21:40
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.

Add support for platform-specific app permissions
2 participants