Merge branch 'charlesmchen/contactShareAssets'

pull/1/head
Matthew Chen 7 years ago
commit 882098e9cb

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "phone_20@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "phone_20@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "phone_20@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "message_20@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "message_20@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "message_20@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "video_20@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "video_20@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "video_20@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

@ -263,18 +263,21 @@ class ContactViewController: OWSViewController, CNContactViewControllerDelegate
stackView.distribution = .fillEqually stackView.distribution = .fillEqually
stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_SEND_MESSAGE", stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_SEND_MESSAGE",
comment: "Label for 'sent message' button in contact view."), comment: "Label for 'sent message' button in contact view."),
imageName: "contact_view_message",
actionBlock: { [weak self] _ in actionBlock: { [weak self] _ in
guard let strongSelf = self else { return } guard let strongSelf = self else { return }
strongSelf.didPressSendMessage() strongSelf.didPressSendMessage()
})) }))
stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_AUDIO_CALL", stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_AUDIO_CALL",
comment: "Label for 'audio call' button in contact view."), comment: "Label for 'audio call' button in contact view."),
imageName: "contact_view_audio_call",
actionBlock: { [weak self] _ in actionBlock: { [weak self] _ in
guard let strongSelf = self else { return } guard let strongSelf = self else { return }
strongSelf.didPressAudioCall() strongSelf.didPressAudioCall()
})) }))
stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_VIDEO_CALL", stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_VIDEO_CALL",
comment: "Label for 'video call' button in contact view."), comment: "Label for 'video call' button in contact view."),
imageName: "contact_view_video_call",
actionBlock: { [weak self] _ in actionBlock: { [weak self] _ in
guard let strongSelf = self else { return } guard let strongSelf = self else { return }
strongSelf.didPressVideoCall() strongSelf.didPressVideoCall()
@ -401,7 +404,7 @@ class ContactViewController: OWSViewController, CNContactViewControllerDelegate
} }
// TODO: Use real assets. // TODO: Use real assets.
private func createCircleActionButton(text: String, actionBlock : @escaping () -> Void) -> UIView { private func createCircleActionButton(text: String, imageName: String, actionBlock : @escaping () -> Void) -> UIView {
let buttonSize = CGFloat(50) let buttonSize = CGFloat(50)
let button = TappableView(actionBlock: actionBlock) let button = TappableView(actionBlock: actionBlock)
@ -417,6 +420,14 @@ class ContactViewController: OWSViewController, CNContactViewControllerDelegate
circleView.autoPinEdge(toSuperviewEdge: .top) circleView.autoPinEdge(toSuperviewEdge: .top)
circleView.autoHCenterInSuperview() circleView.autoHCenterInSuperview()
guard let image = UIImage(named: imageName) else {
owsFail("\(logTag) missing image.")
return button
}
let imageView = UIImageView(image: image)
circleView.addSubview(imageView)
imageView.autoCenterInSuperview()
let label = UILabel() let label = UILabel()
label.text = text label.text = text
label.font = UIFont.ows_dynamicTypeCaption2 label.font = UIFont.ows_dynamicTypeCaption2

Loading…
Cancel
Save