From 1581795cbc9ee3d41beb1fb0b447b16682369a42 Mon Sep 17 00:00:00 2001 From: Marissa Le Coz <129999395+marissa-signal@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:19:56 -0500 Subject: [PATCH] Move joinState from IndivCall to SignalCall --- .../src/Calls/Individual/IndividualCall.swift | 28 ------------------- Signal/src/Calls/SignalCall.swift | 27 +++++++++++++++++- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/Signal/src/Calls/Individual/IndividualCall.swift b/Signal/src/Calls/Individual/IndividualCall.swift index 681805ac60..62b61eb657 100644 --- a/Signal/src/Calls/Individual/IndividualCall.swift +++ b/Signal/src/Calls/Individual/IndividualCall.swift @@ -194,34 +194,6 @@ public class IndividualCall: NSObject { } } - /// `JoinState` is a group call concept, but we want to bridge - /// between the two call types. - /// TODO: Continue to tweak this as we unify the individual and - /// group call UIs. - var joinState: JoinState { - switch self.state { - case .idle, - .remoteHangup, - .remoteHangupNeedPermission, - .localHangup, - .remoteRinging, - .localRinging_Anticipatory, - .localRinging_ReadyToAnswer, - .remoteBusy, - .localFailure, - .busyElsewhere, - .answeredElsewhere, - .declinedElsewhere: - return .notJoined - case .connected, - .accepting, - .answering, - .reconnecting, - .dialing: - return .joined - } - } - public var offerMediaType: TSRecentCallOfferType = .audio // We start out muted if the record permission isn't granted. This should generally diff --git a/Signal/src/Calls/SignalCall.swift b/Signal/src/Calls/SignalCall.swift index 007f64ded0..f60f7f61b0 100644 --- a/Signal/src/Calls/SignalCall.swift +++ b/Signal/src/Calls/SignalCall.swift @@ -128,7 +128,32 @@ public class SignalCall: NSObject, CallManagerCallReference { public var joinState: JoinState { switch mode { - case .individual(let call): return call.joinState + case .individual(let call): + /// `JoinState` is a group call concept, but we want to bridge + /// between the two call types. + /// TODO: Continue to tweak this as we unify the individual and + /// group call UIs. + switch call.state { + case .idle, + .remoteHangup, + .remoteHangupNeedPermission, + .localHangup, + .remoteRinging, + .localRinging_Anticipatory, + .localRinging_ReadyToAnswer, + .remoteBusy, + .localFailure, + .busyElsewhere, + .answeredElsewhere, + .declinedElsewhere: + return .notJoined + case .connected, + .accepting, + .answering, + .reconnecting, + .dialing: + return .joined + } case .group(let call): return call.localDeviceState.joinState } }