Skip to content

Commit

Permalink
Merge branch 'release/tchap_v1.99.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Loriaux committed May 30, 2022
2 parents c5de3a9 + 90d81fb commit 047c92b
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 68 deletions.
4 changes: 2 additions & 2 deletions Btchap/Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ final class BuildSettings: NSObject {

// MARK: - Main Tabs

static let homeScreenShowFavouritesTab: Bool = false
static let homeScreenShowPeopleTab: Bool = false
static let homeScreenShowFavouritesTab: Bool = true
static let homeScreenShowPeopleTab: Bool = true
static let homeScreenShowRoomsTab: Bool = true
static let homeScreenShowCommunitiesTab: Bool = false

Expand Down
3 changes: 2 additions & 1 deletion Btchap/target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ targets:

settings:
base:
GCC_PREPROCESSOR_DEFINITIONS: $(inherited) ENABLE_JOIN_BY_LINK=1
GCC_PREPROCESSOR_DEFINITIONS: $(inherited) ENABLE_REACTIONS=1 ENABLE_EDITION=1 ENABLE_JOIN_BY_LINK=1
OTHER_SWIFT_FLAGS: $(inherited) -D ENABLE_REACTIONS -D ENABLE_EDITION

sources:
- path: ../Btchap/Config
Expand Down
2 changes: 1 addition & 1 deletion Config/AppVersion.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
//

// Version
MARKETING_VERSION = 1.99.2
MARKETING_VERSION = 1.99.3
CURRENT_PROJECT_VERSION = 1
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
},
{
"unassigned" : true,
"filename" : "launch_screen_logo.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"unassigned" : true,
"filename" : "launch_screen_logo@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"unassigned" : true,
"filename" : "launch_screen_logo@3x.png",
"idiom" : "universal",
"scale" : "3x"
Expand Down
58 changes: 58 additions & 0 deletions Riot/Categories/MXSession+Room.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// Copyright 2022 New Vector Ltd
//
// 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 MatrixSDK

extension MXSession {
/// Returns the valid (not leaved) direct discussion with the user in parameter.
/// If not, returns nil in completion.
@objc func validRoomDirectDiscussion(for userID: String,
completion: @escaping (_ room: MXRoom?) -> Void) {
self.hasValidDirectDiscussion(for: userID) { roomID in
guard let roomID = roomID,
let room = self.room(withRoomId: roomID) else {
completion(nil)
return
}
completion(room)
}
}

/// Check if there is a valid (not leaved) direct discussion with the user in parameter, and then returns the roomID.
/// If not, returns nil in completion.
func hasValidDirectDiscussion(for userID: String,
completion: @escaping (String?) -> Void) {
let discussionFinder: DiscussionFinderType = DiscussionFinder(session: self)
discussionFinder.getDiscussionIdentifier(for: userID,
includeInvite: true,
autoJoin: true,
includeLeft: false) { response in
switch response {
case .success(let result):
switch result {
case .pendingInvite(let roomID):
completion(roomID)
case .joinedDiscussion(let roomID):
completion(roomID)
case .noDiscussion:
completion(nil)
}
case .failure(_):
completion(nil)
}
}
}
}
31 changes: 14 additions & 17 deletions Riot/Modules/Application/LegacyAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -3315,24 +3315,21 @@ - (void)startDirectChatWithUserId:(NSString*)userId completion:(void (^)(void))c

if (mxSession)
{
MXRoom *directRoom = [mxSession directJoinedRoomWithUserId:userId];

// if the room exists
if (directRoom)
{
// open it
Analytics.shared.viewRoomTrigger = AnalyticsViewRoomTriggerCreated;
[self showRoom:directRoom.roomId andEventId:nil withMatrixSession:mxSession];

if (completion)
{
completion();
[mxSession validRoomDirectDiscussionFor:userId
completion:^(MXRoom * _Nullable room) {
if (room) {
// open it
Analytics.shared.viewRoomTrigger = AnalyticsViewRoomTriggerCreated;
[self showRoom:room.roomId andEventId:nil withMatrixSession:mxSession];

if (completion)
{
completion();
}
} else {
[self createDirectChatWithUserId:userId completion:completion];
}
}
else
{
[self createDirectChatWithUserId:userId completion:completion];
}
}];
}
else if (completion)
{
Expand Down
16 changes: 12 additions & 4 deletions Riot/Modules/Room/MXKRoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,9 @@ - (void)joinRoom:(void(^)(MXKRoomViewControllerJoinRoomResult result))completion
joinRoomRequest = [roomDataSource.room join:^{

self->joinRoomRequest = nil;
cancelIndicator();
if (cancelIndicator) {
cancelIndicator();
}

[self triggerInitialBackPagination];

Expand All @@ -873,7 +875,9 @@ - (void)joinRoom:(void(^)(MXKRoomViewControllerJoinRoomResult result))completion
}

} failure:^(NSError *error) {
cancelIndicator();
if (cancelIndicator) {
cancelIndicator();
}
MXLogDebug(@"[MXKRoomVC] Failed to join room (%@)", self->roomDataSource.room.summary.displayname);
[self processRoomJoinFailureWithError:error completion:completion];
}];
Expand All @@ -898,7 +902,9 @@ - (void)joinRoomWithRoomIdOrAlias:(NSString*)roomIdOrAlias
void (^success)(MXRoom *room) = ^(MXRoom *room) {

self->joinRoomRequest = nil;
cancelIndicator();
if (cancelIndicator) {
cancelIndicator();
}

MXWeakify(self);

Expand All @@ -920,7 +926,9 @@ - (void)joinRoomWithRoomIdOrAlias:(NSString*)roomIdOrAlias
};

void (^failure)(NSError *error) = ^(NSError *error) {
cancelIndicator();
if (cancelIndicator) {
cancelIndicator();
}
MXLogDebug(@"[MXKRoomVC] Failed to join room (%@)", roomIdOrAlias);
[self processRoomJoinFailureWithError:error completion:completion];
};
Expand Down
25 changes: 16 additions & 9 deletions Riot/Modules/Room/Members/Detail/RoomMemberDetailsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ - (void)presentCompleteSecurity

- (void)showRoomWithId:(NSString*)roomId
{
// Analytics.shared.viewRoomTrigger = AnalyticsViewRoomTriggerRoomMemberDetail;
// [[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:self.mainSession];
Analytics.shared.viewRoomTrigger = AnalyticsViewRoomTriggerRoomMemberDetail;
[[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:self.mainSession];
}

#pragma mark - Hide/Show navigation bar border
Expand Down Expand Up @@ -652,13 +652,16 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

if (self.mxRoom.summary.isEncrypted)
{
securityActionsArray = @[@(MXKRoomMemberDetailsActionSecurity),
// Tchap: Hide security content cells.
securityActionsArray = @[/*@(MXKRoomMemberDetailsActionSecurity),*/
@(MXKRoomMemberDetailsActionSecurityInformation)];

}
else
{
securityActionsArray = @[@(MXKRoomMemberDetailsActionSecurity)];
// Tchap: Hide security content cells.
securityActionsArray = @[];
// securityActionsArray = @[@(MXKRoomMemberDetailsActionSecurity)];
}

securityIndex = adminToolsIndex = otherActionsIndex = directChatsIndex = devicesIndex = -1;
Expand Down Expand Up @@ -707,7 +710,9 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
}
else if (section == directChatsIndex)
{
return (directChatsArray.count + 1);
// Tchap: Show only 1 value in direct chats (the direct chat or the add cell).
return 1;
// return (directChatsArray.count + 1);
}
else if (section == devicesIndex)
{
Expand Down Expand Up @@ -820,7 +825,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
{
NSNumber *actionNumber = securityActionsArray[indexPath.row];

if (actionNumber.unsignedIntegerValue == MXKRoomMemberDetailsActionSecurity)
// Tchap: Hide security content cells.
/* if (actionNumber.unsignedIntegerValue == MXKRoomMemberDetailsActionSecurity)
{
MXKTableViewCell *securityStatusCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCell defaultReuseIdentifier] forIndexPath:indexPath];
Expand Down Expand Up @@ -865,7 +871,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell = securityStatusCell;
}
else if (actionNumber.unsignedIntegerValue == MXKRoomMemberDetailsActionSecurityInformation)
else */if (actionNumber.unsignedIntegerValue == MXKRoomMemberDetailsActionSecurityInformation)
{
MXKTableViewCell *encryptionInfoCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCell defaultReuseIdentifier] forIndexPath:indexPath];

Expand Down Expand Up @@ -1040,7 +1046,8 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{
if (indexPath.section == securityIndex)
// Tchap: Disable security cells interactions.
/* if (indexPath.section == securityIndex)
{
if (self.encryptionTrustLevel == UserEncryptionTrustLevelNotVerified)
{
Expand All @@ -1058,7 +1065,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIn
[self presentUserVerification];
}
}
else if (indexPath.section == directChatsIndex)
else */if (indexPath.section == directChatsIndex)
{
if (indexPath.row < directChatsArray.count)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -33,7 +33,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YXr-As-Mqh">
<rect key="frame" x="0.0" y="0.0" width="375" height="343"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="286"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ouj-VM-zdT">
<rect key="frame" x="0.0" y="0.0" width="375" height="117"/>
Expand Down Expand Up @@ -75,7 +75,7 @@
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="hSH-1t-jnC">
<rect key="frame" x="0.0" y="112" width="375" height="221"/>
<rect key="frame" x="0.0" y="112" width="375" height="164"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QHN-zr-wtC">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
Expand All @@ -97,11 +97,11 @@
<constraint firstAttribute="height" priority="250" id="spl-iu-Mj1"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dtL-Kk-RjD">
<rect key="frame" x="0.0" y="57" width="375" height="50"/>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dtL-Kk-RjD">
<rect key="frame" x="0.0" y="53.5" width="375" height="0.0"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Matrix ID" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9qc-7W-xzu" customClass="CopyableLabel" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="20" y="0.0" width="335" height="50"/>
<rect key="frame" x="20" y="0.0" width="335" height="0.0"/>
<accessibility key="accessibilityConfiguration" identifier="RoomMemberDetailsVCStatusLabel"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand All @@ -118,7 +118,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gbf-sy-gsc">
<rect key="frame" x="0.0" y="114" width="375" height="50"/>
<rect key="frame" x="0.0" y="57" width="375" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Status" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aBz-2v-ij6">
<rect key="frame" x="20" y="0.0" width="335" height="50"/>
Expand All @@ -138,7 +138,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Flu-1i-oqi">
<rect key="frame" x="0.0" y="171" width="375" height="50"/>
<rect key="frame" x="0.0" y="114" width="375" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Power level" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lbh-ZN-XUO">
<rect key="frame" x="20" y="0.0" width="335" height="50"/>
Expand Down Expand Up @@ -188,7 +188,7 @@
</constraints>
</imageView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" style="grouped" separatorStyle="default" rowHeight="46" sectionHeaderHeight="28" sectionFooterHeight="8" translatesAutoresizingMaskIntoConstraints="NO" id="R6u-PR-DcU">
<rect key="frame" x="0.0" y="343" width="375" height="324"/>
<rect key="frame" x="0.0" y="286" width="375" height="381"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityIdentifier" value="RoomMemberDetailsVCTableView"/>
Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ extension RoomInfoCoordinator: RoomParticipantsViewControllerDelegate {
}

func roomParticipantsViewController(_ roomParticipantsViewController: RoomParticipantsViewController!, startChatWithMemberId matrixId: String, completion: (() -> Void)?) {

AppDelegate.theDelegate().createDirectChat(withUserId: matrixId, completion: completion)
}

}
Expand Down
3 changes: 2 additions & 1 deletion Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -6456,8 +6456,9 @@ - (void)removeMXSessionStateChangeNotificationsListener
[items addObject:[self replyMenuItemWithEvent:event]];
if (showThreadOption)
{
// Tchap: Disable Threads
// add "Thread" option only if not already in a thread
[items addObject:[self replyInThreadMenuItemWithEvent:event]];
// [items addObject:[self replyInThreadMenuItemWithEvent:event]];
}
#if ENABLE_EDITION
[items addObject:[self editMenuItemWithEvent:event]];
Expand Down
15 changes: 15 additions & 0 deletions TCHAP_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## Changes in 1.99.3 (2022-05-30)

🙌 Improvements

- Enable message edition and reaction by default in Tchap ([#532](https://github.com/tchapgouv/tchap-ios/issues/532))
- [DM] Unable to start a new DM with a contact who left the previous DM ([#535](https://github.com/tchapgouv/tchap-ios/issues/535))
- Improve the room member details ([#543](https://github.com/tchapgouv/tchap-ios/issues/543))

🐛 Bugfixes

- Room avatars are missing ([#526](https://github.com/tchapgouv/tchap-ios/issues/526))
- Crash when the user joins a forum ([#531](https://github.com/tchapgouv/tchap-ios/issues/531))
- Hide the Thread option in the selected message options ([#540](https://github.com/tchapgouv/tchap-ios/issues/540))


## Changes in 1.99.2 (2022-05-17)

🐛 Bugfixes
Expand Down
Loading

0 comments on commit 047c92b

Please sign in to comment.