Merge branch 'release/1.2.5/master'

This commit is contained in:
ismailgulek 2021-03-03 22:57:29 +03:00
commit 9826c0b063
13 changed files with 139 additions and 19 deletions

View file

@ -1,3 +1,30 @@
Changes in 1.2.5 (2021-03-03)
=================================================
✨ Features
*
🙌 Improvements
* Settings: Add option to show NSFW public rooms (off by default).
🐛 Bugfix
*
⚠️ API Changes
*
🗣 Translations
*
🧱 Build
*
Others
*
Improvements:
* Upgrade MatrixKit version ([v0.14.4](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.14.4)).
Changes in 1.2.4 (2021-03-01)
=================================================

View file

@ -22,8 +22,8 @@ APPLICATION_GROUP_IDENTIFIER = group.im.vector
APPLICATION_SCHEME = element
// Version
MARKETING_VERSION = 1.2.4
CURRENT_PROJECT_VERSION = 1.2.4
MARKETING_VERSION = 1.2.5
CURRENT_PROJECT_VERSION = 1.2.5
// Team

View file

@ -11,7 +11,7 @@ use_frameworks!
# - `{ {kit spec hash} => {sdk spec hash}` to depend on specific pod options (:git => …, :podspec => …) for each repo. Used by Fastfile during CI
#
# Warning: our internal tooling depends on the name of this variable name, so be sure not to change it
$matrixKitVersion = '= 0.14.3'
$matrixKitVersion = '= 0.14.4'
# $matrixKitVersion = :local
# $matrixKitVersion = {'develop' => 'develop'}

View file

@ -55,28 +55,28 @@ PODS:
- MatomoTracker (7.2.2):
- MatomoTracker/Core (= 7.2.2)
- MatomoTracker/Core (7.2.2)
- MatrixKit (0.14.3):
- MatrixKit (0.14.4):
- Down (~> 0.9.3)
- DTCoreText (~> 1.6.23)
- HPGrowingTextView (~> 1.1)
- libPhoneNumber-iOS (~> 0.9.13)
- MatrixKit/Core (= 0.14.3)
- MatrixSDK (= 0.18.3)
- MatrixKit/Core (0.14.3):
- MatrixKit/Core (= 0.14.4)
- MatrixSDK (= 0.18.4)
- MatrixKit/Core (0.14.4):
- Down (~> 0.9.3)
- DTCoreText (~> 1.6.23)
- HPGrowingTextView (~> 1.1)
- libPhoneNumber-iOS (~> 0.9.13)
- MatrixSDK (= 0.18.3)
- MatrixSDK (0.18.3):
- MatrixSDK/Core (= 0.18.3)
- MatrixSDK/Core (0.18.3):
- MatrixSDK (= 0.18.4)
- MatrixSDK (0.18.4):
- MatrixSDK/Core (= 0.18.4)
- MatrixSDK/Core (0.18.4):
- AFNetworking (~> 4.0.0)
- GZIP (~> 1.3.0)
- libbase58 (~> 0.1.4)
- OLMKit (~> 3.2.2)
- Realm (= 10.1.4)
- MatrixSDK/JingleCallStack (0.18.3):
- MatrixSDK/JingleCallStack (0.18.4):
- JitsiMeetSDK (= 3.1.0)
- MatrixSDK/Core
- OLMKit (3.2.2):
@ -115,7 +115,7 @@ DEPENDENCIES:
- KeychainAccess (~> 4.2.1)
- KTCenterFlowLayout (~> 1.3.1)
- MatomoTracker (~> 7.2.2)
- MatrixKit (= 0.14.3)
- MatrixKit (= 0.14.4)
- MatrixSDK
- MatrixSDK/JingleCallStack
- OLMKit
@ -186,8 +186,8 @@ SPEC CHECKSUMS:
LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d
Logging: beeb016c9c80cf77042d62e83495816847ef108b
MatomoTracker: a59ec4da0f580be57bdc6baa708a71a86532a832
MatrixKit: 93f4cac34b6007d7b1a933bfb54a6861021fc9f7
MatrixSDK: 5614040637b366f721a4ac0895bcdf07120ad718
MatrixKit: fad56170110b7248cfdd5bf210f944c6fad04162
MatrixSDK: d2cb905cf6afa5df63c5a76f7678456723923af5
OLMKit: 20d1c564033a1ae7148f8f599378d4c798363905
ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d
Realm: 80f4fb2971ccb9adc27a47d0955ae8e533a7030b
@ -199,6 +199,6 @@ SPEC CHECKSUMS:
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb
PODFILE CHECKSUM: 7a43b794a6a755e3235826542c0d65cf05496281
PODFILE CHECKSUM: c98fd507efbe607a5821e154e941210a093f54f9
COCOAPODS: 1.10.0

