Clean
This commit is contained in:
parent
17b6f65058
commit
870f4d38d7
|
@ -28,6 +28,7 @@ final class ContextMenuVC : UIViewController {
|
|||
|
||||
// MARK: Settings
|
||||
private static let actionViewHeight: CGFloat = 40
|
||||
private static let menuCornerRadius: CGFloat = 8
|
||||
|
||||
// MARK: Lifecycle
|
||||
init(snapshot: UIView, viewItem: ConversationViewItem, frame: CGRect, delegate: ContextMenuActionDelegate, dismiss: @escaping () -> Void) {
|
||||
|
@ -76,7 +77,7 @@ final class ContextMenuVC : UIViewController {
|
|||
// Menu
|
||||
let menuBackgroundView = UIView()
|
||||
menuBackgroundView.backgroundColor = Colors.receivedMessageBackground
|
||||
menuBackgroundView.layer.cornerRadius = Values.messageBubbleCornerRadius
|
||||
menuBackgroundView.layer.cornerRadius = ContextMenuVC.menuCornerRadius
|
||||
menuBackgroundView.layer.masksToBounds = true
|
||||
menuView.addSubview(menuBackgroundView)
|
||||
menuBackgroundView.pin(to: menuView)
|
||||
|
@ -115,7 +116,7 @@ final class ContextMenuVC : UIViewController {
|
|||
// MARK: Updating
|
||||
override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
menuView.layer.shadowPath = UIBezierPath(roundedRect: menuView.bounds, cornerRadius: Values.messageBubbleCornerRadius).cgPath
|
||||
menuView.layer.shadowPath = UIBezierPath(roundedRect: menuView.bounds, cornerRadius: ContextMenuVC.menuCornerRadius).cgPath
|
||||
}
|
||||
|
||||
// MARK: Interaction
|
||||
|
|
|
@ -22,6 +22,9 @@ final class FakeChatView : UIView {
|
|||
return result
|
||||
}()
|
||||
|
||||
private static let bubbleWidth = CGFloat(224)
|
||||
private static let bubbleCornerRadius = CGFloat(10)
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setUpViewHierarchy()
|
||||
|
@ -54,8 +57,8 @@ final class FakeChatView : UIView {
|
|||
private func getChatBubble(withText text: String, wasSentByCurrentUser: Bool) -> UIView {
|
||||
let result = UIView()
|
||||
let bubbleView = UIView()
|
||||
bubbleView.set(.width, to: Values.fakeChatBubbleWidth)
|
||||
bubbleView.layer.cornerRadius = Values.fakeChatBubbleCornerRadius
|
||||
bubbleView.set(.width, to: FakeChatView.bubbleWidth)
|
||||
bubbleView.layer.cornerRadius = FakeChatView.bubbleCornerRadius
|
||||
bubbleView.layer.shadowColor = UIColor.black.cgColor
|
||||
bubbleView.layer.shadowRadius = isLightMode ? 4 : 8
|
||||
bubbleView.layer.shadowOpacity = isLightMode ? 0.16 : 0.24
|
||||
|
|
|
@ -4,7 +4,7 @@ final class LandingVC : BaseVC {
|
|||
// MARK: Components
|
||||
private lazy var fakeChatView: FakeChatView = {
|
||||
let result = FakeChatView()
|
||||
result.set(.height, to: Values.fakeChatViewHeight)
|
||||
result.set(.height, to: LandingVC.fakeChatViewHeight)
|
||||
return result
|
||||
}()
|
||||
|
||||
|
@ -24,6 +24,9 @@ final class LandingVC : BaseVC {
|
|||
return result
|
||||
}()
|
||||
|
||||
// MARK: Settings
|
||||
private static let fakeChatViewHeight = isIPhone5OrSmaller ? CGFloat(234) : CGFloat(260)
|
||||
|
||||
// MARK: Lifecycle
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
|
|
@ -52,6 +52,9 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
return result
|
||||
}()
|
||||
|
||||
// MARK: Settings
|
||||
private static let buttonHeight = isIPhone5OrSmaller ? CGFloat(52) : CGFloat(75)
|
||||
|
||||
// MARK: Lifecycle
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
@ -172,7 +175,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
let selectedColor = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
|
||||
button.setBackgroundImage(getImage(withColor: selectedColor), for: UIControl.State.highlighted)
|
||||
button.addTarget(self, action: selector, for: UIControl.Event.touchUpInside)
|
||||
button.set(.height, to: Values.settingButtonHeight)
|
||||
button.set(.height, to: SettingsVC.buttonHeight)
|
||||
return button
|
||||
}
|
||||
var result = [
|
||||
|
|
|
@ -9,6 +9,8 @@ final class SettingRow : UIView {
|
|||
result.layer.masksToBounds = true
|
||||
return result
|
||||
}()
|
||||
|
||||
private static let defaultHeight: CGFloat = 60
|
||||
|
||||
init(autoSize: Bool) {
|
||||
self.autoSize = autoSize
|
||||
|
@ -31,7 +33,7 @@ final class SettingRow : UIView {
|
|||
private func setUpUI() {
|
||||
// Height
|
||||
if !autoSize {
|
||||
let height = Values.defaultSettingRowHeight
|
||||
let height = SettingRow.defaultHeight
|
||||
set(.height, to: height)
|
||||
}
|
||||
// Shadow
|
||||
|
|
|
@ -7,7 +7,7 @@ class Modal : BaseVC {
|
|||
lazy var contentView: UIView = {
|
||||
let result = UIView()
|
||||
result.backgroundColor = Colors.modalBackground
|
||||
result.layer.cornerRadius = Values.modalCornerRadius
|
||||
result.layer.cornerRadius = Modal.cornerRadius
|
||||
result.layer.masksToBounds = false
|
||||
result.layer.borderColor = isLightMode ? UIColor.white.cgColor : Colors.modalBorder.cgColor
|
||||
result.layer.borderWidth = 1
|
||||
|
@ -28,6 +28,9 @@ class Modal : BaseVC {
|
|||
return result
|
||||
}()
|
||||
|
||||
// MARK: Settings
|
||||
private static let cornerRadius: CGFloat = 10
|
||||
|
||||
// MARK: Lifecycle
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
PROTOC=protoc \
|
||||
--proto_path='./'
|
||||
WRAPPER_SCRIPT=../../../../session-ios/Scripts/ProtoWrappers.py \
|
||||
--proto-dir='./' --verbose --add-log-tag
|
||||
|
||||
all: webrtc_data_proto unidentified_delivery_protos
|
||||
|
||||
webrtc_data_proto: WhisperTextProtocol.proto
|
||||
$(PROTOC) --swift_out=. \
|
||||
WhisperTextProtocol.proto
|
||||
$(WRAPPER_SCRIPT) --dst-dir=. \
|
||||
--wrapper-prefix=SPKProto --proto-prefix=SPKProtos --proto-file=WhisperTextProtocol.proto
|
||||
|
||||
unidentified_delivery_protos: OWSUnidentifiedDelivery.proto
|
||||
$(PROTOC) --swift_out=../SignalMetadataKit/src/Generated \
|
||||
OWSUnidentifiedDelivery.proto
|
||||
$(WRAPPER_SCRIPT) --dst-dir=../SignalMetadataKit/src/Generated \
|
||||
--wrapper-prefix=SMKProto --proto-prefix=SMKProtos --proto-file=OWSUnidentifiedDelivery.proto
|
|
@ -1,73 +0,0 @@
|
|||
/**
|
||||
* Copyright (C) 2014-2016 Open Whisper Systems
|
||||
*
|
||||
* Licensed according to the LICENSE file in this repository.
|
||||
*/
|
||||
|
||||
// iOS - since we use a modern proto-compiler, we must specify
|
||||
// the legacy proto format.
|
||||
syntax = "proto2";
|
||||
|
||||
// iOS - package name determines class prefix
|
||||
package SMKProtos;
|
||||
|
||||
option java_package = "org.signal.libsignal.metadata";
|
||||
option java_outer_classname = "SignalProtos";
|
||||
|
||||
message ServerCertificate {
|
||||
message Certificate {
|
||||
// @required
|
||||
optional uint32 id = 1;
|
||||
// @required
|
||||
optional bytes key = 2;
|
||||
}
|
||||
|
||||
// @required
|
||||
optional bytes certificate = 1;
|
||||
// @required
|
||||
optional bytes signature = 2;
|
||||
}
|
||||
|
||||
message SenderCertificate {
|
||||
message Certificate {
|
||||
// @required
|
||||
optional string sender = 1;
|
||||
// @required
|
||||
optional uint32 senderDevice = 2;
|
||||
// @required
|
||||
optional fixed64 expires = 3;
|
||||
// @required
|
||||
optional bytes identityKey = 4;
|
||||
// @required
|
||||
optional ServerCertificate signer = 5;
|
||||
}
|
||||
|
||||
// @required
|
||||
optional string sender = 1;
|
||||
// @required
|
||||
optional uint32 senderDevice = 2;
|
||||
}
|
||||
|
||||
message UnidentifiedSenderMessage {
|
||||
message Message {
|
||||
enum Type {
|
||||
PREKEY_MESSAGE = 1;
|
||||
MESSAGE = 2;
|
||||
FALLBACK_MESSAGE = 3;
|
||||
}
|
||||
|
||||
// @required
|
||||
optional Type type = 1;
|
||||
// @required
|
||||
optional SenderCertificate senderCertificate = 2;
|
||||
// @required
|
||||
optional bytes content = 3;
|
||||
}
|
||||
|
||||
// @required
|
||||
optional bytes ephemeralPublic = 1;
|
||||
// @required
|
||||
optional bytes encryptedStatic = 2;
|
||||
// @required
|
||||
optional bytes encryptedMessage = 3;
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
// iOS - since we use a modern proto-compiler, we must specify
|
||||
// the legacy proto format.
|
||||
syntax = "proto2";
|
||||
|
||||
// iOS - package name determines class prefix
|
||||
package SPKProtos;
|
||||
|
||||
message TSProtoWhisperMessage {
|
||||
// @required
|
||||
optional bytes ratchetKey = 1;
|
||||
// @required
|
||||
optional uint32 counter = 2;
|
||||
optional uint32 previousCounter = 3;
|
||||
// @required
|
||||
optional bytes ciphertext = 4;
|
||||
}
|
||||
|
||||
message TSProtoPreKeyWhisperMessage {
|
||||
optional uint32 registrationId = 5;
|
||||
optional uint32 preKeyId = 1;
|
||||
// @required
|
||||
optional uint32 signedPreKeyId = 6;
|
||||
// @required
|
||||
optional bytes baseKey = 2;
|
||||
// @required
|
||||
optional bytes identityKey = 3;
|
||||
// @required
|
||||
optional bytes message = 4; // WhisperMessage
|
||||
}
|
||||
|
||||
message TSProtoKeyExchangeMessage {
|
||||
optional uint32 id = 1;
|
||||
optional bytes baseKey = 2;
|
||||
optional bytes ratchetKey = 3;
|
||||
optional bytes identityKey = 4;
|
||||
optional bytes baseKeySignature = 5;
|
||||
}
|
||||
|
||||
message TSProtoSenderKeyMessage {
|
||||
optional uint32 id = 1;
|
||||
optional uint32 iteration = 2;
|
||||
optional bytes ciphertext = 3;
|
||||
}
|
||||
|
||||
message TSProtoSenderKeyDistributionMessage {
|
||||
optional uint32 id = 1;
|
||||
optional uint32 iteration = 2;
|
||||
optional bytes chainKey = 3;
|
||||
optional bytes signingKey = 4;
|
||||
}
|
||||
|
||||
message ClosedGroupCiphertextMessage {
|
||||
// @required
|
||||
optional bytes ciphertext = 1;
|
||||
// @required
|
||||
optional bytes senderPublicKey = 2;
|
||||
// @required
|
||||
optional uint32 keyIndex = 3;
|
||||
}
|
|
@ -20,6 +20,9 @@ public final class Separator : UIView {
|
|||
return result
|
||||
}()
|
||||
|
||||
// MARK: Settings
|
||||
private static let height: CGFloat = 24
|
||||
|
||||
// MARK: Initialization
|
||||
public init(title: String) {
|
||||
self.title = title
|
||||
|
@ -41,7 +44,7 @@ public final class Separator : UIView {
|
|||
titleLabel.center(.horizontal, in: self)
|
||||
titleLabel.center(.vertical, in: self)
|
||||
layer.insertSublayer(lineLayer, at: 0)
|
||||
set(.height, to: Values.separatorLabelHeight)
|
||||
set(.height, to: Separator.height)
|
||||
}
|
||||
|
||||
// MARK: Updating
|
||||
|
@ -57,7 +60,7 @@ public 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.separatorLabelHeight / 2)
|
||||
let oval = UIBezierPath(roundedRect: titleLabelFrame, cornerRadius: Separator.height / 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))
|
||||
|
|
|
@ -33,18 +33,9 @@ public final class Values : NSObject {
|
|||
|
||||
// TODO ----------------
|
||||
|
||||
@objc public static let separatorLabelHeight = CGFloat(24)
|
||||
@objc public static var separatorThickness: CGFloat { return 1 / UIScreen.main.scale }
|
||||
@objc public static let tabBarHeight = isIPhone5OrSmaller ? CGFloat(32) : CGFloat(48)
|
||||
@objc public static let settingButtonHeight = isIPhone5OrSmaller ? CGFloat(52) : CGFloat(75)
|
||||
@objc public static let defaultSettingRowHeight = CGFloat(60)
|
||||
@objc public static let modalCornerRadius = CGFloat(10)
|
||||
@objc public static let modalButtonCornerRadius = CGFloat(5)
|
||||
@objc public static let fakeChatBubbleWidth = CGFloat(224)
|
||||
@objc public static let fakeChatBubbleCornerRadius = CGFloat(10)
|
||||
@objc public static let fakeChatViewHeight = isIPhone5OrSmaller ? CGFloat(234) : CGFloat(260)
|
||||
@objc public static let composeViewTextFieldBorderThickness = 1 / UIScreen.main.scale
|
||||
@objc public static let messageBubbleCornerRadius: CGFloat = 8
|
||||
@objc public static let progressBarThickness: CGFloat = 2
|
||||
@objc public static let pnOptionCornerRadius = CGFloat(8)
|
||||
@objc public static let pathStatusViewSize = CGFloat(8)
|
||||
|
|
Loading…
Reference in New Issue