Skip to content

Commit

Permalink
Replace deprecated uniform type identifiers (facebook#47135)
Browse files Browse the repository at this point in the history
Summary:

These show up as deprecated a bunch of times on GitHub PRs. Lets do the trivial change to non deprecated names.

{F1940536675}

Changelog: [Internal]

Differential Revision: D64672460
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 21, 2024
1 parent 5697d92 commit 831f876
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/react-native/Libraries/Image/RCTImageUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import <tgmath.h>

#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/UTCoreTypes.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>

#import <React/RCTLog.h>
#import <React/RCTUtils.h>
Expand Down Expand Up @@ -337,10 +337,10 @@ BOOL RCTUpscalingRequired(
CFMutableDataRef imageData = CFDataCreateMutable(NULL, 0);
if (RCTImageHasAlpha(cgImage)) {
// get png data
destination = CGImageDestinationCreateWithData(imageData, kUTTypePNG, 1, NULL);
destination = CGImageDestinationCreateWithData(imageData, (__bridge CFStringRef)UTTypePNG.identifier, 1, NULL);
} else {
// get jpeg data
destination = CGImageDestinationCreateWithData(imageData, kUTTypeJPEG, 1, NULL);
destination = CGImageDestinationCreateWithData(imageData, (__bridge CFStringRef)UTTypeJPEG.identifier, 1, NULL);
[properties setValue:@(quality) forKey:(id)kCGImageDestinationLossyCompressionQuality];
}
if (!destination) {
Expand Down
8 changes: 4 additions & 4 deletions packages/react-native/Libraries/Text/Text/RCTTextView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <React/RCTTextView.h>

#import <MobileCoreServices/UTCoreTypes.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>

#import <React/RCTUtils.h>
#import <React/UIView+React.h>
Expand Down Expand Up @@ -275,17 +275,17 @@ - (void)copy:(id)sender
{
NSAttributedString *attributedText = _textStorage;

NSMutableDictionary *item = [NSMutableDictionary new];
NSMutableDictionary<NSString *, id> *item = [NSMutableDictionary new];

NSData *rtf = [attributedText dataFromRange:NSMakeRange(0, attributedText.length)
documentAttributes:@{NSDocumentTypeDocumentAttribute : NSRTFDTextDocumentType}
error:nil];

if (rtf) {
[item setObject:rtf forKey:(id)kUTTypeFlatRTFD];
[item setObject:rtf forKey:UTTypeFlatRTFD.identifier];
}

[item setObject:attributedText.string forKey:(id)kUTTypeUTF8PlainText];
[item setObject:attributedText.string forKey:UTTypeUTF8PlainText.identifier];

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.items = @[ item ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#import "RCTParagraphComponentView.h"
#import "RCTParagraphComponentAccessibilityProvider.h"

#import <MobileCoreServices/UTCoreTypes.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
#import <react/renderer/components/text/ParagraphComponentDescriptor.h>
#import <react/renderer/components/text/ParagraphProps.h>
#import <react/renderer/components/text/ParagraphState.h>
Expand Down Expand Up @@ -299,17 +299,17 @@ - (void)copy:(id)sender
{
NSAttributedString *attributedText = self.attributedText;

NSMutableDictionary *item = [NSMutableDictionary new];
NSMutableDictionary<NSString *, id> *item = [NSMutableDictionary new];

NSData *rtf = [attributedText dataFromRange:NSMakeRange(0, attributedText.length)
documentAttributes:@{NSDocumentTypeDocumentAttribute : NSRTFDTextDocumentType}
error:nil];

if (rtf) {
[item setObject:rtf forKey:(id)kUTTypeFlatRTFD];
[item setObject:rtf forKey:UTTypeFlatRTFD.identifier];
}

[item setObject:attributedText.string forKey:(id)kUTTypeUTF8PlainText];
[item setObject:attributedText.string forKey:UTTypeUTF8PlainText.identifier];

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.items = @[ item ];
Expand Down

0 comments on commit 831f876

Please sign in to comment.