mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-04 06:58:20 +02:00
Setup NSTextAttachmentViewProvider
This commit is contained in:
@@ -433,6 +433,12 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
{
|
||||
// Apply alpha to blur this component
|
||||
componentString = [Tools setTextColorAlpha:.2 inAttributedString:componentString];
|
||||
[Tools setPillAlpha:.2 inAttributedString:componentString];
|
||||
}
|
||||
else
|
||||
{
|
||||
// PillTextAttachment are not created again every time, we have to set alpha back to standard if needed.
|
||||
[Tools setPillAlpha:1.f inAttributedString:componentString];
|
||||
}
|
||||
|
||||
// Check whether the timestamp is displayed for this component, and check whether a vertical whitespace is required
|
||||
@@ -472,6 +478,12 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
{
|
||||
// Apply alpha to blur this component
|
||||
componentString = [Tools setTextColorAlpha:.2 inAttributedString:componentString];
|
||||
[Tools setPillAlpha:.2 inAttributedString:componentString];
|
||||
}
|
||||
else
|
||||
{
|
||||
// PillTextAttachment are not created again every time, we have to set alpha back to standard if needed.
|
||||
[Tools setPillAlpha:1.f inAttributedString:componentString];
|
||||
}
|
||||
|
||||
// Check whether the timestamp is displayed
|
||||
|
||||
@@ -1391,23 +1391,7 @@ static NSMutableDictionary *childClasses;
|
||||
{
|
||||
UITextView *textView = self.messageTextView;
|
||||
CGPoint tapLocation = [sender locationInView:textView];
|
||||
UITextPosition *textPosition = [textView closestPositionToPoint:tapLocation];
|
||||
NSDictionary *attributes = [textView textStylingAtPosition:textPosition inDirection:UITextStorageDirectionForward];
|
||||
|
||||
// The value of `NSLinkAttributeName` attribute could be an NSURL or an NSString object.
|
||||
id tappedURLObject = attributes[NSLinkAttributeName];
|
||||
|
||||
if (tappedURLObject)
|
||||
{
|
||||
if ([tappedURLObject isKindOfClass:[NSURL class]])
|
||||
{
|
||||
tappedUrl = (NSURL*)tappedURLObject;
|
||||
}
|
||||
else if ([tappedURLObject isKindOfClass:[NSString class]])
|
||||
{
|
||||
tappedUrl = [NSURL URLWithString:(NSString*)tappedURLObject];
|
||||
}
|
||||
}
|
||||
tappedUrl = [textView urlForLinkAtLocation:tapLocation];
|
||||
}
|
||||
|
||||
MXKRoomBubbleComponent *tappedComponent = [self closestBubbleComponentForGestureRecognizer:sender locationInView:sender.view];
|
||||
@@ -1652,7 +1636,7 @@ static NSMutableDictionary *childClasses;
|
||||
UITextView *textView = (UITextView*)touchedView;
|
||||
CGPoint touchLocation = [touch locationInView:textView];
|
||||
|
||||
return [textView isThereALinkNearPoint:touchLocation] == NO;
|
||||
return [textView isThereALinkNearLocation:touchLocation] == NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user