Add in Dependencies type
This commit is contained in:
parent
4c98c9cc85
commit
11dff385cc
|
@ -19,8 +19,8 @@ class CallButton: UIButton {
|
|||
var selectedIconColor: UIColor = .ows_gray75 { didSet { updateAppearance() } }
|
||||
var currentIconColor: UIColor { isSelected ? selectedIconColor : iconColor }
|
||||
|
||||
var unselectedBackgroundColor = UIColor.ows_whiteAlpha40 { didSet { updateAppearance() } }
|
||||
var selectedBackgroundColor = UIColor.ows_white { didSet { updateAppearance() } }
|
||||
var unselectedBackgroundColor = UIColor.white.withAlphaComponent(0.4) { didSet { updateAppearance() } }
|
||||
var selectedBackgroundColor = UIColor.white { didSet { updateAppearance() } }
|
||||
|
||||
var currentBackgroundColor: UIColor {
|
||||
return isSelected ? selectedBackgroundColor : unselectedBackgroundColor
|
||||
|
@ -119,9 +119,9 @@ class CallButton: UIButton {
|
|||
NSLayoutConstraint.deactivate(currentConstraints)
|
||||
currentConstraints.removeAll()
|
||||
|
||||
currentConstraints += circleView.autoSetDimensions(to: CGSize(square: currentIconSize))
|
||||
currentConstraints += circleView.autoSetDimensions(to: CGSize(width: currentIconSize, height: currentIconSize))
|
||||
circleView.layer.shadowPath = UIBezierPath(
|
||||
ovalIn: CGRect(origin: .zero, size: .square(currentIconSize))
|
||||
ovalIn: CGRect(origin: .zero, size: CGSize(width: currentIconSize, height: currentIconSize))
|
||||
).cgPath
|
||||
currentConstraints += iconView.autoPinEdgesToSuperviewEdges(with: currentIconInsets)
|
||||
if let dropdownIconView = dropdownIconView {
|
||||
|
@ -136,7 +136,7 @@ class CallButton: UIButton {
|
|||
self.dropdownIconView = dropdownIconView
|
||||
circleView.addSubview(dropdownIconView)
|
||||
|
||||
dropdownIconView.autoSetDimensions(to: CGSize(square: 12))
|
||||
dropdownIconView.autoSetDimensions(to: CGSize(width: 12, height: 12))
|
||||
dropdownIconView.autoVCenterInSuperview()
|
||||
|
||||
updateSizing()
|
||||
|
|
|
@ -39,7 +39,7 @@ class CallHeader: UIView {
|
|||
|
||||
let gradientLayer = CAGradientLayer()
|
||||
gradientLayer.colors = [
|
||||
UIColor.ows_blackAlpha60.cgColor,
|
||||
UIColor.black.withAlphaComponent(0.6).cgColor,
|
||||
UIColor.black.withAlphaComponent(0).cgColor
|
||||
]
|
||||
let gradientView = OWSLayerView(frame: .zero) { view in
|
||||
|
@ -64,7 +64,7 @@ class CallHeader: UIView {
|
|||
|
||||
let backButton = UIButton()
|
||||
let backButtonImage = CurrentAppContext().isRTL ? #imageLiteral(resourceName: "NavBarBackRTL") : #imageLiteral(resourceName: "NavBarBack")
|
||||
backButton.setTemplateImage(backButtonImage, tintColor: .ows_white)
|
||||
backButton.setTemplateImage(backButtonImage, tintColor: .white)
|
||||
backButton.autoSetDimensions(to: CGSize(square: 40))
|
||||
backButton.imageEdgeInsets = UIEdgeInsets(top: -12, leading: -18, bottom: 0, trailing: 0)
|
||||
backButton.addTarget(delegate, action: #selector(CallHeaderDelegate.didTapBackButton), for: .touchUpInside)
|
||||
|
@ -91,7 +91,7 @@ class CallHeader: UIView {
|
|||
// Add trailing space after the name scrolls before it wraps around and scrolls back in.
|
||||
callTitleLabel.trailingBuffer = ScaleFromIPhone5(80.0)
|
||||
|
||||
callTitleLabel.font = UIFont.ows_dynamicTypeHeadlineClamped.ows_semibold
|
||||
callTitleLabel.font = .boldSystemFont(ofSize: Values.mediumFontSize)
|
||||
callTitleLabel.textAlignment = .center
|
||||
callTitleLabel.textColor = UIColor.white
|
||||
addShadow(to: callTitleLabel)
|
||||
|
@ -317,7 +317,7 @@ private class GroupMembersButton: UIButton {
|
|||
iconImageView.autoSetDimensions(to: CGSize(square: 22))
|
||||
iconImageView.autoPinEdge(toSuperviewEdge: .top, withInset: 2)
|
||||
|
||||
countLabel.font = UIFont.ows_dynamicTypeFootnoteClamped.ows_monospaced
|
||||
countLabel.font = .systemFont(ofSize: Values.mediumFontSize)
|
||||
countLabel.textColor = .ows_white
|
||||
addSubview(countLabel)
|
||||
countLabel.autoPinEdge(.leading, to: .trailing, of: iconImageView, withOffset: 5)
|
||||
|
|
|
@ -8,13 +8,13 @@ class GroupCallSwipeToastView: UIView {
|
|||
|
||||
private let imageView: UIImageView = {
|
||||
let view = UIImageView()
|
||||
view.setTemplateImageName("arrow-up-20", tintColor: .ows_white)
|
||||
view.setTemplateImageName("arrow-up-20", tintColor: .white)
|
||||
return view
|
||||
}()
|
||||
|
||||
private let label: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = UIFont.ows_dynamicTypeBody2
|
||||
label.font = .systemFont(ofSize: Values.mediumFontSize)
|
||||
label.textColor = .ows_gray05
|
||||
label.numberOfLines = 0
|
||||
label.lineBreakMode = .byWordWrapping
|
||||
|
|
|
@ -829,7 +829,7 @@ extension GroupCallViewController: GroupCallMemberViewDelegate {
|
|||
let titleFormat = NSLocalizedString(
|
||||
"GROUP_CALL_BLOCKED_ALERT_TITLE_FORMAT",
|
||||
comment: "Title for alert explaining that a group call participant is blocked. Embeds {{ user's name }}")
|
||||
let displayName = contactsManager.displayName(for: address)
|
||||
let displayName = Storage.shared.getContact(with: address)?.displayName(for: .regular) ?? address
|
||||
title = String(format: titleFormat, displayName)
|
||||
|
||||
case let .noMediaKeys(address):
|
||||
|
@ -840,7 +840,7 @@ extension GroupCallViewController: GroupCallMemberViewDelegate {
|
|||
let titleFormat = NSLocalizedString(
|
||||
"GROUP_CALL_NO_KEYS_ALERT_TITLE_FORMAT",
|
||||
comment: "Title for alert explaining that a group call participant cannot be displayed because of missing keys. Embeds {{ user's name }}")
|
||||
let displayName = contactsManager.displayName(for: address)
|
||||
let displayName = Storage.shared.getContact(with: address)?.displayName(for: .regular) ?? address
|
||||
title = String(format: titleFormat, displayName)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ protocol CallUIAdaptee {
|
|||
func failCall(_ call: SignalCall, error: SignalCall.CallError)
|
||||
func setIsMuted(call: SignalCall, isMuted: Bool)
|
||||
func setHasLocalVideo(call: SignalCall, hasLocalVideo: Bool)
|
||||
func startAndShowOutgoingCall(address: String, hasLocalVideo: Bool)
|
||||
func startAndShowOutgoingCall(publicKey: String, hasLocalVideo: Bool)
|
||||
}
|
||||
|
||||
// Shared default implementations
|
||||
|
@ -48,17 +48,17 @@ extension CallUIAdaptee {
|
|||
notificationPresenter.presentMissedCall(call.individualCall, callerName: callerName)
|
||||
}
|
||||
|
||||
internal func startAndShowOutgoingCall(address: String, hasLocalVideo: Bool) {
|
||||
internal func startAndShowOutgoingCall(publicKey: String, hasLocalVideo: Bool) {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
guard let call = self.callService.buildOutgoingIndividualCallIfPossible(
|
||||
publicKey: address,
|
||||
publicKey: publicKey,
|
||||
hasVideo: hasLocalVideo
|
||||
) else {
|
||||
// @integration This is not unexpected, it could happen if Bob tries
|
||||
// to start an outgoing call at the same moment Alice has already
|
||||
// sent him an Offer that is being processed.
|
||||
Logger.info("found an existing call when trying to start outgoing call: \(address)")
|
||||
Logger.info("found an existing call when trying to start outgoing call: \(publicKey)")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,7 @@ public class CallUIAdapter: NSObject, CallServiceObserver {
|
|||
return nil
|
||||
} else {
|
||||
Logger.info("using callkit adaptee for iOS11+")
|
||||
let preferences = Environment.shared.preferences!
|
||||
let showNames = preferences.notificationPreviewType() != .noNameNoPreview
|
||||
let useSystemCallLog = preferences.isSystemCallLogEnabled()
|
||||
|
||||
|
@ -215,10 +216,10 @@ public class CallUIAdapter: NSObject, CallServiceObserver {
|
|||
adaptee(for: call).answerCall(call)
|
||||
}
|
||||
|
||||
@objc public func startAndShowOutgoingCall(address: String, hasLocalVideo: Bool) {
|
||||
@objc public func startAndShowOutgoingCall(publicKey: String, hasLocalVideo: Bool) {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
defaultAdaptee.startAndShowOutgoingCall(address: address, hasLocalVideo: hasLocalVideo)
|
||||
defaultAdaptee.startAndShowOutgoingCall(publicKey: publicKey, hasLocalVideo: hasLocalVideo)
|
||||
}
|
||||
|
||||
internal func recipientAcceptedCall(_ call: SignalCall) {
|
||||
|
|
|
@ -36,7 +36,7 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
|
|||
private lazy var topGradientView: UIView = {
|
||||
let gradientLayer = CAGradientLayer()
|
||||
gradientLayer.colors = [
|
||||
UIColor.ows_blackAlpha60.cgColor,
|
||||
UIColor.black.withAlphaComponent(0.6).cgColor,
|
||||
UIColor.black.withAlphaComponent(0).cgColor
|
||||
]
|
||||
let view = OWSLayerView(frame: .zero) { view in
|
||||
|
@ -52,7 +52,7 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
|
|||
let gradientLayer = CAGradientLayer()
|
||||
gradientLayer.colors = [
|
||||
UIColor.black.withAlphaComponent(0).cgColor,
|
||||
UIColor.ows_blackAlpha60.cgColor
|
||||
UIColor.black.withAlphaComponent(0.6).cgColor
|
||||
]
|
||||
let view = OWSLayerView(frame: .zero) { view in
|
||||
gradientLayer.frame = view.bounds
|
||||
|
|
|
@ -33,3 +33,32 @@ public extension NSObject {
|
|||
AppEnvironment.shared.outboundIndividualCallInitiatorRef
|
||||
}
|
||||
}
|
||||
|
||||
public protocol Dependencies { }
|
||||
|
||||
public extension Dependencies {
|
||||
|
||||
var individualCallUIAdapter: CallUIAdapter {
|
||||
AppEnvironment.shared.callServiceRef.individualCallService.callUIAdapter
|
||||
}
|
||||
|
||||
static var individualCallUIAdapter: CallUIAdapter {
|
||||
AppEnvironment.shared.callServiceRef.individualCallService.callUIAdapter
|
||||
}
|
||||
|
||||
var callService: CallService {
|
||||
AppEnvironment.shared.callServiceRef
|
||||
}
|
||||
|
||||
static var callService: CallService {
|
||||
AppEnvironment.shared.callServiceRef
|
||||
}
|
||||
|
||||
var outboundIndividualCallInitiator: OutboundIndividualCallInitiator {
|
||||
AppEnvironment.shared.outboundIndividualCallInitiatorRef
|
||||
}
|
||||
|
||||
static var outboundIndividualCallInitiator: OutboundIndividualCallInitiator {
|
||||
AppEnvironment.shared.outboundIndividualCallInitiatorRef
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#import "OWSWindowManager.h"
|
||||
#import "PrivacySettingsTableViewController.h"
|
||||
#import "OWSQRCodeScanningViewController.h"
|
||||
#import "RemoteVideoView.h"
|
||||
#import "SignalApp.h"
|
||||
#import "UIViewController+Permissions.h"
|
||||
#import <PureLayout/PureLayout.h>
|
||||
|
|
Loading…
Reference in New Issue