@ -191,14 +191,6 @@ const CGFloat kIconViewLength = 24;
self . thread = thread ;
self . thread = thread ;
self . uiDatabaseConnection = uiDatabaseConnection ;
self . uiDatabaseConnection = uiDatabaseConnection ;
if ( [ self . thread isKindOfClass : [ TSContactThread class ] ] ) {
self . title = NSLocalizedString (
@ "CONVERSATION_SETTINGS_CONTACT_INFO_TITLE ", @ "Navbar title when viewing settings for a 1 - on - 1 thread ") ;
} else {
self . title = NSLocalizedString (
@ "CONVERSATION_SETTINGS_GROUP_INFO_TITLE ", @ "Navbar title when viewing settings for a group thread ") ;
}
[ self updateEditButton ] ;
[ self updateEditButton ] ;
}
}
@ -293,7 +285,34 @@ const CGFloat kIconViewLength = 24;
[ self updateTableContents ] ;
[ self updateTableContents ] ;
[ LKAnalytics . shared track : @ "Conversation Settings Opened "] ;
/ / Loki : Set gradient background
self . tableView . backgroundColor = UIColor . clearColor ;
LKGradient * gradient = LKGradients . defaultLokiBackground ;
self . view . backgroundColor = UIColor . clearColor ;
[ self . view setGradient : gradient ] ;
/ / Loki : Set navigation bar background color
UINavigationBar * navigationBar = self . navigationController . navigationBar ;
[ navigationBar setBackgroundImage : [ UIImage new ] forBarMetrics : UIBarMetricsDefault ] ;
navigationBar . shadowImage = [ UIImage new ] ;
[ navigationBar setTranslucent : NO ] ;
navigationBar . barTintColor = LKColors . navigationBarBackground ;
/ / Loki : Customize title
UILabel * titleLabel = [ UILabel new ] ;
if ( [ self . thread isKindOfClass : [ TSContactThread class ] ] ) {
titleLabel . text = NSLocalizedString ( @ "Settings ", @ "") ;
} else {
titleLabel . text = NSLocalizedString ( @ "Group Settings ", @ "") ;
}
titleLabel . textColor = LKColors . text ;
titleLabel . font = [ UIFont boldSystemFontOfSize : LKValues . veryLargeFontSize ] ;
self . navigationItem . titleView = titleLabel ;
/ / Loki : Set up back button
UIBarButtonItem * backButton = [ [ UIBarButtonItem alloc ] initWithTitle : NSLocalizedString ( @ "Back ", "") style : UIBarButtonItemStylePlain target : nil action : nil ] ;
backButton . tintColor = LKColors . text ;
self . navigationItem . backBarButtonItem = backButton ;
}
}
- ( void ) viewDidAppear : ( BOOL ) animated
- ( void ) viewDidAppear : ( BOOL ) animated
@ -324,7 +343,7 @@ const CGFloat kIconViewLength = 24;
OWSTableSection * mainSection = [ OWSTableSection new ] ;
OWSTableSection * mainSection = [ OWSTableSection new ] ;
mainSection . customHeaderView = [ self mainSectionHeader ] ;
mainSection . customHeaderView = [ self mainSectionHeader ] ;
mainSection . customHeaderHeight = @ ( 100 .f ) ;
mainSection . customHeaderHeight = self . isGroupThread ? @ ( 153. f ) : @ ( 214 .f ) ;
/ * *
/ * *
* Loki : Original code
* Loki : Original code
@ -466,6 +485,7 @@ const CGFloat kIconViewLength = 24;
* == == == =
* == == == =
* /
* /
if ( !self . thread . isGroupThread ) {
[ mainSection addItem : [ OWSTableItem
[ mainSection addItem : [ OWSTableItem
itemWithCustomCellBlock : ^{
itemWithCustomCellBlock : ^{
UITableViewCell * cell = [ OWSTableItem newCell ] ;
UITableViewCell * cell = [ OWSTableItem newCell ] ;
@ -483,8 +503,8 @@ const CGFloat kIconViewLength = 24;
UILabel * rowLabel = [ UILabel new ] ;
UILabel * rowLabel = [ UILabel new ] ;
rowLabel . text = NSLocalizedString (
rowLabel . text = NSLocalizedString (
@ "DISAPPEARING_MESSAGES ", @ "table cell label in conversation settings ") ;
@ "DISAPPEARING_MESSAGES ", @ "table cell label in conversation settings ") ;
rowLabel . textColor = [ Theme primaryColor ] ;
rowLabel . textColor = LKColors . text ;
rowLabel . font = [ UIFont ows_dynamicTypeBodyFont ] ;
rowLabel . font = [ UIFont systemFontOfSize: LKValues . mediumFontSize ] ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
UISwitch * switchView = [ UISwitch new ] ;
UISwitch * switchView = [ UISwitch new ] ;
@ -503,8 +523,8 @@ const CGFloat kIconViewLength = 24;
UILabel * subtitleLabel = [ UILabel new ] ;
UILabel * subtitleLabel = [ UILabel new ] ;
subtitleLabel . text = NSLocalizedString (
subtitleLabel . text = NSLocalizedString (
@ "DISAPPEARING_MESSAGES_DESCRIPTION ", @ "subheading in conversation settings ") ;
@ "DISAPPEARING_MESSAGES_DESCRIPTION ", @ "subheading in conversation settings ") ;
subtitleLabel . textColor = [ Theme primaryColor ] ;
subtitleLabel . textColor = LKColors . text ;
subtitleLabel . font = [ UIFont ows_dynamicTypeCaption1Font ] ;
subtitleLabel . font = [ UIFont systemFontOfSize: LKValues . smallFontSize ] ;
subtitleLabel . numberOfLines = 0 ;
subtitleLabel . numberOfLines = 0 ;
subtitleLabel . lineBreakMode = NSLineBreakByWordWrapping ;
subtitleLabel . lineBreakMode = NSLineBreakByWordWrapping ;
[ cell . contentView addSubview : subtitleLabel ] ;
[ cell . contentView addSubview : subtitleLabel ] ;
@ -538,8 +558,8 @@ const CGFloat kIconViewLength = 24;
UILabel * rowLabel = strongSelf . disappearingMessagesDurationLabel ;
UILabel * rowLabel = strongSelf . disappearingMessagesDurationLabel ;
[ strongSelf updateDisappearingMessagesDurationLabel ] ;
[ strongSelf updateDisappearingMessagesDurationLabel ] ;
rowLabel . textColor = [ Theme primaryColor ] ;
rowLabel . textColor = LKColors . text ;
rowLabel . font = [ UIFont ows_dynamicTypeBodyFont ] ;
rowLabel . font = [ UIFont systemFontOfSize: LKValues . mediumFontSize ] ;
/ / don ' t truncate useful duration info which is in the tail
/ / don ' t truncate useful duration info which is in the tail
rowLabel . lineBreakMode = NSLineBreakByTruncatingHead ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingHead ;
@ -553,7 +573,7 @@ const CGFloat kIconViewLength = 24;
UISlider * slider = [ UISlider new ] ;
UISlider * slider = [ UISlider new ] ;
slider . maximumValue = ( float ) ( strongSelf . disappearingMessagesDurations . count - 1 ) ;
slider . maximumValue = ( float ) ( strongSelf . disappearingMessagesDurations . count - 1 ) ;
slider . minimumValue = 0 ;
slider . minimumValue = 0 ;
slider . tintColor = UIColor. lokiGreen ;
slider . tintColor = LKColors. accent ;
slider . continuous = YES ; / / NO fires change event only once you let go
slider . continuous = YES ; / / NO fires change event only once you let go
slider . value = strongSelf . disappearingMessagesConfiguration . durationIndex ;
slider . value = strongSelf . disappearingMessagesConfiguration . durationIndex ;
[ slider addTarget : strongSelf
[ slider addTarget : strongSelf
@ -575,6 +595,7 @@ const CGFloat kIconViewLength = 24;
customRowHeight : UITableViewAutomaticDimension
customRowHeight : UITableViewAutomaticDimension
actionBlock : nil ] ] ;
actionBlock : nil ] ] ;
}
}
}
#ifdef SHOW_COLOR_PICKER
#ifdef SHOW_COLOR_PICKER
[ mainSection
[ mainSection
addItem : [ OWSTableItem
addItem : [ OWSTableItem
@ -675,15 +696,14 @@ const CGFloat kIconViewLength = 24;
OWSCAssertDebug ( strongSelf ) ;
OWSCAssertDebug ( strongSelf ) ;
cell . preservesSuperviewLayoutMargins = YES ;
cell . preservesSuperviewLayoutMargins = YES ;
cell . contentView . preservesSuperviewLayoutMargins = YES ;
cell . contentView . preservesSuperviewLayoutMargins = YES ;
cell . accessoryType = UITableViewCellAccessoryDisclosureIndicator ;
UIImageView * iconView = [ strongSelf viewForIconWithName : @ "table_ic_notification_sound "] ;
UIImageView * iconView = [ strongSelf viewForIconWithName : @ "table_ic_notification_sound "] ;
UILabel * rowLabel = [ UILabel new ] ;
UILabel * rowLabel = [ UILabel new ] ;
rowLabel . text = NSLocalizedString ( @ "SETTINGS_ITEM_NOTIFICATION_SOUND ",
rowLabel . text = NSLocalizedString ( @ "SETTINGS_ITEM_NOTIFICATION_SOUND ",
@ "Label for settings view that allows user to change the notification sound . ") ;
@ "Label for settings view that allows user to change the notification sound . ") ;
rowLabel . textColor = [ Theme primaryColor ] ;
rowLabel . textColor = LKColors . text ;
rowLabel . font = [ UIFont ows_dynamicTypeBodyFont ] ;
rowLabel . font = [ UIFont systemFontOfSize: LKValues . mediumFontSize ] ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
UIStackView * contentRow =
UIStackView * contentRow =
@ -707,8 +727,6 @@ const CGFloat kIconViewLength = 24;
vc . thread = weakSelf . thread ;
vc . thread = weakSelf . thread ;
[ weakSelf . navigationController pushViewController : vc animated : YES ] ;
[ weakSelf . navigationController pushViewController : vc animated : YES ] ;
} ] ] ;
} ] ] ;
if ( !self . thread . isGroupThread ) {
[ mainSection
[ mainSection
addItem :
addItem :
[ OWSTableItem
[ OWSTableItem
@ -720,15 +738,14 @@ const CGFloat kIconViewLength = 24;
OWSCAssertDebug ( strongSelf ) ;
OWSCAssertDebug ( strongSelf ) ;
cell . preservesSuperviewLayoutMargins = YES ;
cell . preservesSuperviewLayoutMargins = YES ;
cell . contentView . preservesSuperviewLayoutMargins = YES ;
cell . contentView . preservesSuperviewLayoutMargins = YES ;
cell . accessoryType = UITableViewCellAccessoryDisclosureIndicator ;
UIImageView * iconView = [ strongSelf viewForIconWithName : @ "table_ic_mute_thread "] ;
UIImageView * iconView = [ strongSelf viewForIconWithName : @ "table_ic_mute_thread "] ;
UILabel * rowLabel = [ UILabel new ] ;
UILabel * rowLabel = [ UILabel new ] ;
rowLabel . text = NSLocalizedString ( @ "CONVERSATION_SETTINGS_MUTE_LABEL ",
rowLabel . text = NSLocalizedString ( @ "CONVERSATION_SETTINGS_MUTE_LABEL ",
@ "label for ' mute thread' cell in conversation settings ") ;
@ "label for ' mute thread' cell in conversation settings ") ;
rowLabel . textColor = [ Theme primaryColor ] ;
rowLabel . textColor = LKColors . text ;
rowLabel . font = [ UIFont ows_dynamicTypeBodyFont ] ;
rowLabel . font = [ UIFont systemFontOfSize: LKValues . mediumFontSize ] ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
NSString * muteStatus = NSLocalizedString ( @ "CONVERSATION_SETTINGS_MUTE_NOT_MUTED ",
NSString * muteStatus = NSLocalizedString ( @ "CONVERSATION_SETTINGS_MUTE_NOT_MUTED ",
@ -778,11 +795,10 @@ const CGFloat kIconViewLength = 24;
actionBlock : ^{
actionBlock : ^{
[ weakSelf showMuteUnmuteActionSheet ] ;
[ weakSelf showMuteUnmuteActionSheet ] ;
} ] ] ;
} ] ] ;
mainSection . footerTitle = NSLocalizedString (
/ / mainSection . footerTitle = NSLocalizedString (
@ "MUTE_BEHAVIOR_EXPLANATION ", @ "An explanation of the consequences of muting a thread . ") ;
/ / @ "MUTE_BEHAVIOR_EXPLANATION ", @ "An explanation of the consequences of muting a thread . ") ;
/ / [ contents addSection : notificationsSection ] ;
/ / [ contents addSection : notificationsSection ] ;
}
}
}
/ / Block Conversation section .
/ / Block Conversation section .
/ * *
/ * *
@ -875,8 +891,8 @@ const CGFloat kIconViewLength = 24;
UILabel * rowLabel = [ UILabel new ] ;
UILabel * rowLabel = [ UILabel new ] ;
rowLabel . text = name ;
rowLabel . text = name ;
rowLabel . textColor = [ Theme primaryColor ] ;
rowLabel . textColor = LKColors . text ;
rowLabel . font = [ UIFont ows_dynamicTypeBodyFont ] ;
rowLabel . font = [ UIFont systemFontOfSize: LKValues . mediumFontSize ] ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
rowLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
UIStackView * contentRow = [ [ UIStackView alloc ] initWithArrangedSubviews : @ [ iconView , rowLabel ] ] ;
UIStackView * contentRow = [ [ UIStackView alloc ] initWithArrangedSubviews : @ [ iconView , rowLabel ] ] ;
@ -893,7 +909,6 @@ const CGFloat kIconViewLength = 24;
accessibilityIdentifier : ( NSString * ) accessibilityIdentifier
accessibilityIdentifier : ( NSString * ) accessibilityIdentifier
{
{
UITableViewCell * cell = [ self cellWithName : name iconName : iconName ] ;
UITableViewCell * cell = [ self cellWithName : name iconName : iconName ] ;
cell . accessoryType = UITableViewCellAccessoryDisclosureIndicator ;
cell . accessibilityIdentifier = accessibilityIdentifier ;
cell . accessibilityIdentifier = accessibilityIdentifier ;
return cell ;
return cell ;
}
}
@ -910,105 +925,53 @@ const CGFloat kIconViewLength = 24;
- ( UIView * ) mainSectionHeader
- ( UIView * ) mainSectionHeader
{
{
UIView * mainSectionHeader = [ UIView new ] ;
LKProfilePictureView * profilePictureView = [ LKProfilePictureView new ] ;
UIView * threadInfoView = [ UIView containerView ] ;
CGFloat size = LKValues . largeProfilePictureSize ;
[ mainSectionHeader addSubview : threadInfoView ] ;
profilePictureView . size = size ;
[ threadInfoView autoPinWidthToSuperviewWithMargin : 16. f ] ;
[ profilePictureView autoSetDimension : ALDimensionWidth toSize : size ] ;
[ threadInfoView autoPinHeightToSuperviewWithMargin : 16. f ] ;
[ profilePictureView autoSetDimension : ALDimensionHeight toSize : size ] ;
UIImage * avatarImage = [ OWSAvatarBuilder buildImageForThread : self . thread diameter : kLargeAvatarSize ] ;
UILabel * titleView = [ UILabel new ] ;
OWSAssertDebug ( avatarImage ) ;
titleView . textColor = LKColors . text ;
titleView . font = [ UIFont boldSystemFontOfSize : LKValues . veryLargeFontSize ] ;
AvatarImageView * avatarView = [ [ AvatarImageView alloc ] initWithImage : avatarImage ] ;
titleView . lineBreakMode = NSLineBreakByTruncatingTail ;
_avatarView = avatarView ;
titleView . text = self . threadName ;
[ threadInfoView addSubview : avatarView ] ;
[ avatarView autoVCenterInSuperview ] ;
UIStackView * stackView = [ [ UIStackView alloc ] initWithArrangedSubviews : @ [ profilePictureView , titleView ] ] ;
[ avatarView autoPinLeadingToSuperviewMargin ] ;
stackView . axis = UILayoutConstraintAxisVertical ;
[ avatarView autoSetDimension : ALDimensionWidth toSize : kLargeAvatarSize ] ;
stackView . spacing = LKValues . mediumSpacing ;
[ avatarView autoSetDimension : ALDimensionHeight toSize : kLargeAvatarSize ] ;
stackView . distribution = UIStackViewDistributionEqualCentering ;
avatarView . contactID = self . thread . contactIdentifier ;
stackView . alignment = UIStackViewAlignmentCenter ;
stackView . layoutMargins = UIEdgeInsetsMake ( LKValues . mediumSpacing , LKValues . veryLargeSpacing , LKValues . mediumSpacing , LKValues . veryLargeSpacing ) ;
UIView * threadNameView = [ UIView containerView ] ;
[ stackView setLayoutMarginsRelativeArrangement : YES ] ;
[ threadInfoView addSubview : threadNameView ] ;
[ threadNameView autoVCenterInSuperview ] ;
[ threadNameView autoPinTrailingToSuperviewMargin ] ;
[ threadNameView autoPinLeadingToTrailingEdgeOfView : avatarView offset : 16. f ] ;
UILabel * threadTitleLabel = [ UILabel new ] ;
threadTitleLabel . text = self . threadName ;
threadTitleLabel . textColor = [ Theme primaryColor ] ;
threadTitleLabel . font = [ UIFont ows_dynamicTypeTitle2Font ] ;
threadTitleLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
[ threadNameView addSubview : threadTitleLabel ] ;
[ threadTitleLabel autoPinEdgeToSuperviewEdge : ALEdgeTop ] ;
[ threadTitleLabel autoPinWidthToSuperview ] ;
__block UIView * lastTitleView = threadTitleLabel ;
if ( ![ self isGroupThread ] ) {
const CGFloat kSubtitlePointSize = 12. f ;
void ( ^addSubtitle ) ( NSString * ) = ^( NSString * subtitle ) {
UILabel * subtitleLabel = [ UILabel new ] ;
subtitleLabel . textColor = [ Theme secondaryColor ] ;
subtitleLabel . font = [ UIFont ows_regularFontWithSize : kSubtitlePointSize ] ;
subtitleLabel . text = subtitle ;
subtitleLabel . lineBreakMode = NSLineBreakByTruncatingTail ;
[ threadNameView addSubview : subtitleLabel ] ;
[ subtitleLabel autoPinEdge : ALEdgeTop toEdge : ALEdgeBottom ofView : lastTitleView ] ;
[ subtitleLabel autoPinLeadingToSuperviewMargin ] ;
[ subtitleLabel autoPinTrailingToSuperviewMargin ] ;
lastTitleView = subtitleLabel ;
} ;
NSString * recipientId = self . thread . contactIdentifier ;
addSubtitle ( recipientId ) ;
/ / Loki : Original code
if ( self . isGroupThread ) {
/ / == == == ==
NSMutableArray < NSString * > * sortedUsers = @ [ ] . mutableCopy ;
/ / BOOL hasName = ![ self . thread . name isEqualToString : recipientId ] ;
NSSet < NSString * > * users = LKAPI . userHexEncodedPublicKeyCache [ self . thread . uniqueId ] ;
/ / if ( hasName ) {
if ( users != nil ) {
/ / NSAttributedString * subtitle = [ [ NSAttributedString alloc ]
for ( NSString * user in users ) {
/ / initWithString : [ PhoneNumber
[ sortedUsers addObject : user ] ;
/ / bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber : recipientId ] ] ;
/ / addSubtitle ( subtitle ) ;
/ / } else {
/ / NSString * _Nullable profileName = [ self . contactsManager formattedProfileNameForRecipientId : recipientId ] ;
/ / if ( profileName ) {
/ / addSubtitle ( [ [ NSAttributedString alloc ] initWithString : profileName ] ) ;
/ / }
/ / }
/ /
/ / BOOL isVerified = [ [ OWSIdentityManager sharedManager ] verificationStateForRecipientId : recipientId ]
/ / == OWSVerificationStateVerified ;
/ / if ( isVerified ) {
/ / NSMutableAttributedString * subtitle = [ NSMutableAttributedString new ] ;
/ / / / "checkmark "
/ / [ subtitle appendAttributedString : [ [ NSAttributedString alloc ]
/ / initWithString : LocalizationNotNeeded ( @ "\ uf00c ")
/ / attributes : @ {
/ / NSFontAttributeName :
/ / [ UIFont ows_fontAwesomeFont : kSubtitlePointSize ] ,
/ / } ] ] ;
/ / [ subtitle appendAttributedString : [ [ NSAttributedString alloc ]
/ / initWithString : NSLocalizedString ( @ "PRIVACY_IDENTITY_IS_VERIFIED_BADGE ",
/ / @ "Badge indicating that the user is verified . ") ] ] ;
/ / addSubtitle ( subtitle ) ;
/ / }
/ / == == == ==
}
}
}
[ lastTitleView autoPinEdgeToSuperviewEdge : ALEdgeBottom ] ;
sortedUsers = [ sortedUsers sortedArrayUsingSelector : @ selector ( compare : ) ] . mutableCopy ;
profilePictureView . hexEncodedPublicKey = ( sortedUsers . count > 0 ) ? sortedUsers [ 0 ] : @ "";
if ( !self . thread . isGroupThread ) {
profilePictureView . isRSSFeed = ( ( TSGroupThread * ) self . thread ) . isRSSFeed ;
[ mainSectionHeader
} else {
addGestureRecognizer : [ [ UITapGestureRecognizer alloc ] initWithTarget : self
profilePictureView . hexEncodedPublicKey = self . thread . contactIdentifier ;
action : @ selector ( conversationNameTouched : ) ] ] ;
mainSectionHeader . userInteractionEnabled = YES ;
UILabel * subtitleView = [ UILabel new ] ;
subtitleView . textColor = LKColors . text ;
subtitleView . font = [ LKFonts spaceMonoOfSize : LKValues . mediumFontSize ] ;
subtitleView . lineBreakMode = NSLineBreakByCharWrapping ;
subtitleView . numberOfLines = 2 ;
subtitleView . text = self . thread . contactIdentifier ;
subtitleView . textAlignment = NSTextAlignmentCenter ;
[ stackView addArrangedSubview : subtitleView ] ;
}
}
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER ( self , mainSectionHeader ) ;
[ profilePictureView update ] ;
return mainSectionHeader ;
return stackView ;
}
}
- ( void ) conversationNameTouched : ( UIGestureRecognizer * ) sender
- ( void ) conversationNameTouched : ( UIGestureRecognizer * ) sender
@ -1036,7 +999,7 @@ const CGFloat kIconViewLength = 24;
OWSAssertDebug ( icon ) ;
OWSAssertDebug ( icon ) ;
UIImageView * iconView = [ UIImageView new ] ;
UIImageView * iconView = [ UIImageView new ] ;
iconView . image = [ icon imageWithRenderingMode : UIImageRenderingModeAlwaysTemplate ] ;
iconView . image = [ icon imageWithRenderingMode : UIImageRenderingModeAlwaysTemplate ] ;
iconView . tintColor = [ Theme secondaryColor ] ;
iconView . tintColor = [ LKColors. text colorWithAlphaComponent : LKValues . unimportantElementOpacity ] ;
iconView . contentMode = UIViewContentModeScaleAspectFit ;
iconView . contentMode = UIViewContentModeScaleAspectFit ;
iconView . layer . minificationFilter = kCAFilterTrilinear ;
iconView . layer . minificationFilter = kCAFilterTrilinear ;
iconView . layer . magnificationFilter = kCAFilterTrilinear ;
iconView . layer . magnificationFilter = kCAFilterTrilinear ;