pull/68/head
Niels Andriesse 5 years ago
parent 4a001f8800
commit 9bcf6a256a

@ -173,11 +173,11 @@ final class HomeVC : UIViewController, UITableViewDataSource, UITableViewDelegat
let key = rowChange.collectionKey.key
threadViewModelCache[key] = nil
switch rowChange.type {
case .delete: tableView.deleteRows(at: [ rowChange.indexPath! ], with: UITableView.RowAnimation.automatic)
case .insert: tableView.insertRows(at: [ rowChange.newIndexPath! ], with: UITableView.RowAnimation.automatic)
case .delete: tableView.deleteRows(at: [ rowChange.indexPath! ], with: UITableView.RowAnimation.fade)
case .insert: tableView.insertRows(at: [ rowChange.newIndexPath! ], with: UITableView.RowAnimation.fade)
case .move:
tableView.deleteRows(at: [ rowChange.indexPath! ], with: UITableView.RowAnimation.automatic)
tableView.insertRows(at: [ rowChange.newIndexPath! ], with: UITableView.RowAnimation.automatic)
tableView.deleteRows(at: [ rowChange.indexPath! ], with: UITableView.RowAnimation.fade)
tableView.insertRows(at: [ rowChange.newIndexPath! ], with: UITableView.RowAnimation.fade)
case .update:
tableView.reloadRows(at: [ rowChange.indexPath! ], with: UITableView.RowAnimation.none)
default: break
@ -207,7 +207,8 @@ final class HomeVC : UIViewController, UITableViewDataSource, UITableViewDelegat
profilePictureView.update()
profilePictureView.set(.width, to: profilePictureSize)
profilePictureView.set(.height, to: profilePictureSize)
profilePictureView.onTap = { [weak self] in self?.openSettings() }
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(openSettings))
profilePictureView.addGestureRecognizer(tapGestureRecognizer)
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profilePictureView)
let createPrivateGroupChatButton = UIBarButtonItem(image: #imageLiteral(resourceName: "People"), style: .plain, target: self, action: #selector(createPrivateGroupChat))
createPrivateGroupChatButton.tintColor = Colors.text

@ -5,7 +5,6 @@ final class ProfilePictureView : UIView {
var size: CGFloat!
var hexEncodedPublicKey: String!
var additionalHexEncodedPublicKey: String?
var onTap: (() -> Void)? = nil
// MARK: Components
private lazy var imageView = getImageView()
@ -35,9 +34,6 @@ final class ProfilePictureView : UIView {
additionalImageView.set(.width, to: additionalImageViewSize)
additionalImageView.set(.height, to: additionalImageViewSize)
additionalImageView.layer.cornerRadius = additionalImageViewSize / 2
// Set up gesture recognizer
let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTap))
addGestureRecognizer(gestureRecognizer)
}
// MARK: Updating
@ -72,11 +68,6 @@ final class ProfilePictureView : UIView {
imageView.layer.cornerRadius = size / 2
}
// MARK: Interaction
@objc private func handleTap() {
onTap?()
}
// MARK: Convenience
private func getImageView() -> UIImageView {
let result = UIImageView()

@ -40,6 +40,7 @@ final class Separator : UIView {
titleLabel.center(.horizontal, in: self)
titleLabel.center(.vertical, in: self)
layer.insertSublayer(lineLayer, at: 0)
set(.height, to: Values.separatorLabelHeight)
}
// MARK: Updating
@ -55,7 +56,7 @@ final class Separator : UIView {
path.move(to: CGPoint(x: 0, y: h / 2))
let titleLabelFrame = titleLabel.frame.insetBy(dx: -10, dy: -6)
path.addLine(to: CGPoint(x: titleLabelFrame.origin.x, y: h / 2))
let oval = UIBezierPath(roundedRect: titleLabelFrame, cornerRadius: Values.separatorCornerRadius)
let oval = UIBezierPath(roundedRect: titleLabelFrame, cornerRadius: Values.separatorLabelHeight / 2)
path.append(oval)
path.move(to: CGPoint(x: titleLabelFrame.origin.x + titleLabelFrame.width, y: h / 2))
path.addLine(to: CGPoint(x: w, y: h / 2))

@ -27,7 +27,7 @@ final class Values : NSObject {
@objc static let newConversationButtonSize = CGFloat(45)
@objc static let textFieldHeight = CGFloat(80)
@objc static let textFieldCornerRadius = CGFloat(8)
@objc static let separatorCornerRadius = CGFloat(10)
@objc static let separatorLabelHeight = CGFloat(24)
@objc static var separatorThickness: CGFloat { return 1 / UIScreen.main.scale }
// MARK: - Distances

Loading…
Cancel
Save