Clean up share screen

pull/79/head
Niels Andriesse 5 years ago
parent 81bd2f3cd7
commit 3eaf287660

@ -579,10 +579,12 @@
B85357C523A1F13800AAF6CD /* LinkDeviceVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85357C423A1F13800AAF6CD /* LinkDeviceVC.swift */; };
B85357C723A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85357C623A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift */; };
B8544E3123D16CA500299F14 /* DeviceUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8544E3023D16CA500299F14 /* DeviceUtilities.swift */; };
B8544E3323D50E4900299F14 /* AppearanceUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8544E3223D50E4900299F14 /* AppearanceUtilities.swift */; };
B8544E3423D51EEF00299F14 /* ProfilePictureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82AC238F734800BA5194 /* ProfilePictureView.swift */; };
B8544E3523D5201400299F14 /* UIView+Constraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */; };
B86BD08423399ACF000F5AE3 /* Modal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86BD08323399ACF000F5AE3 /* Modal.swift */; };
B86BD08623399CEF000F5AE3 /* SeedModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86BD08523399CEF000F5AE3 /* SeedModal.swift */; };
B885D5F4233491AB00EE0D8E /* DeviceLinkingModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B885D5F3233491AB00EE0D8E /* DeviceLinkingModal.swift */; };
B885D5F62334A32100EE0D8E /* UIView+Constraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */; };
B886B4A72398B23E00211ABE /* QRCodeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B886B4A62398B23E00211ABE /* QRCodeVC.swift */; };
B886B4A92398BA1500211ABE /* QRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = B886B4A82398BA1500211ABE /* QRCode.swift */; };
B891105C2320872800F15FCC /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B891105B2320872800F15FCC /* GoogleService-Info.plist */; };
@ -599,7 +601,6 @@
B8BB82A5238F627000BA5194 /* HomeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82A4238F627000BA5194 /* HomeVC.swift */; };
B8BB82A9238F62FB00BA5194 /* Gradients.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82A8238F62FB00BA5194 /* Gradients.swift */; };
B8BB82AB238F669C00BA5194 /* ConversationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82AA238F669C00BA5194 /* ConversationCell.swift */; };
B8BB82AD238F734800BA5194 /* ProfilePictureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82AC238F734800BA5194 /* ProfilePictureView.swift */; };
B8BB82B12390C37000BA5194 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82B02390C37000BA5194 /* SearchBar.swift */; };
B8BB82B523947F2D00BA5194 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82B423947F2D00BA5194 /* TextField.swift */; };
B8BB82B92394911B00BA5194 /* Separator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82B82394911B00BA5194 /* Separator.swift */; };
@ -1419,6 +1420,7 @@
B85357C423A1F13800AAF6CD /* LinkDeviceVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkDeviceVC.swift; sourceTree = "<group>"; };
B85357C623A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkDeviceVCDelegate.swift; sourceTree = "<group>"; };
B8544E3023D16CA500299F14 /* DeviceUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceUtilities.swift; sourceTree = "<group>"; };
B8544E3223D50E4900299F14 /* AppearanceUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceUtilities.swift; sourceTree = "<group>"; };
B86BD08323399ACF000F5AE3 /* Modal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Modal.swift; sourceTree = "<group>"; };
B86BD08523399CEF000F5AE3 /* SeedModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeedModal.swift; sourceTree = "<group>"; };
B885D5F3233491AB00EE0D8E /* DeviceLinkingModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceLinkingModal.swift; sourceTree = "<group>"; };
@ -2715,6 +2717,16 @@
sourceTree = "<group>";
};
B846365922B7417900AF1514 /* Loki */ = {
isa = PBXGroup;
children = (
B8544E3623D520F600299F14 /* Jazz Icon */,
B8BB82AC238F734800BA5194 /* ProfilePictureView.swift */,
B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */,
);
path = Loki;
sourceTree = "<group>";
};
B8544E3623D520F600299F14 /* Jazz Icon */ = {
isa = PBXGroup;
children = (
241C630E231F5AAC00B4198E /* JazzIcon.swift */,
@ -2722,7 +2734,7 @@
241C6312231F5F1D00B4198E /* CGFloat+Rounding.swift */,
241C6310231F5C4400B4198E /* UIColor+Helper.swift */,
);
path = Loki;
path = "Jazz Icon";
sourceTree = "<group>";
};
B8BB82A3238F356800BA5194 /* Style Guide */ = {
@ -2764,7 +2776,6 @@
B8162F0422892C5F00D46544 /* FriendRequestViewDelegate.swift */,
B8B26C8E234D629C004ED98C /* MentionCandidateSelectionView.swift */,
B8B26C90234D8CBD004ED98C /* MentionCandidateSelectionViewDelegate.swift */,
B8BB82AC238F734800BA5194 /* ProfilePictureView.swift */,
B8BB82B02390C37000BA5194 /* SearchBar.swift */,
B85357BE23A1AE0800AAF6CD /* SeedReminderView.swift */,
B85357C023A1B81900AAF6CD /* SeedReminderViewDelegate.swift */,
@ -2778,9 +2789,9 @@
B8CCF63C239757DB0091D419 /* Utilities */ = {
isa = PBXGroup;
children = (
B8544E3223D50E4900299F14 /* AppearanceUtilities.swift */,
B8544E3023D16CA500299F14 /* DeviceUtilities.swift */,
B84664F4235022F30083A1CD /* MentionUtilities.swift */,
B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */,
B886B4A82398BA1500211ABE /* QRCode.swift */,
);
path = Utilities;
@ -3720,6 +3731,7 @@
34BBC85B220C7ADA00857249 /* OrderedDictionary.swift in Sources */,
346129961FD1E30000532771 /* OWSDatabaseMigration.m in Sources */,
346129FB1FD5F31400532771 /* OWS101ExistingUsersBlockOnIdentityChange.m in Sources */,
B8544E3523D5201400299F14 /* UIView+Constraints.swift in Sources */,
34AC09EA211B39B100997B47 /* ModalActivityIndicatorViewController.swift in Sources */,
344F248D2007CCD600CFB4F4 /* DisplayableText.swift in Sources */,
450998651FD8A34D00D89EB3 /* DeviceSleepManager.swift in Sources */,
@ -3808,6 +3820,7 @@
4551DB5A205C562300C8AE75 /* Collection+OWS.swift in Sources */,
34BBC84F220B8A0100857249 /* ImageEditorCropViewController.swift in Sources */,
34AC09ED211B39B100997B47 /* ContactFieldView.swift in Sources */,
B8544E3423D51EEF00299F14 /* ProfilePictureView.swift in Sources */,
346129AF1FD1F5D900532771 /* SystemContactsFetcher.swift in Sources */,
34AC09E3211B39B100997B47 /* OWSViewController.m in Sources */,
346129C81FD2072E00532771 /* NSAttributedString+OWS.m in Sources */,
@ -3957,7 +3970,6 @@
4CC1ECFB211A553000CC13BE /* AppUpdateNag.swift in Sources */,
3448E16022134C89004B052E /* OnboardingSplashViewController.swift in Sources */,
34B6A903218B3F63007C4606 /* TypingIndicatorView.swift in Sources */,
B8BB82AD238F734800BA5194 /* ProfilePictureView.swift in Sources */,
B8CCF639239721E20091D419 /* TabBar.swift in Sources */,
B8162F0322891AD600D46544 /* FriendRequestView.swift in Sources */,
458E38371D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m in Sources */,
@ -3965,6 +3977,7 @@
B886B4A72398B23E00211ABE /* QRCodeVC.swift in Sources */,
4517642B1DE939FD00EDB8B9 /* ContactCell.swift in Sources */,
34EA69402194933900702471 /* MediaDownloadView.swift in Sources */,
B8544E3323D50E4900299F14 /* AppearanceUtilities.swift in Sources */,
340FC8AB204DAC8D007AEB0F /* DomainFrontingCountryViewController.m in Sources */,
4C586926224FAB83003FD070 /* AVAudioSession+OWS.m in Sources */,
3496744D2076768700080B5F /* OWSMessageBubbleView.m in Sources */,
@ -3977,7 +3990,6 @@
B8CCF63F23975CFB0091D419 /* JoinPublicChatVC.swift in Sources */,
34ABC0E421DD20C500ED9469 /* ConversationMessageMapping.swift in Sources */,
34D8C0271ED3673300188D7C /* DebugUIMessages.m in Sources */,
B885D5F62334A32100EE0D8E /* UIView+Constraints.swift in Sources */,
34DBF003206BD5A500025978 /* OWSMessageTextView.m in Sources */,
34D1F0B41F86D31D0066283D /* ConversationCollectionView.m in Sources */,
34B3F8821E8DF1700035BE1A /* NewContactThreadViewController.m in Sources */,

@ -272,7 +272,7 @@ static NSTimeInterval launchStartedAt;
[self versionMigrationsDidComplete];
}];
[UIUtil setupSignalAppearence];
[LKAppearanceUtilities switchToSessionAppearance];
if (CurrentAppContext().isRunningTests) {
return YES;

@ -0,0 +1,26 @@
@objc(LKAppearanceUtilities)
final class AppearanceUtilities : NSObject {
@objc static func switchToSessionAppearance() {
if #available(iOS 13, *) {
UINavigationBar.appearance().barTintColor = Colors.navigationBarBackground
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().tintColor = Colors.text
UIToolbar.appearance().barTintColor = Colors.navigationBarBackground
UIToolbar.appearance().isTranslucent = false
UIToolbar.appearance().tintColor = Colors.text
UISwitch.appearance().onTintColor = Colors.accent
UINavigationBar.appearance().titleTextAttributes = [ NSAttributedString.Key.foregroundColor : Colors.text ]
}
}
@objc static func switchToImagePickerAppearance() {
if #available(iOS 13, *) {
UINavigationBar.appearance().barTintColor = .white
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().tintColor = .black
UINavigationBar.appearance().titleTextAttributes = [ NSAttributedString.Key.foregroundColor : UIColor.black ]
}
}
}

