- 
                Notifications
    
You must be signed in to change notification settings  - Fork 256
 
fix: Incompatible with iOS 26.0 under flutter_image_compress_common #343
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,12 +1,10 @@ | ||||||||||
| // | ||||||||||
| // SYMetadata.h | ||||||||||
| // SYPictureMetadataExample | ||||||||||
| // | ||||||||||
| // Created by Stan Chevallier on 12/13/12. | ||||||||||
| // Copyright (c) 2012 Syan. All rights reserved. | ||||||||||
| // | ||||||||||
| 
     | 
||||||||||
| #import <Foundation/Foundation.h> | ||||||||||
| #import <Photos/Photos.h> // Using Photos framework | ||||||||||
| 
     | 
||||||||||
| #import "SYMetadataTIFF.h" | ||||||||||
| #import "SYMetadataGIF.h" | ||||||||||
| #import "SYMetadataJFIF.h" | ||||||||||
| 
        
          
        
         | 
    @@ -26,11 +24,6 @@ | |||||||||
| #import "SYMetadataDNG.h" | ||||||||||
| #import "SYMetadataExifAux.h" | ||||||||||
| 
     | 
||||||||||
| // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/index.html | ||||||||||
| // http://www.exiv2.org/tags.html | ||||||||||
| 
     | 
||||||||||
| @class ALAsset; | ||||||||||
| 
     | 
||||||||||
| @interface SYMetadata : SYMetadataBase | ||||||||||
| 
     | 
||||||||||
| @property SYMETADATA_PROPERTY_COPY NSDictionary *originalDictionary; | ||||||||||
| 
        
          
        
         | 
    @@ -54,7 +47,7 @@ | |||||||||
| @property SYMETADATA_PROPERTY_STRONG SYMetadataDNG *metadataDNG; | ||||||||||
| @property SYMETADATA_PROPERTY_STRONG SYMetadataExifAux *metadataExifAux; | ||||||||||
| 
     | 
||||||||||
| // we don't know how to parse those, so we juste give access to them | ||||||||||
| // Fallback | ||||||||||
        
    
 | 
||||||||||
| // Fallback | |
| // Unparsed vendor-specific dictionaries exposed as-is for consumers (fallback for unknown or proprietary metadata) | 
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This renames/removes previously public APIs (+metadataWithAsset: and +dictionaryWithAssetURL:), creating a breaking change contrary to the PR description. To preserve source compatibility, consider reintroducing a deprecated wrapper for +dictionaryWithAssetURL: that fetches a PHAsset via Photos (e.g., using [PHAsset fetchAssetsWithALAssetURLs:options:]) and forwards to +dictionaryWithPHAsset:. If you intentionally drop ALAsset support, please note it clearly as a breaking change.
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline comments are incorrect: these methods use PHAsset/Photos, not ALAsset/ALAssetsLibrary. Please update the comments to avoid confusion (e.g., 'PHAsset-based' or 'Using Photos framework').
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline comments are incorrect: these methods use PHAsset/Photos, not ALAsset/ALAssetsLibrary. Please update the comments to avoid confusion (e.g., 'PHAsset-based' or 'Using Photos framework').
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This renames/removes previously public APIs (+metadataWithAsset: and +dictionaryWithAssetURL:), creating a breaking change contrary to the PR description. To preserve source compatibility, consider reintroducing a deprecated wrapper for +dictionaryWithAssetURL: that fetches a PHAsset via Photos (e.g., using [PHAsset fetchAssetsWithALAssetURLs:options:]) and forwards to +dictionaryWithPHAsset:. If you intentionally drop ALAsset support, please note it clearly as a breaking change.
| // Deprecated: Use dictionaryWithPHAsset: instead. This wrapper fetches PHAsset from ALAsset URL. | |
| + (NSDictionary *)dictionaryWithAssetURL:(NSURL *)assetURL __attribute__((deprecated("Use dictionaryWithPHAsset: instead."))); | 
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -3,16 +3,13 @@ | |||||||
| // SYPictureMetadataExample | ||||||||
| // | ||||||||
| // Created by Stan Chevallier on 12/13/12. | ||||||||
| // Copyright (c) 2012 Syan. All rights reserved. | ||||||||
| // Updated by Alfin (2025) – Migrated to PHAsset / Photos framework | ||||||||
| // | ||||||||
| 
     | 
