Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit e6cf566

Browse files
committed
Merge branch 'release/0.16.11/master'
2 parents 13cceed + ea0ba24 commit e6cf566

30 files changed

+527
-196
lines changed

CHANGES.md

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
## Changes in 0.16.11 (2021-12-07)
2+
3+
✨ Features
4+
5+
- Moved from /space to /hierarchy API to support pagination ([#4893](https://github.com/vector-im/element-ios/issues/4893))
6+
7+
🙌 Improvements
8+
9+
- Upgrade MatrixSDK version ([v0.20.13](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.20.13)).
10+
- Use DTCoreText's callback option to sanitise formatted messages ([#5165](https://github.com/vector-im/element-ios/issues/5165))
11+
12+
🐛 Bugfixes
13+
14+
- Fix problem with "Jump to unread" button being unresponsive. ([#4701](https://github.com/vector-im/element-ios/issues/4701))
15+
- Fix crash that occurs when generating bubble text for some events. ([#5110](https://github.com/vector-im/element-ios/issues/5110))
16+
- Fix missing messages on rooms with paired virtual room. ([#5111](https://github.com/vector-im/element-ios/issues/5111))
17+
- Fix cycle in dependencies. ([#5174](https://github.com/vector-im/element-ios/issues/5174))
18+
- Improve generated Swift header imports. ([#5194](https://github.com/vector-im/element-ios/issues/5194))
19+
- Fix crash during late-decryption of timeline events with attachments. ([#5203](https://github.com/vector-im/element-ios/issues/5203))
20+
21+
Others
22+
23+
- Mark MatrixKit pod as deprecated. ([#5020](https://github.com/vector-im/element-ios/issues/5020))
24+
25+
126
## Changes in 0.16.10 (2021-11-17)
227

328
🙌 Improvements

MatrixKit.podspec

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "MatrixKit"
4-
s.version = "0.16.10"
4+
s.version = "0.16.11"
55
s.summary = "The Matrix reusable UI library for iOS based on MatrixSDK."
66

77
s.description = <<-DESC
@@ -20,10 +20,12 @@ Pod::Spec.new do |s|
2020
s.source = { :git => "https://github.com/matrix-org/matrix-ios-kit.git", :tag => "v#{s.version}" }
2121

2222
s.requires_arc = true
23+
24+
s.deprecated = true
2325

2426
s.swift_version = '5.0'
2527

26-
s.dependency 'MatrixSDK', "= 0.20.10"
28+
s.dependency 'MatrixSDK', "= 0.20.13"
2729
s.dependency 'HPGrowingTextView', '~> 1.1'
2830
s.dependency 'libPhoneNumber-iOS', '~> 0.9.13'
2931
s.dependency 'DTCoreText', '~> 1.6.25'
@@ -33,12 +35,16 @@ Pod::Spec.new do |s|
3335

3436
s.subspec 'Core' do |core|
3537
core.source_files = "MatrixKit", "MatrixKit/**/*.{h,m,swift}", "Libs/**/*.{h,m,swift}"
38+
core.exclude_files = ['MatrixKit/MatrixKit-Bridging-Header.h']
39+
core.private_header_files = ['MatrixKit/Utils/MXKSwiftHeader.h']
3640
core.resources = ["MatrixKit/**/*.{xib}", "MatrixKit/Assets/MatrixKitAssets.bundle"]
3741
core.dependency 'DTCoreText'
3842
end
3943

4044
s.subspec 'AppExtension' do |ext|
4145
ext.source_files = "MatrixKit", "MatrixKit/**/*.{h,m,swift}", "Libs/**/*.{h,m,swift}"
46+
ext.exclude_files = ['MatrixKit/MatrixKit-Bridging-Header.h']
47+
ext.private_header_files = ['MatrixKit/Utils/MXKSwiftHeader.h']
4248
ext.resources = ["MatrixKit/**/*.{xib}", "MatrixKit/Assets/MatrixKitAssets.bundle"]
4349
ext.dependency 'DTCoreText/Extension'
4450
end

MatrixKit.xcodeproj/project.pbxproj

+16
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262
71EBE6631C04608100E7D953 /* MXKRoomActivitiesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71EBE6621C04608100E7D953 /* MXKRoomActivitiesView.m */; };
6363
8EE45E64044E107FAB59C7D1 /* Pods_MatrixKitSamplePods_MatrixKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5891CE7965783A3890D40ED9 /* Pods_MatrixKitSamplePods_MatrixKitSample.framework */; };
6464
9135FFD926DE8EFD000E6D84 /* NSString+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9135FFD826DE8EFD000E6D84 /* NSString+MatrixKit.swift */; };
65+
9137E95727467F8E00A6D02D /* test.png in Resources */ = {isa = PBXBuildFile; fileRef = 9137E95627467F8E00A6D02D /* test.png */; };
6566
918DAB9F26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 918DAB9E26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift */; };
67+
91B72DC32743CAD0002867CD /* DTHTMLElement+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91B72DC22743CAD0002867CD /* DTHTMLElement+MatrixKit.swift */; };
6668
92663A6C1EF6E5B3005FB712 /* MXKSoundPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 92663A6B1EF6E5B3005FB712 /* MXKSoundPlayer.m */; };
6769
B11D3C7E20C032BD00938BCB /* MXKBarButtonItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B11D3C7D20C032BD00938BCB /* MXKBarButtonItem.m */; };
6870
B125D0FD22D5D2C200570CA4 /* MXKUTI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B125D0FC22D5D2C200570CA4 /* MXKUTI.swift */; };
@@ -373,8 +375,10 @@
373375
8878281C260C85BB00429B35 /* MXKEventFormatter+Tests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MXKEventFormatter+Tests.h"; sourceTree = "<group>"; };
374376
8C751E43C4D87B309065E3C8 /* Pods-MatrixKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MatrixKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MatrixKitTests/Pods-MatrixKitTests.release.xcconfig"; sourceTree = "<group>"; };
375377
9135FFD826DE8EFD000E6D84 /* NSString+MatrixKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSString+MatrixKit.swift"; sourceTree = "<group>"; };
378+
9137E95627467F8E00A6D02D /* test.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test.png; sourceTree = "<group>"; };
376379
915B171C27105C5700225111 /* MXKAnalyticsConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXKAnalyticsConstants.h; sourceTree = "<group>"; };
377380
918DAB9E26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+MatrixKit.swift"; sourceTree = "<group>"; };
381+
91B72DC22743CAD0002867CD /* DTHTMLElement+MatrixKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DTHTMLElement+MatrixKit.swift"; sourceTree = "<group>"; };
378382
91FE762A27047EB700E035D9 /* MXKURLPreviewDataProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXKURLPreviewDataProtocol.h; sourceTree = "<group>"; };
379383
92663A6A1EF6E5B3005FB712 /* MXKSoundPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXKSoundPlayer.h; sourceTree = "<group>"; };
380384
92663A6B1EF6E5B3005FB712 /* MXKSoundPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXKSoundPlayer.m; sourceTree = "<group>"; };
@@ -732,6 +736,7 @@
732736
3203F2691D2E9CAE0021F170 /* MatrixKitTests */ = {
733737
isa = PBXGroup;
734738
children = (
739+
9137E95527467F8500A6D02D /* Assets */,
735740
B125D10222D62A4800570CA4 /* UTI */,
736741
32538D071D2EA100009FE744 /* MXKEventFormatterTests.m */,
737742
8878281C260C85BB00429B35 /* MXKEventFormatter+Tests.h */,
@@ -1137,6 +1142,14 @@
11371142
name = Pods;
11381143
sourceTree = "<group>";
11391144
};
1145+
9137E95527467F8500A6D02D /* Assets */ = {
1146+
isa = PBXGroup;
1147+
children = (
1148+
9137E95627467F8E00A6D02D /* test.png */,
1149+
);
1150+
path = Assets;
1151+
sourceTree = "<group>";
1152+
};
11401153
B11D3C7B20C0329B00938BCB /* BarButtonItem */ = {
11411154
isa = PBXGroup;
11421155
children = (
@@ -1353,6 +1366,7 @@
13531366
B12C56F12396D75500FAC6DE /* UITextView+MatrixKit.m */,
13541367
EC12E227268DD94100934C7D /* MXSession+MatrixKit.h */,
13551368
EC12E228268DD94100934C7D /* MXSession+MatrixKit.m */,
1369+
91B72DC22743CAD0002867CD /* DTHTMLElement+MatrixKit.swift */,
13561370
);
13571371
path = Categories;
13581372
sourceTree = "<group>";
@@ -1663,6 +1677,7 @@
16631677
buildActionMask = 2147483647;
16641678
files = (
16651679
B125D10722D62AB900570CA4 /* Text.txt in Resources */,
1680+
9137E95727467F8E00A6D02D /* test.png in Resources */,
16661681
);
16671682
runOnlyForDeploymentPostprocessing = 0;
16681683
};
@@ -1958,6 +1973,7 @@
19581973
F049FC201B2B878A00DD9D3C /* NSBundle+MatrixKit.m in Sources */,
19591974
F0868E121B1CAD58004CBE80 /* MXKPublicRoomTableViewCell.m in Sources */,
19601975
F09617BD1DE8478C00093E9D /* MXKDeviceView.m in Sources */,
1976+
91B72DC32743CAD0002867CD /* DTHTMLElement+MatrixKit.swift in Sources */,
19611977
B11D3C7E20C032BD00938BCB /* MXKBarButtonItem.m in Sources */,
19621978
32CEE2301AB1EE0900F7C74D /* MXKRecentTableViewCell.m in Sources */,
19631979
F00FA8771C08A51B00E25826 /* MXKRoomOutgoingTextMsgBubbleCell.m in Sources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
//
2+
// Copyright 2020 The Matrix.org Foundation C.I.C
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
import DTCoreText
18+
19+
public extension DTHTMLElement {
20+
typealias ImageHandler = (_ sourceURL: String, _ width: CGFloat, _ height: CGFloat) -> URL?
21+
22+
/// Sanitize the element using the given parameters.
23+
/// - Parameters:
24+
/// - allowedHTMLTags: An array of tags that are allowed. All other tags will be removed.
25+
/// - font: The default font to use when resetting the content of any unsupported tags.
26+
/// - imageHandler: An optional image handler to be run on `img` tags (if allowed) to update the `src` attribute.
27+
@objc func sanitize(with allowedHTMLTags: [String], bodyFont font: UIFont, imageHandler: ImageHandler?) {
28+
if let name = name, !allowedHTMLTags.contains(name) {
29+
30+
// This is an unsupported tag.
31+
// Remove any attachments to fix rendering.
32+
textAttachment = nil
33+
34+
// If the element has plain text content show that,
35+
// otherwise prevent the tag from displaying.
36+
if let stringContent = attributedString()?.string,
37+
!stringContent.isEmpty,
38+
let element = DTTextHTMLElement(name: nil, attributes: nil) {
39+
element.setText(stringContent)
40+
removeAllChildNodes()
41+
addChildNode(element)
42+
43+
if let parent = parent() {
44+
element.inheritAttributes(from: parent)
45+
} else {
46+
fontDescriptor = DTCoreTextFontDescriptor()
47+
fontDescriptor.fontFamily = font.familyName
48+
fontDescriptor.fontName = font.fontName
49+
fontDescriptor.pointSize = font.pointSize
50+
paragraphStyle = DTCoreTextParagraphStyle.default()
51+
52+
element.inheritAttributes(from: self)
53+
}
54+
element.interpretAttributes()
55+
56+
} else if let parent = parent() {
57+
parent.removeChildNode(self)
58+
} else {
59+
didOutput = true
60+
}
61+
62+
} else {
63+
// Process images with the handler when self is an image tag.
64+
if name == "img", let imageHandler = imageHandler {
65+
process(with: imageHandler)
66+
}
67+
68+
// This element is a supported tag, but it may contain children that aren't,
69+
// so santize all child nodes to ensure correct tags.
70+
if let childNodes = childNodes as? [DTHTMLElement] {
71+
childNodes.forEach { $0.sanitize(with: allowedHTMLTags, bodyFont: font, imageHandler: imageHandler) }
72+
}
73+
}
74+
}
75+
76+
/// Process the element with the supplied image handler.
77+
private func process(with imageHandler: ImageHandler) {
78+
// Get the values required to pass to the image handler
79+
guard let sourceURL = attributes["src"] as? String else { return }
80+
81+
var width: CGFloat = -1
82+
if let widthString = attributes["width"] as? String,
83+
let widthDouble = Double(widthString) {
84+
width = CGFloat(widthDouble)
85+
}
86+
87+
var height: CGFloat = -1
88+
if let heightString = attributes["height"] as? String,
89+
let heightDouble = Double(heightString) {
90+
height = CGFloat(heightDouble)
91+
}
92+
93+
// If the handler returns an updated URL, update the text attachment.
94+
guard let localSourceURL = imageHandler(sourceURL, width, height) else { return }
95+
textAttachment.contentURL = localSourceURL
96+
}
97+
}

MatrixKit/Categories/MXAggregatedReactions+MatrixKit.h

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
limitations under the License.
1515
*/
1616

17-
#import <MatrixSDK/MatrixSDK.h>
18-
1917
#import "MXKEventFormatter.h"
2018

2119
NS_ASSUME_NONNULL_BEGIN

MatrixKit/Categories/MXEvent+MatrixKit.h

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
limitations under the License.
1515
*/
1616

17-
#import <MatrixSDK/MatrixSDK.h>
18-
1917
#import "MXKEventFormatter.h"
2018

2119
/**

MatrixKit/Categories/NSBundle+MatrixKit.h

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#import <UIKit/UIKit.h>
1818

19-
#import <MatrixSDK/MatrixSDK.h>
20-
2119
/**
2220
Define a `NSBundle` category at MatrixKit level to retrieve images and sounds from MatrixKit Assets bundle.
2321
*/

MatrixKit/Controllers/MXKAttachmentsViewController.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,9 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
933933
{
934934
if ([controlView isKindOfClass:[UIView class]] && ((UIView*)controlView).tag == 1004)
935935
{
936-
controlsVisible = ([controlView alpha] <= 0.0) ? NO : YES;
936+
UIView *subView = (UIView*)controlView;
937+
938+
controlsVisible = (subView.alpha <= 0.0) ? NO : YES;
937939
}
938940
}
939941
}

MatrixKit/Controllers/MXKContactListViewController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
284284

285285
if (section < sectionedContacts.sectionedContacts.count)
286286
{
287-
return [[sectionedContacts.sectionedContacts objectAtIndex:section] count];
287+
return [sectionedContacts.sectionedContacts[section] count];
288288
}
289289
return 0;
290290
}

MatrixKit/Controllers/MXKRecentListViewController.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
#import "MXKInterleavedRecentsDataSource.h"
2323
#import "MXKInterleavedRecentTableViewCell.h"
24-
#import <MatrixSDK/MatrixSDK-Swift.h>
24+
25+
#import "MXKSwiftHeader.h"
2526

2627
@interface MXKRecentListViewController ()
2728
{

MatrixKit/MatrixKit.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
#import <UIKit/UIKit.h>
1919

20-
#import <MatrixSDK/MatrixSDK.h>
21-
2220
#import "MXKConstants.h"
2321

2422
#import "MXKAppSettings.h"
@@ -153,4 +151,5 @@
153151
#import "MXKSessionGroupsDataSource.h"
154152
#import "MXKGroupListViewController.h"
155153
#import "MXKGroupTableViewCell.h"
156-
#import "MXKSwiftHeader.h"
154+
155+
#import "MXKSlashCommands.h"

MatrixKit/MatrixKitVersion.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19-
NSString *const MatrixKitVersion = @"0.16.10";
19+
NSString *const MatrixKitVersion = @"0.16.11";

MatrixKit/Models/Contact/MXKSectionedContacts.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19+
#import "MXKContact.h"
20+
1921
@interface MXKSectionedContacts : NSObject {
2022
int contactsCount;
21-
NSArray *sectionTitles;
22-
NSArray *sectionedContacts;
23+
NSArray<NSString*> *sectionTitles;
24+
NSArray<NSArray<MXKContact*>*> *sectionedContacts;
2325
}
2426

2527
@property (nonatomic, readonly) int contactsCount;
26-
@property (nonatomic, readonly) NSArray *sectionTitles;
27-
@property (nonatomic, readonly) NSArray *sectionedContacts;
28+
@property (nonatomic, readonly) NSArray<NSString*> *sectionTitles;
29+
@property (nonatomic, readonly) NSArray<NSArray<MXKContact*>*> *sectionedContacts;
2830

29-
-(id)initWithContacts:(NSArray *)inSectionedContacts andTitles:(NSArray *)titles andCount:(int)count;
31+
- (instancetype)initWithContacts:(NSArray<NSArray<MXKContact*>*> *)inSectionedContacts andTitles:(NSArray<NSString*> *)titles andCount:(int)count;
3032

3133
@end

MatrixKit/Models/Contact/MXKSectionedContacts.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ @implementation MXKSectionedContacts
2020

2121
@synthesize contactsCount, sectionTitles, sectionedContacts;
2222

23-
-(id)initWithContacts:(NSArray *)inSectionedContacts andTitles:(NSArray *)titles andCount:(int)count {
23+
-(id)initWithContacts:(NSArray<NSArray<MXKContact*> *> *)inSectionedContacts andTitles:(NSArray<NSString *> *)titles andCount:(int)count {
2424
if (self = [super init]) {
2525
contactsCount = count;
2626
sectionedContacts = inSectionedContacts;

MatrixKit/Models/Room/MXKRoomBubbleCellDataWithAppendingMode.m

+4
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ - (NSString*)textMessage
230230
{
231231
for (MXKRoomBubbleComponent* component in bubbleComponents)
232232
{
233+
if (component.textMessage == nil)
234+
{
235+
continue;
236+
}
233237
if (!currentTextMsg)
234238
{
235239
currentTextMsg = [NSMutableString stringWithString:component.textMessage];

0 commit comments

Comments
 (0)