Skip to content

Remove unused PERMISSION_PHOTOS_ADD_ONLY macro (#986) - #1567

Open
ibrahim-iqbal wants to merge 1 commit into
Baseflow:mainfrom
ibrahim-iqbal:fix/rm-unused-photos-add-only-macro-986
Open

ibrahim-iqbal wants to merge 1 commit into
Baseflow:mainfrom
ibrahim-iqbal:fix/rm-unused-photos-add-only-macro-986

Conversation

@ibrahim-iqbal

Copy link
Copy Markdown

Fixes #986.

The PERMISSION_PHOTOS_ADD_ONLY macro was declared in PermissionHandlerEnums.h and defined in Package.swift, but nothing #ifdefed against it anywhere in permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/. The comment on the PERMISSION_PHOTOS define in Package.swift:660-662 already says "the native code compiles photosAddOnly support under PERMISSION_PHOTOS" — that macro is what actually gates the runtime behaviour, so PERMISSION_PHOTOS_ADD_ONLY was just noise.

Changes

  • PermissionHandlerEnums.h: drop the #ifndef PERMISSION_PHOTOS_ADD_ONLY / #define / #endif block and its comment.
  • Package.swift: drop the corresponding .define("PERMISSION_PHOTOS_ADD_ONLY", ...) entry.
  • permission_handler/README.md: the mapping table row for PermissionGroup.photosAddOnly still needs to point contributors at the correct macro. Retarget it to PERMISSION_PHOTOS, which matches the code reality described in the Package.swift comment.

Pre-launch Checklist

  • I made sure the project builds. Nothing references the removed macro (grep -R PERMISSION_PHOTOS_ADD_ONLY on the working tree returns no hits), and enabled() only side-effect is populating resolvedMacros for the verbose diagnostic at Package.swift:715-719, which just prints one less row now.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version — no runtime behaviour changes on any of the three build paths (CocoaPods, SPM, CMake tests), so no version bump.
  • I updated CHANGELOG.md to add a description of the change — dead-code removal with no user-visible effect, happy to add an entry if you'd rather this ship with one.
  • I updated/added relevant documentation (the README mapping table).
  • I rebased onto main.
  • I added new tests to check the change I am making — no observable behaviour to pin.
  • I made sure all existing and new tests are passing (no test changes).
  • I ran dart format . and committed any changes (no Dart files touched).
  • I ran flutter analyze and fixed any errors (no Dart files touched).

The `PERMISSION_PHOTOS_ADD_ONLY` compile-time macro was declared in the
Objective-C header and defined in `Package.swift`, but no `#ifdef`
guarded any code with it. The comment on the `PERMISSION_PHOTOS` define
in `Package.swift` already states that "the native code compiles
photosAddOnly support under PERMISSION_PHOTOS", which is what actually
gates the runtime behaviour.

Drop the dead macro from `PermissionHandlerEnums.h` and `Package.swift`,
and update the README table so the `PermissionGroup.photosAddOnly` row
points at `PERMISSION_PHOTOS` — which is the macro that really enables
it — instead of the removed one.

No behaviour change on any of the three build systems (CocoaPods, Swift
Package Manager, or the CMake tests).
@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.42%. Comparing base (fc60b52) to head (7e4e872).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1567   +/-   ##
=======================================
  Coverage   71.42%   71.42%           
=======================================
  Files           1        1           
  Lines          35       35           
=======================================
  Hits           25       25           
  Misses         10       10           
Flag Coverage Δ
unittests 71.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Remove unused constant

1 participant