Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 8, 2025

Implementation Complete: No-Permission Asset Access ✅

This PR implements the ability to access/pick assets without requiring storage permissions, combining approaches from:

Implementation Summary

✅ Dart/Flutter API Layer

  • Added PhotoManager.pickAssets() method with comprehensive documentation
  • Parameters: maxCount (default: 9), requestType (common/image/video), useItemProvider (iOS only)
  • Returns standard List<AssetEntity> compatible with all photo_manager APIs

✅ Android Implementation

  • Android 11+ (API 30+): Uses Photo Picker API (ACTION_PICK_IMAGES) with multi-selection support
  • Android < 11: Falls back to legacy ACTION_PICK intent with single-selection
  • Both approaches work without storage permissions
  • Proper activity lifecycle management and result handling
  • Converts picker URIs to AssetEntity objects via MediaStore queries

✅ iOS/macOS Implementation

  • iOS 14+: Uses PHPickerViewController without requiring photo library permissions
  • Implements PHPickerViewControllerDelegate for result handling
  • Converts PHPickerResult to AssetEntity objects from photo library
  • Proper error handling for unsupported iOS versions
  • macOS support limited (PHPickerViewController availability)

✅ Documentation & Examples

  • Updated CHANGELOG.md with feature description
  • Added comprehensive usage documentation to README.md and README-ZH.md
  • Working example in example app with visual grid preview
  • Clear notes on platform support and limitations

✅ Code Quality & Security

  • Code review completed - all feedback addressed
  • Security scan (CodeQL) - no issues found
  • Follows existing code style and patterns
  • Proper error handling and edge cases covered
  • CI validation passed

Platform Support Matrix

Platform Version Support Permissions Required
Android 11+ (API 30+) ✅ Full (multi-select) None
Android < 11 ✅ Limited (single-select) None
iOS 14+ ✅ Full None
iOS < 14 ⚠️ Error returned N/A
macOS 11+ ⚠️ Limited N/A

Key Features

  • ✅ No storage/photo library permissions required
  • ✅ Native OS picker UI (system-provided)
  • ✅ Returns standard AssetEntity objects
  • ✅ Full compatibility with existing photo_manager APIs
  • ✅ Backward compatible with older Android versions
  • ✅ Works independently of app's permission status
  • ✅ Proper error handling for unsupported platforms

Known Limitations

  • Android < 11: Only single asset selection supported (platform limitation)
  • iOS useItemProvider: Full iCloud support planned for future release (currently only local library assets)
  • macOS: PHPickerViewController has limited support on some versions

This implementation successfully completes the requirements from the problem statement by combining the best approaches from both referenced sources to provide a comprehensive, cross-platform solution for permission-less asset picking.

Original prompt

你结合 https://github.com/CaiJingLong/AndroidMediaInfoExample/tree/no-permission-2#1338
创建一个新的PR来完成 1338 没完成的任务,即,无权限获取 asset


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix asset access issue when permissions are not granted feat: Add native photo picker without storage permissions Dec 8, 2025
Copilot AI requested a review from CaiJingLong December 8, 2025 09:22
@CaiJingLong
Copy link
Member

Remove unnecessary dart:typed_data import as Uint8List is already available through flutter/services.dart import.

Co-authored-by: CaiJingLong <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 8, 2025

@copilot https://github.com/fluttercandies/flutter_photo_manager/actions/runs/20022891493/job/57414200973?pr=1358 云信有错误,你看一下日志进行优化

Fixed the CI error. The issue was an unnecessary dart:typed_data import in the example app - Uint8List is already available through flutter/services.dart. Removed in commit 655544c.

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

Download apk from here for 0fc1ad1

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.

2 participants