View file

@ -596,6 +596,7 @@ Tap the + to start adding people.";
"settings_identity_server_no_is" = "No identity server configured";
"settings_identity_server_no_is_description" = "You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one above.";
"settings_show_NSFW_public_rooms" = "Show NSFW public rooms";
// Security settings
"security_settings_title" = "Security";

View file

@ -4278,6 +4278,10 @@ internal enum VectorL10n {
internal static var settingsShowDecryptedContent: String {
return VectorL10n.tr("Vector", "settings_show_decrypted_content")
}
/// Show NSFW public rooms
internal static var settingsShowNSFWPublicRooms: String {
return VectorL10n.tr("Vector", "settings_show_NSFW_public_rooms")
}
/// Sign Out
internal static var settingsSignOut: String {
return VectorL10n.tr("Vector", "settings_sign_out")

View file

@ -36,6 +36,7 @@ final class RiotSettings: NSObject {
static let hideVerifyThisSessionAlert = "hideVerifyThisSessionAlert"
static let hideReviewSessionsAlert = "hideReviewSessionsAlert"
static let matrixApps = "matrixApps"
static let showNSFWPublicRooms = "showNSFWPublicRooms"
}
static let shared = RiotSettings()
@ -119,6 +120,15 @@ final class RiotSettings: NSObject {
}
}
/// Indicate to show Not Safe For Work public rooms.
var showNSFWPublicRooms: Bool {
get {
return defaults.bool(forKey: UserDefaultsKeys.showNSFWPublicRooms)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.showNSFWPublicRooms)
}
}
// MARK: User interface
var userInterfaceTheme: String? {

View file

@ -290,6 +290,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
if (!_publicRoomsDirectoryDataSource)
{
_publicRoomsDirectoryDataSource = [[PublicRoomsDirectoryDataSource alloc] initWithMatrixSession:mxSession];
_publicRoomsDirectoryDataSource.showNSFWRooms = RiotSettings.shared.showNSFWPublicRooms;
_publicRoomsDirectoryDataSource.delegate = self;
}

View file

@ -148,6 +148,8 @@
// Reset searches
[recentsDataSource searchWithPatterns:nil];
// TODO: Notify RiotSettings.shared.showNSFWPublicRooms change for iPad as viewWillAppear may not be called
recentsDataSource.publicRoomsDirectoryDataSource.showNSFWRooms = RiotSettings.shared.showNSFWPublicRooms;
[self updateSearch];
}

View file

