MESSENGER-5610 change profile hint

This commit is contained in:
Arnfried Griesert
2024-02-16 06:46:48 +00:00
parent 0bc6ec93e0
commit 3d75c4ad84
9 changed files with 185 additions and 1 deletions

View File

@@ -719,4 +719,8 @@ class BWIBuildSettings: NSObject {
// MARK: Room Participants
// activates swipe gesture action to remove participants from room (RoomParticipantsViewController)
var bwiCanEditRoomParticipants = false
// MARK: Profile picture hint
// (only when federation is enabled)
var showChangeProfilePictureHint = false
}

View File

@@ -37,6 +37,7 @@ extension BWIBuildSettings {
showMaintenanceInfoMessageType = true
ignoreBlockingMaintenance = true
bwiUseWellKnownPrivacyPolicyLink = true
showChangeProfilePictureHint = true
itunesAppLink = "https://apps.apple.com/de/app/bundesmessenger/id1616866351"
avoidServerSelectionOnAppConfig = true

View File

@@ -220,6 +220,7 @@
"settings_about" = "Erweitert";
"bwi_settings_ignored_users_text" = "Ignorierte Nutzer";
"settings_imprint" = "Impressum";
"settings_change_profile_avatar_hint" = "Auch Nutzer aus föderierten Organisationen können dein Profilbild sehen.";
// MARK: - Room Details

View File

@@ -176,6 +176,7 @@
"settings_deactivate_my_account" = "Deactivate my account";
"settings_enable_inapp_notifications" = "Enable In-App notifications";
"settings_imprint" = "Imprint";
"settings_change_profile_avatar_hint" = "Users from federated organizations can also see your profile picture.";
// MARK: - Room Details

View File

@@ -97,6 +97,7 @@
#import "MXKTableViewCellWithLabelAndButton.h"
#import "MXKTableViewCellWithLabelAndImageView.h"
#import "MXKTableViewCellWithLabelAndMXKImageView.h"
#import "BWITableViewCellWithLabelAndMXKImageView.h" // bwi: 5610
#import "MXKTableViewCellWithLabelAndSlider.h"
#import "MXKTableViewCellWithLabelAndSubLabel.h"
#import "MXKTableViewCellWithLabelAndSwitch.h"

View File

@@ -878,6 +878,7 @@ SSOAuthenticationPresenterDelegate>
[self.tableView registerClass:MXKTableViewCellWithLabelAndTextField.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndTextField defaultReuseIdentifier]];
[self.tableView registerClass:MXKTableViewCellWithLabelAndSwitch.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndSwitch defaultReuseIdentifier]];
[self.tableView registerClass:MXKTableViewCellWithLabelAndMXKImageView.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndMXKImageView defaultReuseIdentifier]];
[self.tableView registerClass:BWITableViewCellWithLabelAndMXKImageView.class forCellReuseIdentifier:[BWITableViewCellWithLabelAndMXKImageView defaultReuseIdentifier]]; // bwi: 5610
[self.tableView registerClass:TableViewCellWithPhoneNumberTextField.class forCellReuseIdentifier:[TableViewCellWithPhoneNumberTextField defaultReuseIdentifier]];
[self.tableView registerNib:MXKTableViewCellWithTextView.nib forCellReuseIdentifier:[MXKTableViewCellWithTextView defaultReuseIdentifier]];
[self.tableView registerNib:SectionFooterView.nib forHeaderFooterViewReuseIdentifier:[SectionFooterView defaultReuseIdentifier]];
@@ -2004,13 +2005,20 @@ SSOAuthenticationPresenterDelegate>
if (row == USER_SETTINGS_PROFILE_PICTURE_INDEX)
{
MXKTableViewCellWithLabelAndMXKImageView *profileCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithLabelAndMXKImageView defaultReuseIdentifier] forIndexPath:indexPath];
BWITableViewCellWithLabelAndMXKImageView *profileCell = [tableView dequeueReusableCellWithIdentifier:[BWITableViewCellWithLabelAndMXKImageView defaultReuseIdentifier] forIndexPath:indexPath];
// bwi: keep reference to cell image view
bwiProfileImage = profileCell.mxkImageView;
profileCell.mxkLabelLeadingConstraint.constant = tableView.vc_separatorInset.left;
profileCell.mxkImageViewTrailingConstraint.constant = 10;
profileCell.bwiHintLeadingConstraint.constant = tableView.vc_separatorInset.left;
if(![BWIBuildSettings.shared showChangeProfilePictureHint] || ![BWIBuildSettings.shared isFederationEnabled]) {
// Change constraints to get the default spacing when no hint is shown
profileCell.bwiHintTopConstraint.constant = 0;
profileCell.bwiHintBottomConstraint.constant = 5.5;
}
profileCell.mxkImageViewWidthConstraint.constant = profileCell.mxkImageViewHeightConstraint.constant = 30;
profileCell.mxkImageViewDisplayBoxType = MXKTableViewCellDisplayBoxTypeCircle;
@@ -2026,6 +2034,13 @@ SSOAuthenticationPresenterDelegate>
profileCell.accessibilityIdentifier=@"SettingsVCProfilPictureStaticText";
profileCell.mxkLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
if([BWIBuildSettings.shared showChangeProfilePictureHint] && [BWIBuildSettings.shared isFederationEnabled]) {
profileCell.bwiHint.text = [BWIL10n settingsChangeProfileAvatarHint];
profileCell.bwiHint.textColor = ThemeService.shared.theme.textSecondaryColor;
} else {
profileCell.bwiHint.text = nil;
}
// if the user defines a new avatar
if (newAvatarImage)
{

View File

@@ -0,0 +1,49 @@
/*
Copyright 2015 OpenMarket 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 "MXKTableViewCell.h"
#import "MXKImageView.h"
/**
'MXKTableViewCellWithLabelAndMXKImageView' inherits 'MXKTableViewCell' class.
It constains a 'UILabel' and a 'MXKImageView' vertically centered.
*/
@interface BWITableViewCellWithLabelAndMXKImageView : MXKTableViewCell
@property (strong, nonatomic) IBOutlet UILabel *mxkLabel;
@property (strong, nonatomic) IBOutlet UILabel *bwiHint;
@property (strong, nonatomic) IBOutlet MXKImageView *mxkImageView;
/**
Leading/Trailing constraints define here spacing to nearest neighbor (no relative to margin)
*/
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkLabelLeadingConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bwiHintLeadingConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bwiHintTopConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bwiHintBottomConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkImageViewLeadingConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkImageViewTrailingConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkImageViewWidthConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkImageViewHeightConstraint;
/**
The MXKImageView display box type ('MXKTableViewCellDisplayBoxTypeDefault' by default)
*/
@property (nonatomic) MXKTableViewCellDisplayBoxType mxkImageViewDisplayBoxType;
@end

View File

@@ -0,0 +1,44 @@
/*
Copyright 2015 OpenMarket 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 "BWITableViewCellWithLabelAndMXKImageView.h"
@implementation BWITableViewCellWithLabelAndMXKImageView
- (void)layoutSubviews
{
[super layoutSubviews];
if (self.mxkImageViewDisplayBoxType == MXKTableViewCellDisplayBoxTypeCircle)
{
// Round image view for thumbnail
_mxkImageView.layer.cornerRadius = _mxkImageView.frame.size.width / 2;
_mxkImageView.clipsToBounds = YES;
}
else if (self.mxkImageViewDisplayBoxType == MXKTableViewCellDisplayBoxTypeRoundedCorner)
{
_mxkImageView.layer.cornerRadius = 5;
_mxkImageView.clipsToBounds = YES;
}
else
{
_mxkImageView.layer.cornerRadius = 0;
_mxkImageView.clipsToBounds = NO;
}
}
@end

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="22131"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="aCf-VI-ocb" customClass="BWITableViewCellWithLabelAndMXKImageView">
<rect key="frame" x="0.0" y="0.0" width="600" height="200"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="aCf-VI-ocb" id="Eg5-vl-rni">
<rect key="frame" x="0.0" y="0.0" width="600" height="200"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7Ts-eR-MZV" userLabel="Mxk ImageView" customClass="MXKImageView">
<rect key="frame" x="554" y="5" width="33" height="33"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="33" id="Ejk-bJ-0MB"/>
<constraint firstAttribute="height" constant="33" id="m9S-XK-OTa"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hint" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dih-rg-s9Q">
<rect key="frame" x="8" y="46" width="538" height="146"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xx4-AP-OQs">
<rect key="frame" x="8" y="11" width="538" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="Dih-rg-s9Q" secondAttribute="bottom" constant="8" id="17x-Ye-TMs"/>
<constraint firstItem="7Ts-eR-MZV" firstAttribute="top" secondItem="Eg5-vl-rni" secondAttribute="top" constant="5" id="2De-3N-1L3"/>
<constraint firstItem="7Ts-eR-MZV" firstAttribute="leading" secondItem="Dih-rg-s9Q" secondAttribute="trailing" constant="8" id="4sY-rp-x6O"/>
<constraint firstItem="Dih-rg-s9Q" firstAttribute="leading" secondItem="Eg5-vl-rni" secondAttribute="leading" constant="8" id="A7d-Yi-tQf"/>
<constraint firstItem="Xx4-AP-OQs" firstAttribute="leading" secondItem="Eg5-vl-rni" secondAttribute="leading" constant="8" id="Wih-ke-1dd"/>
<constraint firstAttribute="trailing" secondItem="7Ts-eR-MZV" secondAttribute="trailing" constant="13" id="atK-Pp-aD8"/>
<constraint firstItem="7Ts-eR-MZV" firstAttribute="leading" secondItem="Xx4-AP-OQs" secondAttribute="trailing" constant="8" id="mm9-sU-77x"/>
<constraint firstItem="Dih-rg-s9Q" firstAttribute="top" secondItem="7Ts-eR-MZV" secondAttribute="bottom" constant="8" id="xez-Hi-WO5"/>
<constraint firstItem="7Ts-eR-MZV" firstAttribute="centerY" secondItem="Xx4-AP-OQs" secondAttribute="centerY" id="z4F-99-L4I"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="bwiHint" destination="Dih-rg-s9Q" id="rHo-Si-xeT"/>
<outlet property="bwiHintBottomConstraint" destination="17x-Ye-TMs" id="VOR-Or-V2k"/>
<outlet property="bwiHintLeadingConstraint" destination="A7d-Yi-tQf" id="4Ta-UK-Lib"/>
<outlet property="bwiHintTopConstraint" destination="xez-Hi-WO5" id="1v7-yG-xLu"/>
<outlet property="mxkImageView" destination="7Ts-eR-MZV" id="ALS-2d-HUG"/>
<outlet property="mxkImageViewHeightConstraint" destination="m9S-XK-OTa" id="hRs-A7-Zrx"/>
<outlet property="mxkImageViewLeadingConstraint" destination="mm9-sU-77x" id="nNv-Ns-zdz"/>
<outlet property="mxkImageViewTrailingConstraint" destination="atK-Pp-aD8" id="kr5-ot-BDV"/>
<outlet property="mxkImageViewWidthConstraint" destination="Ejk-bJ-0MB" id="fgn-XC-e4o"/>
<outlet property="mxkLabel" destination="Xx4-AP-OQs" id="PHz-Lv-lrf"/>
<outlet property="mxkLabelLeadingConstraint" destination="Wih-ke-1dd" id="ONt-IX-CEx"/>
</connections>
<point key="canvasLocation" x="-83.200000000000003" y="-15.292353823088456"/>
</tableViewCell>
</objects>
</document>