mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-16 06:28:27 +02:00
Merge branch 'develop' into feature/5383_check_alias_old_rooms
* develop: MESSENGER-5290 refactor to consider if sender or target MESSENGER-5290 remove debug code MESSENGER-5290 mark more federated user status events Fixed bool value MESSENGER-5290 mark federated user status events Show matrix identifier in second line # Conflicts: # RiotNSE/target.yml
This commit is contained in:
@@ -709,4 +709,6 @@ class BWIBuildSettings: NSObject {
|
||||
// MARK: Backup restore
|
||||
var showMatrixIDinRoomInfoScreen = false
|
||||
|
||||
// MARK: Contacts List
|
||||
var showContactIdentifierInDetailRow = true
|
||||
}
|
||||
|
||||
@@ -594,7 +594,11 @@
|
||||
[contactCell render:contact];
|
||||
|
||||
contactCell.selectionStyle = UITableViewCellSelectionStyleDefault;
|
||||
contactCell.showMatrixIdInDisplayName = showMatrixIdInDisplayName;
|
||||
if([BWIBuildSettings.shared showContactIdentifierInDetailRow]) {
|
||||
contactCell.showMatrixIdInDisplayName = false;
|
||||
} else {
|
||||
contactCell.showMatrixIdInDisplayName = showMatrixIdInDisplayName;
|
||||
}
|
||||
|
||||
// The search displays contacts to invite.
|
||||
if (indexPath.section == filteredLocalContactsSection || indexPath.section == filteredMatrixContactsSection)
|
||||
|
||||
@@ -199,6 +199,7 @@
|
||||
|
||||
[self refreshContactPresence];
|
||||
[self refreshContactBadgeImage];
|
||||
[self refreshLocalContactInformation];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -323,22 +324,31 @@
|
||||
{
|
||||
// Display the first contact method in sub label.
|
||||
NSString *subLabelText = nil;
|
||||
if (contact.emailAddresses.count)
|
||||
{
|
||||
MXKEmail* email = contact.emailAddresses.firstObject;
|
||||
subLabelText = email.emailAddress;
|
||||
}
|
||||
else if (contact.phoneNumbers.count)
|
||||
{
|
||||
MXKPhoneNumber *phoneNumber = contact.phoneNumbers.firstObject;
|
||||
|
||||
if (phoneNumber.nbPhoneNumber)
|
||||
if(![BWIBuildSettings.shared showContactIdentifierInDetailRow]) {
|
||||
if (contact.emailAddresses.count)
|
||||
{
|
||||
subLabelText = [[NBPhoneNumberUtil sharedInstance] format:phoneNumber.nbPhoneNumber numberFormat:NBEPhoneNumberFormatINTERNATIONAL error:nil];
|
||||
MXKEmail* email = contact.emailAddresses.firstObject;
|
||||
subLabelText = email.emailAddress;
|
||||
}
|
||||
else
|
||||
else if (contact.phoneNumbers.count)
|
||||
{
|
||||
subLabelText = phoneNumber.textNumber;
|
||||
MXKPhoneNumber *phoneNumber = contact.phoneNumbers.firstObject;
|
||||
|
||||
if (phoneNumber.nbPhoneNumber)
|
||||
{
|
||||
subLabelText = [[NBPhoneNumberUtil sharedInstance] format:phoneNumber.nbPhoneNumber numberFormat:NBEPhoneNumberFormatINTERNATIONAL error:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
subLabelText = phoneNumber.textNumber;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSArray *identifiers = contact.matrixIdentifiers;
|
||||
if (identifiers.count)
|
||||
{
|
||||
NSString *userId = identifiers.firstObject;
|
||||
subLabelText = userId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -15,7 +13,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="74"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="L2L-l5-wPx" id="aXz-IR-jj5">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="73.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="74"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RX5-eD-c3c" userLabel="member avatar" customClass="MXKImageView">
|
||||
@@ -31,6 +29,7 @@
|
||||
<rect key="frame" x="41" y="43" width="16" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="16" id="Rcc-M1-2hb"/>
|
||||
<constraint firstAttribute="width" secondItem="Wg7-no-cax" secondAttribute="height" multiplier="1:1" id="sZo-F2-fpL"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Display name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lg1-xQ-AGn" userLabel="member display name">
|
||||
@@ -48,9 +47,9 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="info label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dQt-mN-T6b">
|
||||
<rect key="frame" x="69" y="39" width="531" height="19.5"/>
|
||||
<rect key="frame" x="69" y="39" width="531" height="20"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="ContactInformationLabel"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
@@ -74,7 +73,6 @@
|
||||
<constraint firstItem="RX5-eD-c3c" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="15" id="mga-fG-I0L"/>
|
||||
<constraint firstItem="Ogo-Qt-u2C" firstAttribute="leading" secondItem="1nR-ck-5Xd" secondAttribute="trailing" id="nbn-Je-HEE"/>
|
||||
<constraint firstItem="Wg7-no-cax" firstAttribute="bottom" secondItem="RX5-eD-c3c" secondAttribute="bottom" constant="2" id="pck-mZ-FjJ"/>
|
||||
<constraint firstItem="Wg7-no-cax" firstAttribute="width" secondItem="Wg7-no-cax" secondAttribute="height" multiplier="1:1" id="sZo-F2-fpL"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dQt-mN-T6b" secondAttribute="trailing" id="t2m-pb-5zd"/>
|
||||
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="14" id="tY3-6V-A3B"/>
|
||||
<constraint firstItem="1nR-ck-5Xd" firstAttribute="leading" secondItem="Lg1-xQ-AGn" secondAttribute="trailing" constant="5" id="tat-Fj-BSw"/>
|
||||
|
||||
@@ -657,7 +657,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
// The targeted member display name (if any) is available in content
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomInviteByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomInviteByYou:[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
else if ([targetDisplayName isEqualToString:mxSession.myUserId])
|
||||
{
|
||||
@@ -670,7 +671,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
targetDisplayName = contentDisplayname;
|
||||
}
|
||||
|
||||
displayText = [VectorL10n noticeRoomInvite:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomInvite:senderDisplayName :[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -694,8 +696,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
targetDisplayName = contentDisplayname;
|
||||
}
|
||||
|
||||
displayText = [VectorL10n noticeRoomJoin:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomJoin:[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -729,7 +731,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomReject:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomReject:[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -740,7 +743,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [BWIL10n noticeRoomLeave:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [BWIL10n noticeRoomLeave:[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -751,11 +755,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomWithdrawByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomWithdrawByYou:[self formattedMemberDisplayname:event isSender:YES]];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomWithdraw:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomWithdraw:senderDisplayName :[self formattedMemberDisplayname:event isSender:YES]];
|
||||
}
|
||||
if (event.content[@"reason"])
|
||||
{
|
||||
@@ -767,11 +773,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomKickByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomKickByYou:[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomKick:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomKick:senderDisplayName :[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
|
||||
// add reason if exists
|
||||
@@ -784,11 +792,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomUnbanByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomUnbanByYou:[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomUnban:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomUnban:senderDisplayName :[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -803,11 +813,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomBanByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomBanByYou:[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomBan:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomBan:senderDisplayName :[self formattedMemberDisplayname:event isSender:NO]];
|
||||
}
|
||||
if (event.content[@"reason"])
|
||||
{
|
||||
@@ -2494,4 +2506,54 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
return timeString.lowercaseString;
|
||||
}
|
||||
|
||||
#pragma mark - federation
|
||||
|
||||
// bwi #5290 federated user get additional status text
|
||||
- (NSString *)formattedMemberDisplayname:(MXEvent*)event isSender:(BOOL)isSender {
|
||||
NSString *targetDisplayName = event.stateKey;
|
||||
|
||||
NSString *contentDisplayname;
|
||||
MXJSONModelSetString(contentDisplayname, event.content[@"displayname"]);
|
||||
NSString *prevContentDisplayname;
|
||||
MXJSONModelSetString(prevContentDisplayname, event.prevContent[@"displayname"]);
|
||||
|
||||
NSString *userId = isSender ? event.sender : event.stateKey;
|
||||
MXRoom *room = [mxSession roomWithRoomId:event.roomId];
|
||||
|
||||
NSString *displayName;
|
||||
if (contentDisplayname.length) {
|
||||
displayName = [self formattedMemberEvent:contentDisplayname room:room userId:userId];
|
||||
} else if (prevContentDisplayname.length) {
|
||||
displayName = [self formattedMemberEvent:prevContentDisplayname room:room userId:userId];
|
||||
}
|
||||
else {
|
||||
displayName = [self formattedMemberEvent:targetDisplayName room:room userId:userId];
|
||||
}
|
||||
|
||||
return displayName;
|
||||
}
|
||||
|
||||
// bwi #5290 federated user get additional status text
|
||||
- (NSString *)formattedMemberEvent:(NSString *)displayName room:(MXRoom *)room userId:(NSString *)userId {
|
||||
|
||||
if ( BWIBuildSettings.shared.isFederationEnabled && [room isRoomMemberFederated:userId]) {
|
||||
NSArray *memberUserIdComponents = [userId componentsSeparatedByString:@":"];
|
||||
|
||||
if (memberUserIdComponents.count == 2) {
|
||||
NSString *component = [memberUserIdComponents lastObject];
|
||||
|
||||
// remove subdomains
|
||||
NSArray *domainComponents = [userId componentsSeparatedByString:@"."];
|
||||
|
||||
if (domainComponents.count >= 2) {
|
||||
return [NSString stringWithFormat:@"%@ (%@.%@)", displayName, domainComponents[domainComponents.count-2], domainComponents[domainComponents.count-1]];
|
||||
} else {
|
||||
return [NSString stringWithFormat:@"%@ (%@)", displayName, component];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -59,6 +59,7 @@ targets:
|
||||
- path: ../bwi/MatomoAnalytics/E2EEError.swift
|
||||
- path: ../bwi/URLScheme/CustomURLSchemeHelper.swift
|
||||
- path: ../bwi/Extentions/MXTools+Alias.swift
|
||||
- path: ../bwi/Federation/MXRoom+Federation.swift
|
||||
- path: ../Riot/Managers/Settings/RiotSettings.swift
|
||||
- path: ../Config/BuildSettings.swift
|
||||
- path: ../Config/BWIBuildSettings.swift
|
||||
|
||||
Reference in New Issue
Block a user