Skip to content

Commit

Permalink
Prefer URLs over images when the pasteboard contains both
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Mar 28, 2022
1 parent 3ecf3ed commit 74a734c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions IRCCloud/Classes/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -5340,15 +5340,15 @@ -(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]}];
return;
}
}
[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)
Expand Down Expand Up @@ -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];
}
}
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
237
239

0 comments on commit 74a734c

Please sign in to comment.