@ -45,6 +45,11 @@
*/
@property (nonatomic) BOOL includeAllNetworks;
/**
Flag to indicate to show Not Safe For Work rooms in the public room list.
*/
@property (nonatomic) BOOL showNSFWRooms;
/**
List public rooms from a third party protocol.
Default is nil.

View file

@ -26,6 +26,8 @@
// Time in seconds from which public rooms data is considered as obsolete
double const kPublicRoomsDirectoryDataExpiration = 10;
static NSString *const kNSFWKeyword = @"nsfw";
#pragma mark - PublicRoomsDirectoryDataSource
@interface PublicRoomsDirectoryDataSource ()
@ -153,6 +155,16 @@ double const kPublicRoomsDirectoryDataExpiration = 10;
}
}
- (void)setShowNSFWRooms:(BOOL)showNSFWRooms
{
if (showNSFWRooms != _showNSFWRooms)
{
_showNSFWRooms = showNSFWRooms;
[self resetPagination];
}
}
- (NSIndexPath*)cellIndexPathWithRoomId:(NSString*)roomId andMatrixSession:(MXSession*)matrixSession
{
NSIndexPath *indexPath = nil;
@ -234,11 +246,22 @@ double const kPublicRoomsDirectoryDataExpiration = 10;
typeof(self) self = weakSelf;
self->publicRoomsRequest = nil;
NSArray<MXPublicRoom*> *publicRooms;
if (self.showNSFWRooms)
{
publicRooms = publicRoomsResponse.chunk;
}
else
{
publicRooms = [self filterPublicRooms:publicRoomsResponse.chunk containingKeyword:kNSFWKeyword];
}
[self->rooms addObjectsFromArray:publicRoomsResponse.chunk];
[self->rooms addObjectsFromArray:publicRooms];
self->nextBatch = publicRoomsResponse.nextBatch;
if (!self->_searchPattern)
if (!self->_searchPattern || !self.showNSFWRooms)
{
// When there is no search, we can use totalRoomCountEstimate returned by the server
self->_roomsCount = publicRoomsResponse.totalRoomCountEstimate;
@ -254,7 +277,7 @@ double const kPublicRoomsDirectoryDataExpiration = 10;
// Detect pagination end
if (!publicRoomsResponse.nextBatch)
{
_hasReachedPaginationEnd = YES;
self->_hasReachedPaginationEnd = YES;
}
[self setState:MXKDataSourceStateReady];
@ -310,6 +333,22 @@ double const kPublicRoomsDirectoryDataExpiration = 10;
}
}
- (NSArray<MXPublicRoom*>*)filterPublicRooms:(NSArray<MXPublicRoom*>*)publicRooms containingKeyword:(NSString*)keyword
{
NSMutableArray *filteredRooms = [NSMutableArray new];
for (MXPublicRoom *publicRoom in publicRooms)
{
if (NO == [[publicRoom.name lowercaseString] containsString:keyword]
&& NO == [[publicRoom.topic lowercaseString] containsString:keyword])
{
[filteredRooms addObject:publicRoom];
}
}
return filteredRooms;
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

View file

@ -67,6 +67,9 @@
[AppDelegate theDelegate].masterTabBarController.navigationItem.title = NSLocalizedStringFromTable(@"title_rooms", @"Vector", nil);
[AppDelegate theDelegate].masterTabBarController.tabBar.tintColor = ThemeService.shared.theme.tintColor;
// TODO: Notify RiotSettings.shared.showNSFWPublicRooms change for iPad as viewWillAppear may not be called
recentsDataSource.publicRoomsDirectoryDataSource.showNSFWRooms = RiotSettings.shared.showNSFWPublicRooms;
if ([self.dataSource isKindOfClass:RecentsDataSource.class])
{
BOOL isFirstTime = (recentsDataSource != self.dataSource);

View file

@ -132,6 +132,7 @@ enum
OTHER_TERM_CONDITIONS_INDEX,
OTHER_PRIVACY_INDEX,
OTHER_THIRD_PARTY_INDEX,
OTHER_SHOW_NSFW_ROOMS_INDEX,
OTHER_CRASH_REPORT_INDEX,
OTHER_ENABLE_RAGESHAKE_INDEX,
OTHER_MARK_ALL_AS_READ_INDEX,
@ -435,6 +436,8 @@ TableViewSectionsDelegate>
[sectionOther addRowWithTag:OTHER_TERM_CONDITIONS_INDEX];
[sectionOther addRowWithTag:OTHER_PRIVACY_INDEX];
[sectionOther addRowWithTag:OTHER_THIRD_PARTY_INDEX];
[sectionOther addRowWithTag:OTHER_SHOW_NSFW_ROOMS_INDEX];
if (BuildSettings.settingsScreenAllowChangingCrashUsageDataSettings)
{
[sectionOther addRowWithTag:OTHER_CRASH_REPORT_INDEX];
@ -2104,6 +2107,19 @@ TableViewSectionsDelegate>
cell = thirdPartyCell;
}
else if (row == OTHER_SHOW_NSFW_ROOMS_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_show_NSFW_public_rooms", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.showNSFWPublicRooms;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleNSFWPublicRoomsFiltering:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
else if (row == OTHER_CRASH_REPORT_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* sendCrashReportCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
@ -3599,6 +3615,18 @@ TableViewSectionsDelegate>
animated:YES];
}
- (void)toggleNSFWPublicRoomsFiltering:(id)sender
{
if (sender && [sender isKindOfClass:UISwitch.class])
{
UISwitch *switchButton = (UISwitch*)sender;
RiotSettings.shared.showNSFWPublicRooms = switchButton.isOn;
[self.tableView reloadData];
}
}
#pragma mark - TextField listener
- (IBAction)textFieldDidChange:(id)sender