From a329521e1a0ea58f955190abdecd2039de459f11 Mon Sep 17 00:00:00 2001
From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
Date: Thu, 1 Jun 2023 08:23:34 -0400
Subject: [PATCH] calls: remove unnecessary call provider updates

The conversation manager updates the call provider state,
so it is not necessary to do this in the view controller as well.

Change-Id: Idacd50a068acd41740b7130dcdc0af83fa2ae23b
---
 Ring/Ring/Calls/CallViewController.swift |  4 ++--
 Ring/Ring/Calls/CallViewModel.swift      | 13 +------------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/Ring/Ring/Calls/CallViewController.swift b/Ring/Ring/Calls/CallViewController.swift
index 2db106542..24530c551 100644
--- a/Ring/Ring/Calls/CallViewController.swift
+++ b/Ring/Ring/Calls/CallViewController.swift
@@ -241,13 +241,13 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased, Con
         self.buttonsContainer.viewModel = self.viewModel.containerViewModel
         self.buttonsContainer.cancelButton.rx.tap
             .subscribe(onNext: { [weak self] in
-                self?.viewModel.cancelCall(stopProvider: true)
+                self?.viewModel.cancelCall()
                 self?.removeFromScreen()
             })
             .disposed(by: self.disposeBag)
         self.buttonsContainer.stopButton.rx.tap
             .subscribe(onNext: { [weak self] in
-                self?.viewModel.cancelCall(stopProvider: true)
+                self?.viewModel.cancelCall()
                 self?.removeFromScreen()
             })
             .disposed(by: self.disposeBag)
diff --git a/Ring/Ring/Calls/CallViewModel.swift b/Ring/Ring/Calls/CallViewModel.swift
index 4faad98c9..91ae1edec 100644
--- a/Ring/Ring/Calls/CallViewModel.swift
+++ b/Ring/Ring/Calls/CallViewModel.swift
@@ -515,18 +515,7 @@ class CallViewModel: Stateable, ViewModel {
 // MARK: actions
 extension CallViewModel {
 
-    func cancelCall(stopProvider: Bool) {
-        guard let call = self.call else {
-            return
-        }
-        if stopProvider {
-            self.callsProvider.stopCall(callUUID: call.callUUID, participant: call.paricipantHash())
-            call.participantsCallId.forEach { (callId) in
-                if let participantCall = self.callService.call(callID: callId) {
-                    self.callsProvider.stopCall(callUUID: participantCall.callUUID, participant: participantCall.paricipantHash())
-                }
-            }
-        }
+    func cancelCall() {
         self.callService
             .hangUpCallOrConference(callId: rendererId)
             .subscribe()
-- 
GitLab