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

Commit

Permalink
Merge branch 'release/0.16.11/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
SBiOSoftWhare committed Dec 7, 2021
2 parents 13cceed + ea0ba24 commit e6cf566
Show file tree
Hide file tree
Showing 30 changed files with 527 additions and 196 deletions.
25 changes: 25 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## Changes in 0.16.11 (2021-12-07)

✨ Features

- Moved from /space to /hierarchy API to support pagination ([#4893](https://github.com/vector-im/element-ios/issues/4893))

🙌 Improvements

- Upgrade MatrixSDK version ([v0.20.13](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.20.13)).
- Use DTCoreText's callback option to sanitise formatted messages ([#5165](https://github.com/vector-im/element-ios/issues/5165))

🐛 Bugfixes

- Fix problem with "Jump to unread" button being unresponsive. ([#4701](https://github.com/vector-im/element-ios/issues/4701))
- Fix crash that occurs when generating bubble text for some events. ([#5110](https://github.com/vector-im/element-ios/issues/5110))
- Fix missing messages on rooms with paired virtual room. ([#5111](https://github.com/vector-im/element-ios/issues/5111))
- Fix cycle in dependencies. ([#5174](https://github.com/vector-im/element-ios/issues/5174))
- Improve generated Swift header imports. ([#5194](https://github.com/vector-im/element-ios/issues/5194))
- Fix crash during late-decryption of timeline events with attachments. ([#5203](https://github.com/vector-im/element-ios/issues/5203))

Others

- Mark MatrixKit pod as deprecated. ([#5020](https://github.com/vector-im/element-ios/issues/5020))


## Changes in 0.16.10 (2021-11-17)

🙌 Improvements
Expand Down
10 changes: 8 additions & 2 deletions MatrixKit.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "MatrixKit"
s.version = "0.16.10"
s.version = "0.16.11"
s.summary = "The Matrix reusable UI library for iOS based on MatrixSDK."

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

s.requires_arc = true

s.deprecated = true

s.swift_version = '5.0'

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

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

s.subspec 'AppExtension' do |ext|
ext.source_files = "MatrixKit", "MatrixKit/**/*.{h,m,swift}", "Libs/**/*.{h,m,swift}"
ext.exclude_files = ['MatrixKit/MatrixKit-Bridging-Header.h']
ext.private_header_files = ['MatrixKit/Utils/MXKSwiftHeader.h']
ext.resources = ["MatrixKit/**/*.{xib}", "MatrixKit/Assets/MatrixKitAssets.bundle"]
ext.dependency 'DTCoreText/Extension'
end
Expand Down
16 changes: 16 additions & 0 deletions MatrixKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
71EBE6631C04608100E7D953 /* MXKRoomActivitiesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71EBE6621C04608100E7D953 /* MXKRoomActivitiesView.m */; };
8EE45E64044E107FAB59C7D1 /* Pods_MatrixKitSamplePods_MatrixKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5891CE7965783A3890D40ED9 /* Pods_MatrixKitSamplePods_MatrixKitSample.framework */; };
9135FFD926DE8EFD000E6D84 /* NSString+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9135FFD826DE8EFD000E6D84 /* NSString+MatrixKit.swift */; };
9137E95727467F8E00A6D02D /* test.png in Resources */ = {isa = PBXBuildFile; fileRef = 9137E95627467F8E00A6D02D /* test.png */; };
918DAB9F26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 918DAB9E26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift */; };
91B72DC32743CAD0002867CD /* DTHTMLElement+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91B72DC22743CAD0002867CD /* DTHTMLElement+MatrixKit.swift */; };
92663A6C1EF6E5B3005FB712 /* MXKSoundPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 92663A6B1EF6E5B3005FB712 /* MXKSoundPlayer.m */; };
B11D3C7E20C032BD00938BCB /* MXKBarButtonItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B11D3C7D20C032BD00938BCB /* MXKBarButtonItem.m */; };
B125D0FD22D5D2C200570CA4 /* MXKUTI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B125D0FC22D5D2C200570CA4 /* MXKUTI.swift */; };
Expand Down Expand Up @@ -373,8 +375,10 @@
8878281C260C85BB00429B35 /* MXKEventFormatter+Tests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MXKEventFormatter+Tests.h"; sourceTree = "<group>"; };
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>"; };
9135FFD826DE8EFD000E6D84 /* NSString+MatrixKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSString+MatrixKit.swift"; sourceTree = "<group>"; };
9137E95627467F8E00A6D02D /* test.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test.png; sourceTree = "<group>"; };
915B171C27105C5700225111 /* MXKAnalyticsConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXKAnalyticsConstants.h; sourceTree = "<group>"; };
918DAB9E26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+MatrixKit.swift"; sourceTree = "<group>"; };
91B72DC22743CAD0002867CD /* DTHTMLElement+MatrixKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DTHTMLElement+MatrixKit.swift"; sourceTree = "<group>"; };
91FE762A27047EB700E035D9 /* MXKURLPreviewDataProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXKURLPreviewDataProtocol.h; sourceTree = "<group>"; };
92663A6A1EF6E5B3005FB712 /* MXKSoundPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXKSoundPlayer.h; sourceTree = "<group>"; };
92663A6B1EF6E5B3005FB712 /* MXKSoundPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXKSoundPlayer.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -732,6 +736,7 @@
3203F2691D2E9CAE0021F170 /* MatrixKitTests */ = {
isa = PBXGroup;
children = (
9137E95527467F8500A6D02D /* Assets */,
B125D10222D62A4800570CA4 /* UTI */,
32538D071D2EA100009FE744 /* MXKEventFormatterTests.m */,
8878281C260C85BB00429B35 /* MXKEventFormatter+Tests.h */,
Expand Down Expand Up @@ -1137,6 +1142,14 @@
name = Pods;
sourceTree = "<group>";
};
9137E95527467F8500A6D02D /* Assets */ = {
isa = PBXGroup;
children = (
9137E95627467F8E00A6D02D /* test.png */,
);
path = Assets;
sourceTree = "<group>";
};
B11D3C7B20C0329B00938BCB /* BarButtonItem */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1353,6 +1366,7 @@
B12C56F12396D75500FAC6DE /* UITextView+MatrixKit.m */,
EC12E227268DD94100934C7D /* MXSession+MatrixKit.h */,
EC12E228268DD94100934C7D /* MXSession+MatrixKit.m */,
91B72DC22743CAD0002867CD /* DTHTMLElement+MatrixKit.swift */,
);
path = Categories;
sourceTree = "<group>";
Expand Down Expand Up @@ -1663,6 +1677,7 @@
buildActionMask = 2147483647;
files = (
B125D10722D62AB900570CA4 /* Text.txt in Resources */,
9137E95727467F8E00A6D02D /* test.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1958,6 +1973,7 @@
F049FC201B2B878A00DD9D3C /* NSBundle+MatrixKit.m in Sources */,
F0868E121B1CAD58004CBE80 /* MXKPublicRoomTableViewCell.m in Sources */,
F09617BD1DE8478C00093E9D /* MXKDeviceView.m in Sources */,
91B72DC32743CAD0002867CD /* DTHTMLElement+MatrixKit.swift in Sources */,
B11D3C7E20C032BD00938BCB /* MXKBarButtonItem.m in Sources */,
32CEE2301AB1EE0900F7C74D /* MXKRecentTableViewCell.m in Sources */,
F00FA8771C08A51B00E25826 /* MXKRoomOutgoingTextMsgBubbleCell.m in Sources */,
Expand Down
97 changes: 97 additions & 0 deletions MatrixKit/Categories/DTHTMLElement+MatrixKit.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// Copyright 2020 The Matrix.org Foundation C.I.C
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import DTCoreText

public extension DTHTMLElement {
typealias ImageHandler = (_ sourceURL: String, _ width: CGFloat, _ height: CGFloat) -> URL?

/// Sanitize the element using the given parameters.
/// - Parameters:
/// - allowedHTMLTags: An array of tags that are allowed. All other tags will be removed.
/// - font: The default font to use when resetting the content of any unsupported tags.
/// - imageHandler: An optional image handler to be run on `img` tags (if allowed) to update the `src` attribute.
@objc func sanitize(with allowedHTMLTags: [String], bodyFont font: UIFont, imageHandler: ImageHandler?) {
if let name = name, !allowedHTMLTags.contains(name) {

// This is an unsupported tag.
// Remove any attachments to fix rendering.
textAttachment = nil

// If the element has plain text content show that,
// otherwise prevent the tag from displaying.
if let stringContent = attributedString()?.string,
!stringContent.isEmpty,
let element = DTTextHTMLElement(name: nil, attributes: nil) {
element.setText(stringContent)
removeAllChildNodes()
addChildNode(element)

if let parent = parent() {
element.inheritAttributes(from: parent)
} else {
fontDescriptor = DTCoreTextFontDescriptor()
fontDescriptor.fontFamily = font.familyName
fontDescriptor.fontName = font.fontName
fontDescriptor.pointSize = font.pointSize
paragraphStyle = DTCoreTextParagraphStyle.default()

element.inheritAttributes(from: self)
}
element.interpretAttributes()

} else if let parent = parent() {
parent.removeChildNode(self)
} else {
didOutput = true
}

} else {
// Process images with the handler when self is an image tag.
if name == "img", let imageHandler = imageHandler {
process(with: imageHandler)
}

// This element is a supported tag, but it may contain children that aren't,
// so santize all child nodes to ensure correct tags.
if let childNodes = childNodes as? [DTHTMLElement] {
childNodes.forEach { $0.sanitize(with: allowedHTMLTags, bodyFont: font, imageHandler: imageHandler) }
}
}
}

/// Process the element with the supplied image handler.
private func process(with imageHandler: ImageHandler) {
// Get the values required to pass to the image handler
guard let sourceURL = attributes["src"] as? String else { return }

var width: CGFloat = -1
if let widthString = attributes["width"] as? String,
let widthDouble = Double(widthString) {
width = CGFloat(widthDouble)
}

var height: CGFloat = -1
if let heightString = attributes["height"] as? String,
let heightDouble = Double(heightString) {
height = CGFloat(heightDouble)
}

// If the handler returns an updated URL, update the text attachment.
guard let localSourceURL = imageHandler(sourceURL, width, height) else { return }
textAttachment.contentURL = localSourceURL
}
}
2 changes: 0 additions & 2 deletions MatrixKit/Categories/MXAggregatedReactions+MatrixKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
limitations under the License.
*/

#import <MatrixSDK/MatrixSDK.h>

#import "MXKEventFormatter.h"

NS_ASSUME_NONNULL_BEGIN
Expand Down
2 changes: 0 additions & 2 deletions MatrixKit/Categories/MXEvent+MatrixKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
limitations under the License.
*/

#import <MatrixSDK/MatrixSDK.h>

#import "MXKEventFormatter.h"

/**
Expand Down
2 changes: 0 additions & 2 deletions MatrixKit/Categories/NSBundle+MatrixKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#import <UIKit/UIKit.h>

#import <MatrixSDK/MatrixSDK.h>

/**
Define a `NSBundle` category at MatrixKit level to retrieve images and sounds from MatrixKit Assets bundle.
*/
Expand Down
4 changes: 3 additions & 1 deletion MatrixKit/Controllers/MXKAttachmentsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,9 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
{
if ([controlView isKindOfClass:[UIView class]] && ((UIView*)controlView).tag == 1004)
{
controlsVisible = ([controlView alpha] <= 0.0) ? NO : YES;
UIView *subView = (UIView*)controlView;

controlsVisible = (subView.alpha <= 0.0) ? NO : YES;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Controllers/MXKContactListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger

if (section < sectionedContacts.sectionedContacts.count)
{
return [[sectionedContacts.sectionedContacts objectAtIndex:section] count];
return [sectionedContacts.sectionedContacts[section] count];
}
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion MatrixKit/Controllers/MXKRecentListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

#import "MXKInterleavedRecentsDataSource.h"
#import "MXKInterleavedRecentTableViewCell.h"
#import <MatrixSDK/MatrixSDK-Swift.h>

#import "MXKSwiftHeader.h"

@interface MXKRecentListViewController ()
{
Expand Down
5 changes: 2 additions & 3 deletions MatrixKit/MatrixKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#import <UIKit/UIKit.h>

#import <MatrixSDK/MatrixSDK.h>

#import "MXKConstants.h"

#import "MXKAppSettings.h"
Expand Down Expand Up @@ -153,4 +151,5 @@
#import "MXKSessionGroupsDataSource.h"
#import "MXKGroupListViewController.h"
#import "MXKGroupTableViewCell.h"
#import "MXKSwiftHeader.h"

#import "MXKSlashCommands.h"
2 changes: 1 addition & 1 deletion MatrixKit/MatrixKitVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

#import <Foundation/Foundation.h>

NSString *const MatrixKitVersion = @"0.16.10";
NSString *const MatrixKitVersion = @"0.16.11";
12 changes: 7 additions & 5 deletions MatrixKit/Models/Contact/MXKSectionedContacts.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@

#import <Foundation/Foundation.h>

#import "MXKContact.h"

@interface MXKSectionedContacts : NSObject {
int contactsCount;
NSArray *sectionTitles;
NSArray *sectionedContacts;
NSArray<NSString*> *sectionTitles;
NSArray<NSArray<MXKContact*>*> *sectionedContacts;
}

@property (nonatomic, readonly) int contactsCount;
@property (nonatomic, readonly) NSArray *sectionTitles;
@property (nonatomic, readonly) NSArray *sectionedContacts;
@property (nonatomic, readonly) NSArray<NSString*> *sectionTitles;
@property (nonatomic, readonly) NSArray<NSArray<MXKContact*>*> *sectionedContacts;

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

@end
2 changes: 1 addition & 1 deletion MatrixKit/Models/Contact/MXKSectionedContacts.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ @implementation MXKSectionedContacts

@synthesize contactsCount, sectionTitles, sectionedContacts;

-(id)initWithContacts:(NSArray *)inSectionedContacts andTitles:(NSArray *)titles andCount:(int)count {
-(id)initWithContacts:(NSArray<NSArray<MXKContact*> *> *)inSectionedContacts andTitles:(NSArray<NSString *> *)titles andCount:(int)count {
if (self = [super init]) {
contactsCount = count;
sectionedContacts = inSectionedContacts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ - (NSString*)textMessage
{
for (MXKRoomBubbleComponent* component in bubbleComponents)
{
if (component.textMessage == nil)
{
continue;
}
if (!currentTextMsg)
{
currentTextMsg = [NSMutableString stringWithString:component.textMessage];
Expand Down
Loading

0 comments on commit e6cf566

Please sign in to comment.