@ -192,7 +192,7 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
OWSTableSection *screenSecuritySection = [OWSTableSection new];
screenSecuritySection.headerTitle = NSLocalizedString(@"SETTINGS_SECURITY_TITLE", @"Section header");
screenSecuritySection.footerTitle = NSLocalizedString(@"Prevent Loki Messenger previews from appearing in the app switcher.", nil);
screenSecuritySection.footerTitle = NSLocalizedString(@"Prevent Session previews from appearing in the app switcher.", nil);
[screenSecuritySection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"")
accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"screen_security"]

@ -70,6 +70,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertIsOnMainThread();
OWSAssertDebug(self.delegate);
[LKAppearanceUtilities switchToImagePickerAppearance];
[self.delegate.fromViewController ows_askForCameraPermissions:^(BOOL granted) {
if (!granted) {
OWSLogWarn(@"Camera permission denied.");
@ -91,6 +93,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertIsOnMainThread();
OWSAssertDebug(self.delegate);
[LKAppearanceUtilities switchToImagePickerAppearance];
[self.delegate.fromViewController ows_askForMediaLibraryPermissions:^(BOOL granted) {
if (!granted) {
OWSLogWarn(@"Media Library permission denied.");
@ -115,6 +119,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertIsOnMainThread();
OWSAssertDebug(self.delegate);
[LKAppearanceUtilities switchToSessionAppearance];
[self.delegate.fromViewController dismissViewControllerAnimated:YES completion:nil];
}
@ -126,6 +132,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertIsOnMainThread();
OWSAssertDebug(self.delegate);
[LKAppearanceUtilities switchToSessionAppearance];
UIImage *rawAvatar = [info objectForKey:UIImagePickerControllerOriginalImage];
[self.delegate.fromViewController

@ -2765,3 +2765,5 @@
"Link your device" = "Link your device";
"Enter your Session ID to start the linking process." = "Enter your Session ID to start the linking process.";
"Enter your Session ID" = "Enter your Session ID";
"Recent Chats" = "Recent Chats";
"Other Chats" = "Other Chats";

@ -1,12 +1,12 @@
@objc(LKProfilePictureView)
final class ProfilePictureView : UIView {
public final class ProfilePictureView : UIView {
private var imageViewWidthConstraint: NSLayoutConstraint!
private var imageViewHeightConstraint: NSLayoutConstraint!
@objc var size: CGFloat = 0 // Not an implicitly unwrapped optional due to Obj-C limitations
@objc var isRSSFeed = false
@objc var hexEncodedPublicKey: String!
@objc var additionalHexEncodedPublicKey: String?
@objc public var size: CGFloat = 0 // Not an implicitly unwrapped optional due to Obj-C limitations
@objc public var isRSSFeed = false
@objc public var hexEncodedPublicKey: String!
@objc public var additionalHexEncodedPublicKey: String?
// MARK: Components
private lazy var imageView = getImageView()
@ -14,20 +14,20 @@ final class ProfilePictureView : UIView {
private lazy var rssLabel: UILabel = {
let result = UILabel()
result.textColor = Colors.text
result.font = .systemFont(ofSize: Values.smallFontSize)
result.textColor = UIColor(rgbHex: 0xFFFFFF) // Colors.text
result.font = .systemFont(ofSize: 13) // Values.smallFontSize
result.textAlignment = .center
result.text = "RSS"
return result
}()
// MARK: Lifecycle
override init(frame: CGRect) {
public override init(frame: CGRect) {
super.init(frame: frame)
setUpViewHierarchy()
}
required init?(coder: NSCoder) {
public required init?(coder: NSCoder) {
super.init(coder: coder)
setUpViewHierarchy()
}
@ -41,7 +41,7 @@ final class ProfilePictureView : UIView {
addSubview(additionalImageView)
additionalImageView.pin(.trailing, to: .trailing, of: self)
additionalImageView.pin(.bottom, to: .bottom, of: self)
let additionalImageViewSize = Values.smallProfilePictureSize
let additionalImageViewSize = CGFloat(35) // Values.smallProfilePictureSize
additionalImageView.set(.width, to: additionalImageViewSize)
additionalImageView.set(.height, to: additionalImageViewSize)
additionalImageView.layer.cornerRadius = additionalImageViewSize / 2
@ -54,7 +54,7 @@ final class ProfilePictureView : UIView {
}
// MARK: Updating
@objc func update() {
@objc public func update() {
if let imageViewWidthConstraint = imageViewWidthConstraint, let imageViewHeightConstraint = imageViewHeightConstraint {
imageView.removeConstraint(imageViewWidthConstraint)
imageView.removeConstraint(imageViewHeightConstraint)
@ -65,7 +65,7 @@ final class ProfilePictureView : UIView {
}
let size: CGFloat
if let additionalHexEncodedPublicKey = additionalHexEncodedPublicKey, !isRSSFeed {
size = Values.smallProfilePictureSize
size = 35 // Values.smallProfilePictureSize
imageViewWidthConstraint = imageView.set(.width, to: size)
imageViewHeightConstraint = imageView.set(.height, to: size)
additionalImageView.isHidden = false
@ -78,19 +78,19 @@ final class ProfilePictureView : UIView {
additionalImageView.image = nil
}
imageView.image = isRSSFeed ? nil : getProfilePicture(of: size, for: hexEncodedPublicKey)
imageView.backgroundColor = isRSSFeed ? UIColor(hex: 0x353535) : Colors.unimportant
imageView.backgroundColor = isRSSFeed ? UIColor(rgbHex: 0x353535) : UIColor(rgbHex: 0xD8D8D8) // UIColor(rgbHex: 0xD8D8D8) = Colors.unimportant
imageView.layer.cornerRadius = size / 2
rssLabel.isHidden = !isRSSFeed
rssLabel.font = size == (Values.largeProfilePictureSize) ? .systemFont(ofSize: Values.largeFontSize) : .systemFont(ofSize: Values.smallFontSize)
rssLabel.font = size == (75) ? .systemFont(ofSize: 20) : .systemFont(ofSize: 13) // Values.largeProfilePictureSize / Values.largeFontSize / Values.smallFontSize
}
// MARK: Convenience
private func getImageView() -> UIImageView {
let result = UIImageView()
result.layer.masksToBounds = true
result.backgroundColor = Colors.unimportant
result.layer.borderColor = Colors.border.cgColor
result.layer.borderWidth = Values.borderThickness
result.backgroundColor = UIColor(rgbHex: 0xD8D8D8) // Colors.unimportant
result.layer.borderColor = UIColor(rgbHex: 0x979797).cgColor // Colors.border
result.layer.borderWidth = 1 // Values.borderThickness
result.contentMode = .scaleAspectFit
return result
}

@ -1,10 +1,10 @@
extension UIView {
public extension UIView {
enum HorizontalEdge { case left, leading, right, trailing }
enum VerticalEdge { case top, bottom }
enum Direction { case horizontal, vertical }
enum Dimension { case width, height }
public enum HorizontalEdge { case left, leading, right, trailing }
public enum VerticalEdge { case top, bottom }
public enum Direction { case horizontal, vertical }
public enum Dimension { case width, height }
private func anchor(from edge: HorizontalEdge) -> NSLayoutXAxisAnchor {
switch edge {
@ -23,7 +23,7 @@ extension UIView {
}
@discardableResult
func pin(_ constraineeEdge: HorizontalEdge, to constrainerEdge: HorizontalEdge, of view: UIView, withInset inset: CGFloat = 0) -> NSLayoutConstraint {
public func pin(_ constraineeEdge: HorizontalEdge, to constrainerEdge: HorizontalEdge, of view: UIView, withInset inset: CGFloat = 0) -> NSLayoutConstraint {
translatesAutoresizingMaskIntoConstraints = false
let constraint = anchor(from: constraineeEdge).constraint(equalTo: view.anchor(from: constrainerEdge), constant: inset)
constraint.isActive = true
@ -31,19 +31,19 @@ extension UIView {
}
@discardableResult
func pin(_ constraineeEdge: VerticalEdge, to constrainerEdge: VerticalEdge, of view: UIView, withInset inset: CGFloat = 0) -> NSLayoutConstraint {
public func pin(_ constraineeEdge: VerticalEdge, to constrainerEdge: VerticalEdge, of view: UIView, withInset inset: CGFloat = 0) -> NSLayoutConstraint {
translatesAutoresizingMaskIntoConstraints = false
let constraint = anchor(from: constraineeEdge).constraint(equalTo: view.anchor(from: constrainerEdge), constant: inset)
constraint.isActive = true
return constraint
}
func pin(to view: UIView) {
public func pin(to view: UIView) {
[ HorizontalEdge.leading, HorizontalEdge.trailing ].forEach { pin($0, to: $0, of: view) }
[ VerticalEdge.top, VerticalEdge.bottom ].forEach { pin($0, to: $0, of: view) }
}
func pin(to view: UIView, withInset inset: CGFloat) {
public func pin(to view: UIView, withInset inset: CGFloat) {
pin(.leading, to: .leading, of: view, withInset: inset)
pin(.top, to: .top, of: view, withInset: inset)
view.pin(.trailing, to: .trailing, of: self, withInset: inset)
@ -51,7 +51,7 @@ extension UIView {
}
@discardableResult
func center(_ direction: Direction, in view: UIView) -> NSLayoutConstraint {
public func center(_ direction: Direction, in view: UIView) -> NSLayoutConstraint {
translatesAutoresizingMaskIntoConstraints = false
let constraint: NSLayoutConstraint = {
switch direction {
@ -63,13 +63,13 @@ extension UIView {
return constraint
}
func center(in view: UIView) {
public func center(in view: UIView) {
center(.horizontal, in: view)
center(.vertical, in: view)
}
@discardableResult
func set(_ dimension: Dimension, to size: CGFloat) -> NSLayoutConstraint {
public func set(_ dimension: Dimension, to size: CGFloat) -> NSLayoutConstraint {
translatesAutoresizingMaskIntoConstraints = false
let constraint: NSLayoutConstraint = {
switch dimension {

@ -36,8 +36,13 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
- (void)loadView
{
[super loadView];
self.view.backgroundColor = UIColor.lokiDarkestGray;
// Loki: Set gradient background
self.view.backgroundColor = UIColor.clearColor;
CAGradientLayer *layer = [CAGradientLayer new];
layer.frame = UIScreen.mainScreen.bounds;
layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ];
[self.view.layer insertSublayer:layer atIndex:0];
UIView *edgesView = [UIView containerView];
[self.view addSubview:edgesView];
@ -58,7 +63,7 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
const CGFloat kButtonHeight = 40.f;
OWSFlatButton *button =
[OWSFlatButton buttonWithTitle:NSLocalizedString(@"Unlock Session", @"")
font:[OWSFlatButton fontForHeight:kButtonHeight]
font:[UIFont boldSystemFontOfSize:15] // Values.mediumFontSize
titleColor:UIColor.whiteColor
backgroundColor:UIColor.clearColor
target:self

@ -51,13 +51,10 @@ NS_ASSUME_NONNULL_BEGIN
{
[super loadView];
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self
action:@selector(dismissPressed:)];
self.view.backgroundColor = Theme.backgroundColor;
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"X"] style:UIBarButtonItemStylePlain target:self action:@selector(dismissPressed:)];
closeButton.tintColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
self.navigationItem.leftBarButtonItem = closeButton;
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
_fullTextSearcher = FullTextSearcher.shared;
_threadViewHelper = [ThreadViewHelper new];
@ -78,6 +75,21 @@ NS_ASSUME_NONNULL_BEGIN
object:nil];
[self createViews];
// Loki: Set gradient background
self.tableViewController.tableView.backgroundColor = UIColor.clearColor;
self.tableViewController.view.backgroundColor = UIColor.clearColor;
CAGradientLayer *layer = [CAGradientLayer new];
layer.frame = UIScreen.mainScreen.bounds;
layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ];
[self.tableViewController.view.layer insertSublayer:layer atIndex:0];
// 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 = [UIColor colorWithRGBHex:0x161616]; // Colors.navigationBarBackground
[self updateTableContents];
}
@ -87,6 +99,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertDebug(self.selectThreadViewDelegate);
// Search
/*
UISearchBar *searchBar = [OWSSearchBar new];
_searchBar = searchBar;
searchBar.delegate = self;
@ -102,6 +115,7 @@ NS_ASSUME_NONNULL_BEGIN
[header autoPinToTopLayoutGuideOfViewController:self withInset:0];
[header setCompressionResistanceVerticalHigh];
[header setContentHuggingVerticalHigh];
*/
// Table
_tableViewController = [OWSTableViewController new];
@ -109,7 +123,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.view addSubview:self.tableViewController.view];
[self.tableViewController.view autoPinEdgeToSuperviewSafeArea:ALEdgeLeading];
[self.tableViewController.view autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing];
[_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:header];
[_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeTop];
[_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
@ -168,6 +182,7 @@ NS_ASSUME_NONNULL_BEGIN
ContactsViewHelper *helper = self.contactsViewHelper;
OWSTableContents *contents = [OWSTableContents new];
/*
OWSTableSection *findByPhoneSection = [OWSTableSection new];
[findByPhoneSection
addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"NEW_CONVERSATION_FIND_BY_PHONE_NUMBER",
@ -182,11 +197,11 @@ NS_ASSUME_NONNULL_BEGIN
animated:YES];
}]];
[contents addSection:findByPhoneSection];
*/
// Existing threads are listed first, ordered by most recently active
OWSTableSection *recentChatsSection = [OWSTableSection new];
recentChatsSection.headerTitle = NSLocalizedString(
@"SELECT_THREAD_TABLE_RECENT_CHATS_TITLE", @"Table section header for recently active conversations");
recentChatsSection.headerTitle = NSLocalizedString(@"Recent Chats", @"");
for (TSThread *thread in [self filteredThreadsWithSearchText]) {
[recentChatsSection
addItem:[OWSTableItem
@ -221,7 +236,7 @@ NS_ASSUME_NONNULL_BEGIN
[[DisappearingTimerConfigurationView alloc]
initWithDurationSeconds:disappearingMessagesConfiguration.durationSeconds];
disappearingTimerConfigurationView.tintColor = Theme.middleGrayColor;
disappearingTimerConfigurationView.tintColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
[disappearingTimerConfigurationView autoSetDimensionsToSize:CGSizeMake(44, 44)];
[cell ows_setAccessoryView:disappearingTimerConfigurationView];
@ -262,8 +277,7 @@ NS_ASSUME_NONNULL_BEGIN
// Contacts who don't yet have a thread are listed last
OWSTableSection *otherContactsSection = [OWSTableSection new];
otherContactsSection.headerTitle = NSLocalizedString(
@"SELECT_THREAD_TABLE_OTHER_CHATS_TITLE", @"Table section header for conversations you haven't recently used.");
otherContactsSection.headerTitle = NSLocalizedString(@"Other Chats", @"");
NSArray<SignalAccount *> *filteredSignalAccounts = [self filteredSignalAccountsWithSearchText];
for (SignalAccount *signalAccount in filteredSignalAccounts) {
[otherContactsSection

@ -84,6 +84,13 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
selector:@selector(attachmentUploadProgress:)
name:kAttachmentUploadProgressNotification
object:nil];
// Loki: Customize title
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(@"Share", @"");
titleLabel.textColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
titleLabel.font = [UIFont boldSystemFontOfSize:25];
self.navigationItem.titleView = titleLabel;
}
- (BOOL)canSelectBlockedContact
@ -98,8 +105,8 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
const CGFloat contentVMargin = 0;
UIView *header = [UIView new];
header.backgroundColor = Theme.backgroundColor;
header.backgroundColor = [UIColor colorWithRGBHex:0x161616]; // Colors.navigationBarBackground
UIButton *cancelShareButton = [UIButton buttonWithType:UIButtonTypeSystem];
[header addSubview:cancelShareButton];

@ -22,7 +22,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
@property (nonatomic) UILabel *nameLabel;
@property (nonatomic) UILabel *profileNameLabel;
@property (nonatomic) UIImageView *avatarView;
@property (nonatomic) LKProfilePictureView *profilePictureView;
@property (nonatomic) UILabel *subtitleLabel;
@property (nonatomic) UILabel *accessoryLabel;
@property (nonatomic) UIStackView *nameContainerView;
@ -76,9 +76,11 @@ const CGFloat kContactCellAvatarTextMargin = 12;
self.layoutMargins = UIEdgeInsetsZero;
_avatarView = [AvatarImageView new];
[_avatarView autoSetDimension:ALDimensionWidth toSize:kStandardAvatarSize];
[_avatarView autoSetDimension:ALDimensionHeight toSize:kStandardAvatarSize];
_profilePictureView = [LKProfilePictureView new];
CGFloat profilePictureSize = 45; // Values.mediumProfilePictureSize
[self.profilePictureView autoSetDimension:ALDimensionWidth toSize:profilePictureSize];
[self.profilePictureView autoSetDimension:ALDimensionHeight toSize:profilePictureSize];
self.profilePictureView.size = profilePictureSize;
self.nameLabel = [UILabel new];
self.nameLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -100,14 +102,13 @@ const CGFloat kContactCellAvatarTextMargin = 12;
]];
self.nameContainerView.axis = UILayoutConstraintAxisVertical;
[self.avatarView setContentHuggingHorizontalHigh];
[self.nameContainerView setContentHuggingHorizontalLow];
[self.accessoryViewContainer setContentHuggingHorizontalHigh];
self.axis = UILayoutConstraintAxisHorizontal;
self.spacing = kContactCellAvatarTextMargin;
self.spacing = 16; // Values.mediumSpacing
self.alignment = UIStackViewAlignmentCenter;
[self addArrangedSubview:self.avatarView];
[self addArrangedSubview:self.profilePictureView];
[self addArrangedSubview:self.nameContainerView];
[self addArrangedSubview:self.accessoryViewContainer];
@ -116,7 +117,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
- (void)configureFontsAndColors
{
self.nameLabel.font = [UIFont ows_dynamicTypeBodyFont];
self.nameLabel.font = [UIFont boldSystemFontOfSize:15];
self.profileNameLabel.font = [UIFont ows_regularFontWithSize:11.f];
self.subtitleLabel.font = [UIFont ows_regularFontWithSize:11.f];
self.accessoryLabel.font = [UIFont ows_mediumFontWithSize:13.f];
@ -187,12 +188,12 @@ const CGFloat kContactCellAvatarTextMargin = 12;
threadName = NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.");
}
NSAttributedString *attributedText =
[[NSAttributedString alloc] initWithString:threadName
attributes:@{
NSForegroundColorAttributeName : [Theme primaryColor],
}];
self.nameLabel.attributedText = attributedText;
// NSAttributedString *attributedText =
// [[NSAttributedString alloc] initWithString:threadName
// attributes:@{
// NSForegroundColorAttributeName : [Theme primaryColor],
// }];
// self.nameLabel.attributedText = attributedText;
if ([thread isKindOfClass:[TSContactThread class]]) {
self.recipientId = thread.contactIdentifier;
@ -203,7 +204,8 @@ const CGFloat kContactCellAvatarTextMargin = 12;
object:nil];
[self updateProfileName];
}
self.avatarView.image = [OWSAvatarBuilder buildImageForThread:thread diameter:kStandardAvatarSize];
[self updateAvatar];
if (self.accessoryMessage) {
self.accessoryLabel.text = self.accessoryMessage;
@ -216,25 +218,21 @@ const CGFloat kContactCellAvatarTextMargin = 12;
- (void)updateAvatar
{
NSString *recipientId = self.recipientId;
if (recipientId.length == 0) {
OWSFailDebug(@"recipientId should not be nil");
self.avatarView.image = nil;
return;
}
ConversationColorName colorName = ^{
if (self.thread) {
return self.thread.conversationColorName;
} else {
OWSAssertDebug(self.recipientId);
return [TSThread stableColorNameForNewConversationWithString:self.recipientId];
if (self.thread.isGroupThread) {
NSMutableArray<NSString *> *sortedUsers = @[].mutableCopy;
NSSet<NSString *> *users = LKAPI.userHexEncodedPublicKeyCache[self.thread.uniqueId];
if (users != nil) {
for (NSString *user in users) {
[sortedUsers addObject:user];
}
}
}();
self.avatarView.image =
[[[OWSContactAvatarBuilder alloc] initWithSignalId:recipientId colorName:colorName diameter:kStandardAvatarSize]
build];
sortedUsers = [sortedUsers sortedArrayUsingSelector:@selector(compare:)].mutableCopy;
self.profilePictureView.hexEncodedPublicKey = (sortedUsers.count > 0) ? sortedUsers[0] : @"";
self.profilePictureView.isRSSFeed = ((TSGroupThread *)self.thread).isRSSFeed;
} else {
self.profilePictureView.hexEncodedPublicKey = self.thread.contactIdentifier;
}
[self.profilePictureView update];
}
- (void)updateProfileName
@ -242,26 +240,31 @@ const CGFloat kContactCellAvatarTextMargin = 12;
OWSContactsManager *contactsManager = self.contactsManager;
if (contactsManager == nil) {
OWSFailDebug(@"contactsManager should not be nil");
self.profileNameLabel.text = nil;
self.nameLabel.text = self.recipientId;
return;
}
NSString *recipientId = self.recipientId;
if (recipientId.length == 0) {
OWSFailDebug(@"recipientId should not be nil");
self.profileNameLabel.text = nil;
self.nameLabel.text = nil;
return;
}
if ([contactsManager hasNameInSystemContactsForRecipientId:recipientId]) {
// Don't display profile name when we have a veritas name in system Contacts
self.profileNameLabel.text = nil;
self.nameLabel.text = nil;
} else {
// Use profile name, if any is available
self.profileNameLabel.text = [contactsManager formattedProfileNameForRecipientId:recipientId];
BOOL isNoteToSelf = (!self.thread.isGroupThread && [self.thread.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]);
if (isNoteToSelf) {
self.nameLabel.text = NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.");
} else {
self.nameLabel.text = [contactsManager formattedProfileNameForRecipientId:recipientId];
}
}
[self.profileNameLabel setNeedsLayout];
[self.nameLabel setNeedsLayout];
}
- (void)prepareForReuse

@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
self.preservesSuperviewLayoutMargins = YES;
self.contentView.preservesSuperviewLayoutMargins = YES;
self.cellView = [ContactCellView new];
[self.contentView addSubview:self.cellView];
[self.cellView autoPinEdgesToSuperviewMargins];

@ -75,6 +75,8 @@ public class OWSNavigationBar: UINavigationBar {
return
}
backgroundColor = UIColor(rgbHex: 0x161616)
if UIAccessibility.isReduceTransparencyEnabled {
blurEffectView?.isHidden = true
let color = Theme.navbarBackgroundColor
@ -86,7 +88,8 @@ public class OWSNavigationBar: UINavigationBar {
let color = Theme.navbarBackgroundColor
let backgroundImage = UIImage(color: color)
self.setBackgroundImage(backgroundImage, for: .default)
/*
let blurEffect = Theme.barBlurEffect
let blurEffectView: UIVisualEffectView = {
@ -109,13 +112,14 @@ public class OWSNavigationBar: UINavigationBar {
}()
blurEffectView.effect = blurEffect
*/
// remove hairline below bar.
self.shadowImage = UIImage()
// On iOS11, despite inserting the blur at 0, other views are later inserted into the navbar behind the blur,
// so we have to set a zindex to avoid obscuring navbar title/buttons.
blurEffectView.layer.zPosition = -1
// blurEffectView.layer.zPosition = -1
}
}

@ -734,7 +734,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
NSString *profileNameFormatString = NSLocalizedString(@"PROFILE_NAME_LABEL_FORMAT",
@"Prepend a simple marker to differentiate the profile name, embeds the contact's {{profile name}}.");
return [NSString stringWithFormat:profileNameFormatString, profileName];
return profileName;
}
- (nullable NSString *)profileNameForRecipientId:(NSString *)recipientId

@ -364,6 +364,7 @@ public class FullTextSearcher: NSObject {
@objc(filterThreads:withSearchText:)
public func filterThreads(_ threads: [TSThread], searchText: String) -> [TSThread] {
let threads = threads.filter { $0.name() != "Loki Messenger Updates" && $0.name() != "Loki News" }
guard searchText.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 else {
return threads
}

@ -41,14 +41,32 @@ NS_ASSUME_NONNULL_BEGIN
{
[super loadView];
self.view.backgroundColor = [UIColor ows_materialBlueColor];
self.title = NSLocalizedString(@"SHARE_EXTENSION_VIEW_TITLE", @"Title for the 'share extension' view.");
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self
action:@selector(dismissPressed:)];
UIView.appearance.tintColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
// Loki: Set gradient background
self.view.backgroundColor = UIColor.clearColor;
CAGradientLayer *layer = [CAGradientLayer new];
layer.frame = UIScreen.mainScreen.bounds;
layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ];
[self.view.layer insertSublayer:layer atIndex:0];
// 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 = [UIColor colorWithRGBHex:0x161616]; // Colors.navigationBarBackground
// Loki: Customize title
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(@"Share to Session", @"");
titleLabel.textColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
titleLabel.font = [UIFont boldSystemFontOfSize:25]; // Values.veryLargeFontSize
self.navigationItem.titleView = titleLabel;
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"X"] style:UIBarButtonItemStylePlain target:self action:@selector(dismissPressed:)];
closeButton.tintColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
self.navigationItem.leftBarButtonItem = closeButton;
}
- (void)viewWillAppear:(BOOL)animated

Loading…
Cancel
Save