Resolve more errors

This commit is contained in:
Niels Andriesse 2021-08-02 15:20:12 +10:00
parent 05a16da189
commit 4c98c9cc85
3 changed files with 26 additions and 27 deletions

View File

@ -2221,13 +2221,13 @@
isa = PBXGroup;
children = (
B82A0C0426B7B45200C1BCE3 /* Group */,
B82A0C1526B7B45200C1BCE3 /* Individual */,
B82A0C1026B7B45200C1BCE3 /* LocalVideoView.swift */,
B82A0C1126B7B45200C1BCE3 /* CallHeader.swift */,
B82A0C1226B7B45200C1BCE3 /* CallButton.swift */,
B82A0C1326B7B45200C1BCE3 /* CallControls.swift */,
B82A0C1426B7B45200C1BCE3 /* RemoteVideoView.h */,
B82A0C0F26B7B45200C1BCE3 /* RemoteVideoView.m */,
B82A0C1526B7B45200C1BCE3 /* Individual */,
);
path = UserInterface;
sourceTree = "<group>";
@ -2252,9 +2252,9 @@
B82A0C1526B7B45200C1BCE3 /* Individual */ = {
isa = PBXGroup;
children = (
B82A0C1826B7B45200C1BCE3 /* CallKit */,
B82A0C1626B7B45200C1BCE3 /* NonCallKitCallUIAdaptee.swift */,
B82A0C1726B7B45200C1BCE3 /* IndividualCallViewController.swift */,
B82A0C1826B7B45200C1BCE3 /* CallKit */,
B82A0C1B26B7B45200C1BCE3 /* CallUIAdapter.swift */,
);
path = Individual;

View File

@ -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: SignalServiceAddress, hasLocalVideo: Bool)
func startAndShowOutgoingCall(address: String, hasLocalVideo: Bool)
}
// Shared default implementations
@ -39,7 +39,7 @@ extension CallUIAdaptee {
let callViewController = IndividualCallViewController(call: call)
callViewController.modalTransitionStyle = .crossDissolve
OWSWindowManager.shared.startCall(callViewController)
OWSWindowManager.shared().startCall(callViewController)
}
internal func reportMissedCall(_ call: SignalCall, callerName: String) {
@ -48,11 +48,11 @@ extension CallUIAdaptee {
notificationPresenter.presentMissedCall(call.individualCall, callerName: callerName)
}
internal func startAndShowOutgoingCall(address: SignalServiceAddress, hasLocalVideo: Bool) {
internal func startAndShowOutgoingCall(address: String, hasLocalVideo: Bool) {
AssertIsOnMainThread()
guard let call = self.callService.buildOutgoingIndividualCallIfPossible(
address: address,
publicKey: address,
hasVideo: hasLocalVideo
) else {
// @integration This is not unexpected, it could happen if Bob tries
@ -140,12 +140,13 @@ public class CallUIAdapter: NSObject, CallServiceObserver {
internal func reportIncomingCall(_ call: SignalCall, thread: TSContactThread) {
AssertIsOnMainThread()
Logger.info("remoteAddress: \(call.individualCall.remoteAddress)")
Logger.info("remoteAddress: \(call.individualCall.publicKey)")
// make sure we don't terminate audio session during call
_ = audioSession.startAudioActivity(call.audioActivity)
let callerName = self.contactsManager.displayName(for: call.individualCall.remoteAddress)
let publicKey = call.individualCall.publicKey
let callerName = Storage.shared.getContact(with: publicKey)?.displayName(for: .regular) ?? publicKey
Logger.verbose("callerName: \(callerName)")
@ -181,7 +182,8 @@ public class CallUIAdapter: NSObject, CallServiceObserver {
internal func reportMissedCall(_ call: SignalCall) {
AssertIsOnMainThread()
let callerName = self.contactsManager.displayName(for: call.individualCall.remoteAddress)
let publicKey = call.individualCall.publicKey
let callerName = Storage.shared.getContact(with: publicKey)?.displayName(for: .regular) ?? publicKey
adaptee(for: call).reportMissedCall(call, callerName: callerName)
}
@ -213,7 +215,7 @@ public class CallUIAdapter: NSObject, CallServiceObserver {
adaptee(for: call).answerCall(call)
}
@objc public func startAndShowOutgoingCall(address: SignalServiceAddress, hasLocalVideo: Bool) {
@objc public func startAndShowOutgoingCall(address: String, hasLocalVideo: Bool) {
AssertIsOnMainThread()
defaultAdaptee.startAndShowOutgoingCall(address: address, hasLocalVideo: hasLocalVideo)

View File

@ -66,8 +66,7 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
// MARK: - Contact Views
private lazy var contactNameLabel = MarqueeLabel()
private lazy var contactAvatarView = ConversationAvatarView(diameterPoints: 200,
localUserDisplayMode: .asUser)
private lazy var profilePictureView = ProfilePictureView()
private lazy var contactAvatarContainerView = UIView.container()
private lazy var callStatusLabel = UILabel()
private lazy var backButton = UIButton()
@ -217,6 +216,10 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
self.shouldUseTheme = false
}
required init?(coder: NSCoder) {
preconditionFailure()
}
deinit {
// These views might be in the return to call PIP's hierarchy,
// we want to remove them so they are free'd when the call ends
@ -394,13 +397,8 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
topGradientView.addSubview(callStatusLabel)
contactAvatarContainerView.addSubview(contactAvatarView)
contactAvatarContainerView.addSubview(profilePictureView)
view.insertSubview(contactAvatarContainerView, belowSubview: localVideoView)
backButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "leaveCallViewButton")
contactNameLabel.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "contactNameLabel")
callStatusLabel.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "callStatusLabel")
contactAvatarView.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "contactAvatarView")
}
func createOngoingCallControls() {
@ -497,12 +495,7 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
@objc
func updateAvatarImage() {
databaseStorage.read { transaction in
contactAvatarView.configure(thread: thread, transaction: transaction)
backgroundAvatarView.image = contactsManagerImpl.avatarImage(forAddress: thread.contactAddress,
shouldValidate: true,
transaction: transaction)
}
profilePictureView.update(for: thread.contactSessionID())
}
func createIncomingCallControls() {
@ -600,7 +593,11 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
contactAvatarContainerView.autoPinEdge(.bottom, to: .top, of: ongoingAudioCallControls, withOffset: -avatarMargin)
contactAvatarContainerView.autoPinWidthToSuperview(withMargin: avatarMargin)
contactAvatarView.autoCenterInSuperview()
let size = Values.smallProfilePictureSize
profilePictureView.size = size
profilePictureView.set(.width, to: size)
profilePictureView.set(.height, to: size)
profilePictureView.autoCenterInSuperview()
ongoingAudioCallControls.autoPinEdge(toSuperviewEdge: .top, withInset: gradientMargin)
incomingVideoCallControls.autoPinEdge(toSuperviewEdge: .top)
@ -843,7 +840,7 @@ class IndividualCallViewController: OWSViewController, CallObserver, CallAudioSe
let hasRemoteVideo = !remoteVideoView.isHidden
remoteVideoView.isFullScreen = true
remoteVideoView.isScreenShare = call.individualCall.isRemoteSharingScreen
contactAvatarView.isHidden = hasRemoteVideo || isRenderingLocalVanityVideo
profilePictureView.isHidden = hasRemoteVideo || isRenderingLocalVanityVideo
// Layout controls immediately to avoid spurious animation.
for controls in [incomingVideoCallControls, incomingAudioCallControls, ongoingAudioCallControls, ongoingVideoCallControls] {
@ -1289,7 +1286,7 @@ extension IndividualCallViewController: UIGestureRecognizerDelegate {
extension IndividualCallViewController: CallViewControllerWindowReference {
var remoteVideoViewReference: UIView { remoteVideoView }
var localVideoViewReference: UIView { localVideoView }
var remoteVideoAddress: SignalServiceAddress { thread.contactAddress }
var remoteVideoAddress: String { thread.contactSessionID() }
@objc
public func returnFromPip(pipWindow: UIWindow) {