Add call button to conversation screen
This commit is contained in:
parent
950c6204b7
commit
b54cd3b026
|
@ -1,7 +1,7 @@
|
|||
import WebRTC
|
||||
|
||||
final class CallVCV2 : UIViewController {
|
||||
let roomID = "37923672514" // NOTE: You need to change this every time to ensure the room isn't full
|
||||
let roomID = "37923672515" // NOTE: You need to change this every time to ensure the room isn't full
|
||||
var room: RoomInfo?
|
||||
var socket: WebSocket?
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
|
|||
unreadViewItems.removeAll()
|
||||
messagesTableView.scrollToRow(at: indexPath, at: .top, animated: true)
|
||||
}
|
||||
|
||||
@objc func startCall() {
|
||||
let callVC = CallVCV2()
|
||||
navigationController!.pushViewController(callVC, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
// MARK: Blocking
|
||||
@objc func unblock() {
|
||||
|
|
|
@ -294,7 +294,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
|
|||
if isShowingSearchUI {
|
||||
navigationItem.rightBarButtonItems = []
|
||||
} else {
|
||||
let rightBarButtonItem: UIBarButtonItem
|
||||
var rightBarButtonItems: [UIBarButtonItem] = []
|
||||
if thread is TSContactThread {
|
||||
let size = Values.verySmallProfilePictureSize
|
||||
let profilePictureView = ProfilePictureView()
|
||||
|
@ -305,13 +305,19 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
|
|||
profilePictureView.set(.height, to: size)
|
||||
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(openSettings))
|
||||
profilePictureView.addGestureRecognizer(tapGestureRecognizer)
|
||||
rightBarButtonItem = UIBarButtonItem(customView: profilePictureView)
|
||||
let settingsButton = UIBarButtonItem(customView: profilePictureView)
|
||||
settingsButton.accessibilityLabel = "Settings button"
|
||||
settingsButton.isAccessibilityElement = true
|
||||
rightBarButtonItems.append(settingsButton)
|
||||
let callButton = UIBarButtonItem(image: UIImage(named: "Phone")!, style: .plain, target: self, action: #selector(startCall))
|
||||
rightBarButtonItems.append(callButton)
|
||||
} else {
|
||||
rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "Gear"), style: .plain, target: self, action: #selector(openSettings))
|
||||
let settingsButton = UIBarButtonItem(image: UIImage(named: "Gear"), style: .plain, target: self, action: #selector(openSettings))
|
||||
settingsButton.accessibilityLabel = "Settings button"
|
||||
settingsButton.isAccessibilityElement = true
|
||||
rightBarButtonItems.append(settingsButton)
|
||||
}
|
||||
rightBarButtonItem.accessibilityLabel = "Settings button"
|
||||
rightBarButtonItem.isAccessibilityElement = true
|
||||
navigationItem.rightBarButtonItem = rightBarButtonItem
|
||||
navigationItem.rightBarButtonItems = rightBarButtonItems
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ final class ConversationTitleView : UIView {
|
|||
stackView.axis = .vertical
|
||||
stackView.alignment = .center
|
||||
stackView.isLayoutMarginsRelativeArrangement = true
|
||||
stackView.layoutMargins = UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 0)
|
||||
let leftMargin: CGFloat = (thread is TSContactThread) ? 54 : 8 // Contact threads also have the call button to compensate for
|
||||
stackView.layoutMargins = UIEdgeInsets(top: 0, left: leftMargin, bottom: 0, right: 0)
|
||||
addSubview(stackView)
|
||||
stackView.pin(to: self)
|
||||
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTap))
|
||||
|
|
|
@ -156,11 +156,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv
|
|||
let _ = IP2Country.shared.populateCacheIfNeeded()
|
||||
}
|
||||
// Get default open group rooms if needed
|
||||
OpenGroupAPIV2.getDefaultRoomsIfNeeded()
|
||||
|
||||
let callVC = CallVCV2()
|
||||
present(callVC, animated: true, completion: nil)
|
||||
|
||||
OpenGroupAPIV2.getDefaultRoomsIfNeeded()
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Phone.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue