Merge branch 'master' into develop

This commit is contained in:
Doug
2022-09-12 17:14:51 +01:00
4 changed files with 33 additions and 11 deletions
+11
View File
@@ -1,3 +1,14 @@
## Changes in 1.9.5 (2022-09-12)
🐛 Bugfixes
- Fix timeline items text height calculation ([#6702](https://github.com/vector-im/element-ios/pull/6702))
🚧 In development 🚧
- Device manager: Add other sessions section read only in user sessions overview screen. ([#6672](https://github.com/vector-im/element-ios/issues/6672))
## Changes in 1.9.4 (2022-09-09)
✨ Features
@@ -533,15 +533,7 @@
CGFloat verticalInset = measurementTextView.textContainerInset.top + measurementTextView.textContainerInset.bottom;
CGFloat horizontalInset = measurementTextView.textContainer.lineFragmentPadding * 2;
CGSize size = [attributedText boundingRectWithSize:CGSizeMake(_maxTextViewWidth - horizontalInset, CGFLOAT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingUsesDeviceMetrics
context:nil].size;
//In iOS 7 and later, this method returns fractional sizes (in the size component of the returned rectangle);
// to use a returned size to size views, you must use raise its value to the nearest higher integer using the
// [ceil](https://developer.apple.com/documentation/kernel/1557272-ceil?changes=latest_major) function.
size.width = ceil(size.width);
size.height = ceil(size.height);
CGSize size = [self sizeForAttributedString:attributedText fittingWidth:_maxTextViewWidth - horizontalInset];
// The result is expected to contain the textView textContainer's paddings. Add them back if necessary
if (removeVerticalInset == NO) {
@@ -553,6 +545,27 @@
return size;
}
// https://stackoverflow.com/questions/54497598/nsattributedstring-boundingrect-returns-wrong-height
- (CGSize)sizeForAttributedString:(NSAttributedString *)attributedString fittingWidth:(CGFloat)width
{
NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:attributedString];
CGRect boundingRect = CGRectMake(0.0, 0.0, width, CGFLOAT_MAX);
NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:boundingRect.size];
textContainer.lineFragmentPadding = 0;
NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
[layoutManager addTextContainer: textContainer];
[textStorage addLayoutManager:layoutManager];
[layoutManager glyphRangeForBoundingRect:boundingRect inTextContainer:textContainer];
CGRect rect = [layoutManager usedRectForTextContainer:textContainer];
return CGRectIntegral(rect).size;
}
#pragma mark - Properties
- (MXSession*)mxSession
-1
View File
@@ -1 +0,0 @@
Device manager: Add other sessions section read only in user sessions overview screen.
-1
View File
@@ -1 +0,0 @@
Fix timeline items text height calculation