||||||||
| #import <ImageIO/ImageIO.h> | ||||||||
| #import "SYMetadata.h" | ||||||||
| #import "NSDictionary+SY.h" | ||||||||
| 
     | 
||||||||
| #if !TARGET_OS_TV | ||||||||
| #import <AssetsLibrary/AssetsLibrary.h> | ||||||||
| #endif | ||||||||
| #import <Photos/Photos.h> | ||||||||
| 
     | 
||||||||
| #define SYKeyForMetadata(name) NSStringFromSelector(@selector(metadata##name)) | ||||||||
| #define SYDictionaryForMetadata(name) SYPaste(SYPaste(kCGImageProperty,name),Dictionary) | ||||||||
| 
        
          
        
         | 
    @@ -32,79 +29,96 @@ + (instancetype)metadataWithDictionary:(NSDictionary *)dictionary | |||||||
| { | ||||||||
| if (!dictionary) | ||||||||
| return nil; | ||||||||
| 
     | 
||||||||
| NSError *error; | ||||||||
| 
     | 
||||||||
| SYMetadata *instance = [MTLJSONAdapter modelOfClass:self.class fromJSONDictionary:dictionary error:&error]; | ||||||||
| 
     | 
||||||||
| if (instance) | ||||||||
| instance->_originalDictionary = dictionary; | ||||||||
| 
     | 
||||||||
| if (error) | ||||||||
| NSLog(@"--> Error creating %@ object: %@", NSStringFromClass(self.class), error); | ||||||||
| 
     | 
||||||||
| return instance; | ||||||||
| } | ||||||||
| 
     | 
||||||||
| + (instancetype)metadataWithAsset:(ALAsset *)asset | ||||||||
| + (instancetype)metadataWithPHAsset:(PHAsset *)asset | ||||||||
| { | ||||||||
| #if !TARGET_OS_TV | ||||||||
| ALAssetRepresentation *representation = [asset defaultRepresentation]; | ||||||||
| return [self metadataWithDictionary:[representation metadata]]; | ||||||||
| #else | ||||||||
| return nil; | ||||||||
| #endif | ||||||||
| } | ||||||||
| if (!asset) return nil; | ||||||||
| 
     | 
||||||||
| + (instancetype)metadataWithAssetURL:(NSURL *)assetURL | ||||||||
| { | ||||||||
| NSDictionary *dictionary = [self dictionaryWithAssetURL:assetURL]; | ||||||||
| return [self metadataWithDictionary:dictionary]; | ||||||||
| __block SYMetadata *result = nil; | ||||||||
| 
     | 
||||||||
| PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init]; | ||||||||
| options.version = PHImageRequestOptionsVersionCurrent; | ||||||||
| options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat; | ||||||||
| options.synchronous = YES; | ||||||||
        
    
 | 
||||||||
| options.synchronous = YES; | |
| options.synchronous = YES; | |
| options.networkAccessAllowed = YES; | 
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'options.synchronous = YES' will block the calling thread until the result is ready, which can cause UI jank if invoked on the main thread. Consider an async variant (completion-based API) or enforce off-main-thread usage and document this constraint.
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PHAsset-to-metadata extraction logic is duplicated in both '+metadataWithPHAsset:' and '+dictionaryWithPHAsset:'. Consider extracting a shared helper (e.g., a static method that returns the metadata dictionary) and have both methods call it to reduce duplication and keep behavior consistent.
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: enable 'options.networkAccessAllowed = YES' to support iCloud-only assets; otherwise 'imageData' may be nil and no metadata will be returned.
| options.synchronous = YES; | |
| options.synchronous = YES; | |
| options.networkAccessAllowed = YES; | 
    
      
    
      Copilot
AI
    
    
    
      Oct 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method also uses 'options.synchronous = YES', which blocks the caller. Align with the earlier method by using an asynchronous request or ensuring calls are made off the main thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reduce header coupling and speed up builds, prefer forward-declaring PHAsset in the header and keep the Photos import in the .m file. For example, replace the import with '@Class PHAsset;' here (Photos is already imported in SYMetadata.m).