From 74a734c8693c67e6fe2963408cfea4eb411936f5 Mon Sep 17 00:00:00 2001 From: Sam Steele Date: Mon, 28 Mar 2022 08:41:36 -0400 Subject: [PATCH] Prefer URLs over images when the pasteboard contains both --- IRCCloud/Classes/MainViewController.m | 6 +++--- build-scripts/BUILD | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IRCCloud/Classes/MainViewController.m b/IRCCloud/Classes/MainViewController.m index dd0a5836..3d7ec2f2 100644 --- a/IRCCloud/Classes/MainViewController.m +++ b/IRCCloud/Classes/MainViewController.m @@ -5340,7 +5340,7 @@ -(void)closeColorPicker { } -(void)paste:(id)sender { - if([UIPasteboard generalPasteboard].image) { + if([UIPasteboard generalPasteboard].hasImages && ![UIPasteboard generalPasteboard].hasURLs) { for(NSString *type in [UIPasteboard generalPasteboard].pasteboardTypes) { if([type isEqualToString:(__bridge NSString *)kUTTypeGIF]) { [self _imagePickerController:[UIImagePickerController new] didFinishPickingMediaWithInfo:@{UIImagePickerControllerOriginalImage:[UIPasteboard generalPasteboard].image, @"gifData":[[UIPasteboard generalPasteboard] dataForPasteboardType:(__bridge NSString *)kUTTypeGIF]}]; @@ -5348,7 +5348,7 @@ -(void)paste:(id)sender { } } [self _imagePickerController:[UIImagePickerController new] didFinishPickingMediaWithInfo:@{UIImagePickerControllerOriginalImage:[UIPasteboard generalPasteboard].image}]; - } else if([UIPasteboard generalPasteboard].strings) { + } else if([UIPasteboard generalPasteboard].hasStrings) { NSMutableString *text = @"".mutableCopy; for(NSString *s in [UIPasteboard generalPasteboard].strings) { if(text.length) @@ -5412,7 +5412,7 @@ -(void)pasteRich:(id)sender { [self->_message setAttributedText:msg]; if(shouldMoveCursor) self->_message.selectedRange = NSMakeRange(msg.length, 0); - } else if([UIPasteboard generalPasteboard].strings) { + } else if([UIPasteboard generalPasteboard].hasStrings) { [self paste:nil]; } } diff --git a/build-scripts/BUILD b/build-scripts/BUILD index f71beab7..34578cc4 100644 --- a/build-scripts/BUILD +++ b/build-scripts/BUILD @@ -1 +1 @@ -237 \ No newline at end of file +239 \ No newline at end of file