misc: cleanup conversation

Change-Id: I2fb43e22ba78784e798c01741d3a6bf9823eacff
diff --git a/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift b/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift
index d023bef..a177947 100644
--- a/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift
+++ b/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift
@@ -190,7 +190,7 @@
         let name = item.profileName.value.isEmpty ? item.userName.value : item.profileName.value
         conversationViewModel.displayName.accept(name)
         conversationViewModel.profileImageData.accept(item.profileImageData.value)
-        conversationViewModel.conversation = BehaviorRelay<ConversationModel>(value: conversation)
+        conversationViewModel.conversation = conversation
         conversationViewModel.request = item.request
         self.stateSubject.onNext(ConversationState.conversationDetail(conversationViewModel: conversationViewModel))
     }
diff --git a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
index 3985cfd..a71591f 100644
--- a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
+++ b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
@@ -115,7 +115,7 @@
         let transferHelper = TransferHelper(dataTransferService: self.viewModel.dataTransferService,
                                             conversationViewModel: self.viewModel)
         let swiftUIModel = MessagesListVM(injectionBag: self.viewModel.injectionBag,
-                                          conversation: self.viewModel.conversation.value,
+                                          conversation: self.viewModel.conversation,
                                           transferHelper: transferHelper,
                                           bestName: self.viewModel.bestName,
                                           screenTapped: tapAction.asObservable())
@@ -189,7 +189,7 @@
             .observe(on: MainScheduler.instance)
             .subscribe { [weak self, weak swiftUIModel] update in
                 guard let self = self, let swiftUIModel = swiftUIModel, update else { return }
-                swiftUIModel.conversation = self.viewModel.conversation.value
+                swiftUIModel.conversation = self.viewModel.conversation
             } onError: { _ in
             }
             .disposed(by: self.disposeBag)
@@ -550,7 +550,7 @@
 
     private func setRightNavigationButtons() {
         // do not show call buttons for swarm with multiple participants
-        if self.viewModel.conversation.value.getParticipants().count > 1 {
+        if self.viewModel.conversation.getParticipants().count > 1 {
             return
         }
         let audioCallItem = UIBarButtonItem()
@@ -633,7 +633,7 @@
                 self?.conversationInSyncLabel.text = L10n.Conversation.synchronizationMessage(nameNSString)
             })
             .disposed(by: self.disposeBag)
-        self.conversationInSyncLabel.backgroundColor = UIColor(hexString: self.viewModel.conversation.value.preferences.color)
+        self.conversationInSyncLabel.backgroundColor = UIColor(hexString: self.viewModel.conversation.preferences.color)
     }
 
     func placeCall() {
diff --git a/Ring/Ring/Features/Conversations/Conversation/ConversationViewModel.swift b/Ring/Ring/Features/Conversations/Conversation/ConversationViewModel.swift
index b5df818..f247b39 100644
--- a/Ring/Ring/Features/Conversations/Conversation/ConversationViewModel.swift
+++ b/Ring/Ring/Features/Conversations/Conversation/ConversationViewModel.swift
@@ -82,8 +82,8 @@
             .sharedResponseStream
             .filter({ [weak self] (event) -> Bool in
                 return event.eventType == ServiceEventType.messageTypingIndicator &&
-                    event.getEventInput(ServiceEventInput.accountId) == self?.conversation.value.accountId &&
-                    event.getEventInput(ServiceEventInput.peerUri) == self?.conversation.value.hash
+                event.getEventInput(ServiceEventInput.accountId) == self?.conversation.accountId &&
+                event.getEventInput(ServiceEventInput.peerUri) == self?.conversation.hash
             })
             .map({ (event) -> Bool in
                 if let status: Int = event.getEventInput(ServiceEventInput.state), status == 1 {
@@ -93,7 +93,7 @@
             })
     }()
 
-    private var isJamsAccount: Bool { self.accountService.isJams(for: self.conversation.value.accountId) }
+    private var isJamsAccount: Bool { self.accountService.isJams(for: self.conversation.accountId) }
 
     var isAccountSip: Bool = false
 
@@ -131,11 +131,11 @@
     }
 
     private func setConversation(_ conversation: ConversationModel) {
-        if self.conversation != nil {
-            self.conversation.accept(conversation)
-        } else {
-            self.conversation = BehaviorRelay(value: conversation)
-        }
+       // if self.conversation != nil {
+            self.conversation = conversation
+//        } else {
+//            self.conversation = BehaviorRelay(value: conversation)
+//        }
     }
 
     convenience init(with injectionBag: InjectionBag, conversation: ConversationModel, user: JamiSearchViewModel.JamsUserSearchModel) {
@@ -154,20 +154,20 @@
         }
     }
 
-    var conversation: BehaviorRelay<ConversationModel>! {
+    var conversation: ConversationModel! {
         didSet {
             self.subscribeUnreadMessages()
             self.subscribeProfileServiceMyPhoto()
 
-            guard let account = self.accountService.getAccount(fromAccountId: self.conversation.value.accountId) else { return }
+            guard let account = self.accountService.getAccount(fromAccountId: self.conversation.accountId) else { return }
             if account.type == AccountType.sip {
-                self.userName.accept(self.conversation.value.hash)
+                self.userName.accept(self.conversation.hash)
                 self.isAccountSip = true
                 self.subscribeLastMessagesUpdate()
                 return
             }
             ///
-            let showInv = self.request != nil || self.conversation.value.id.isEmpty
+            let showInv = self.request != nil || self.conversation.id.isEmpty
             if self.showInvitation.value != showInv {
                 self.showInvitation.accept(showInv)
             }
@@ -176,22 +176,22 @@
             if self.shouldCreateSwarmInfo() {
                 self.createSwarmInfo()
             } else {
-                let filterParicipants = conversation.value.getParticipants()
+                let filterParicipants = conversation.getParticipants()
                 if let participantId = filterParicipants.first?.jamiId,
                    let contact = self.contactsService.contact(withHash: participantId) {
                     self.subscribeNonSwarmProfiles(uri: "ring:" + participantId,
-                                                   accountId: self.conversation.value.accountId)
+                                                   accountId: self.conversation.accountId)
                     if let contactUserName = contact.userName {
                         self.userName.accept(contactUserName)
                     } else if self.userName.value.isEmpty {
                         self.userName.accept(filterParicipants.first?.jamiId ?? "")
                         self.subscribeUserServiceLookupStatus()
-                        self.nameService.lookupAddress(withAccount: self.conversation.value.accountId, nameserver: "", address: filterParicipants.first?.jamiId ?? "")
+                        self.nameService.lookupAddress(withAccount: self.conversation.accountId, nameserver: "", address: filterParicipants.first?.jamiId ?? "")
                     }
                 } else {
                     self.userName.accept(filterParicipants.first?.jamiId ?? "")
                     self.subscribeUserServiceLookupStatus()
-                    self.nameService.lookupAddress(withAccount: self.conversation.value.accountId, nameserver: "", address: filterParicipants.first?.jamiId ?? "")
+                    self.nameService.lookupAddress(withAccount: self.conversation.accountId, nameserver: "", address: filterParicipants.first?.jamiId ?? "")
                 }
                 /*
                  By default, a conversation is created as non-swarm. Upon receiving the conversationReady
@@ -211,8 +211,8 @@
             let innerObservable = conversation.synchronizing
             return innerObservable
         }
-        syncObservable
-            .startWith(self.conversation.value.synchronizing.value)
+        syncObservable?
+            .startWith(self.conversation.synchronizing.value)
             .subscribe { [weak self] synchronizing in
                 guard let self = self else { return }
                 self.synchronizing.accept(synchronizing)
@@ -229,7 +229,7 @@
                  Check if the conversation, originally created as non-swarm,
                  becomes a swarm after an update. If so, update the relevant information.
                  */
-                if conversationId == self.conversation.value.id {
+                if conversationId == self.conversation.id {
                     if self.shouldCreateSwarmInfo() {
                         self.createSwarmInfo()
                     }
@@ -240,11 +240,11 @@
     }
 
     func shouldCreateSwarmInfo() -> Bool {
-        return self.conversation.value.isSwarm() && self.swarmInfo == nil && !self.conversation.value.id.isEmpty
+        return self.conversation.isSwarm() && self.swarmInfo == nil && !self.conversation.id.isEmpty
     }
 
     func createSwarmInfo() {
-        self.swarmInfo = SwarmInfo(injectionBag: self.injectionBag, conversation: self.conversation.value)
+        self.swarmInfo = SwarmInfo(injectionBag: self.injectionBag, conversation: self.conversation)
         self.swarmInfo!.finalAvatar.share()
             .observe(on: MainScheduler.instance)
             .subscribe { [weak self] image in
@@ -281,9 +281,9 @@
     }
 
     private func subscribeLastMessagesUpdate() {
-        conversation.value.newMessages
+        conversation.newMessages
             .subscribe { [weak self] _ in
-                guard let self = self, let lastMessage = self.conversation.value.lastMessage else { return }
+                guard let self = self, let lastMessage = self.conversation.lastMessage else { return }
                 self.lastMessage.accept(lastMessage.content)
                 let lastMessageDate = lastMessage.receivedDate
                 let dateToday = Date()
@@ -331,15 +331,16 @@
 
     var hideNewMessagesLabel = BehaviorRelay<Bool>(value: true)
 
-    var hideDate: Bool { self.conversation.value.messages.isEmpty }
+    var hideDate: Bool { self.conversation.messages.isEmpty }
 
     func editMessage(content: String, messageId: String) {
-        let conversation = self.conversation.value
+        guard let conversation = self.conversation else { return }
         self.conversationsService.editSwarmMessage(conversationId: conversation.id, accountId: conversation.accountId, message: content, parentId: messageId)
     }
 
     func sendMessage(withContent content: String, parentId: String = "", contactURI: String? = nil, conversationModel: ConversationModel? = nil) {
-        let conversation = conversationModel ?? self.conversation.value
+        let conversation = conversationModel ?? self.conversation
+        guard let conversation = conversation else { return }
         if !conversation.isSwarm() {
             /// send not swarm message
             guard let participantJamiId = conversation.getParticipants().first?.jamiId,
@@ -370,7 +371,7 @@
         guard let account = self.accountService.currentAccount,
               let ringId = AccountModelHelper(withAccount: account).ringId else { return }
         self.conversationsService
-            .setMessagesAsRead(forConversation: self.conversation.value,
+            .setMessagesAsRead(forConversation: self.conversation,
                                accountId: account.id,
                                accountURI: ringId)
             .subscribe(on: ConcurrentDispatchQueueScheduler(qos: .background))
@@ -382,20 +383,20 @@
         DispatchQueue.global(qos: .userInitiated).async { [weak self] in
             guard let self = self else { return }
             self.conversationsService
-                .setMessageAsRead(conversation: self.conversation.value,
+                .setMessageAsRead(conversation: self.conversation,
                                   messageId: messageId,
                                   daemonId: daemonId)
         }
     }
 
     func startCall() {
-        guard let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return }
+        guard let jamiId = self.conversation.getParticipants().first?.jamiId else { return }
         self.closeAllPlayers()
         self.stateSubject.onNext(ConversationState.startCall(contactRingId: jamiId, userName: self.displayName.value ?? self.userName.value))
     }
 
     func startAudioCall() {
-        guard let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return }
+        guard let jamiId = self.conversation.getParticipants().first?.jamiId else { return }
         self.closeAllPlayers()
         self.stateSubject.onNext(ConversationState.startAudioCall(contactRingId: jamiId, userName: self.displayName.value ?? self.userName.value))
     }
@@ -405,13 +406,13 @@
             return
         }
         self.closeAllPlayers()
-        let isSwarmConversation = conversation.value.type != .nonSwarm && conversation.value.type != .sip
+        let isSwarmConversation = conversation.type != .nonSwarm && conversation.type != .sip
         if isSwarmConversation {
             if let swarmInfo = self.swarmInfo {
                 self.stateSubject.onNext(ConversationState.presentSwarmInfo(swarmInfo: swarmInfo))
             }
         } else {
-            self.stateSubject.onNext(ConversationState.contactDetail(conversationViewModel: self.conversation.value))
+            self.stateSubject.onNext(ConversationState.contactDetail(conversationViewModel: self.conversation))
         }
     }
 
@@ -419,7 +420,7 @@
         closeAllPlayers()
         DispatchQueue.main.async { [weak self] in
             guard let self = self else { return }
-            self.stateSubject.onNext(ConversationState.recordFile(conversation: self.conversation.value, audioOnly: false))
+            self.stateSubject.onNext(ConversationState.recordFile(conversation: self.conversation, audioOnly: false))
         }
     }
 
@@ -427,16 +428,16 @@
         closeAllPlayers()
         DispatchQueue.main.async { [weak self] in
             guard let self = self else { return }
-            self.stateSubject.onNext(ConversationState.recordFile(conversation: self.conversation.value, audioOnly: true))
+            self.stateSubject.onNext(ConversationState.recordFile(conversation: self.conversation, audioOnly: true))
         }
     }
 
     func haveCurrentCall() -> Bool {
-        if !self.conversation.value.isDialog() {
+        if !self.conversation.isDialog() {
             return false
         }
-        guard let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return false }
-        return self.callService.call(participantHash: jamiId, accountID: self.conversation.value.accountId) != nil
+        guard let jamiId = self.conversation.getParticipants().first?.jamiId else { return false }
+        return self.callService.call(participantHash: jamiId, accountID: self.conversation.accountId) != nil
     }
 
     lazy var showCallButton: Observable<Bool> = {
@@ -446,12 +447,12 @@
             .asObservable()
             .filter({ [weak self] (call) -> Bool in
                 guard let self = self else { return false }
-                if !self.conversation.value.isDialog() {
+                if !self.conversation.isDialog() {
                     return false
                 }
-                guard let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return false }
+                guard let jamiId = self.conversation.getParticipants().first?.jamiId else { return false }
                 return call.paricipantHash() == jamiId
-                    && call.accountId == self.conversation.value.accountId
+                    && call.accountId == self.conversation.accountId
             })
             .map({ [weak self]  call in
                 guard let self = self else { return false }
@@ -484,8 +485,8 @@
 
     func openCall() {
         guard let call = self.callService
-                .call(participantHash: self.conversation.value.getParticipants().first?.jamiId ?? "",
-                      accountID: self.conversation.value.accountId) else { return }
+                .call(participantHash: self.conversation.getParticipants().first?.jamiId ?? "",
+                      accountID: self.conversation.accountId) else { return }
 
         self.stateSubject.onNext(ConversationState.navigateToCall(call: call))
     }
@@ -501,7 +502,7 @@
         //        composingMessage = isComposing
         //        guard let account = self.accountService.currentAccount else { return }
         //        conversationsService
-        //            .setIsComposingMsg(to: self.conversation.value.participantUri,
+        //            .setIsComposingMsg(to: self.conversation.participantUri,
         //                               from: account.id,
         //                               isComposing: isComposing)
     }
@@ -515,7 +516,7 @@
         //        let msgModel = MessageModel(withId: "",
         //                                    receivedDate: Date(),
         //                                    content: "       ",
-        //                                    authorURI: self.conversation.value.participantUri,
+        //                                    authorURI: self.conversation.participantUri,
         //                                    incoming: true)
         //        let composingIndicator = MessageViewModel(withInjectionBag: self.injectionBag, withMessage: msgModel, isLastDisplayed: false)
         //        composingIndicator.isComposingIndicator = true
@@ -551,13 +552,13 @@
         let name = self.displayName.value?.isEmpty ?? true ? self.userName.value : self.displayName.value ?? ""
         let handler: ((String) -> Void) = { [weak self] conversationId in
             guard let self = self else { return }
-            guard let conversation = self.conversationsService.getConversationForId(conversationId: conversationId, accountId: self.conversation.value.accountId),
+            guard let conversation = self.conversationsService.getConversationForId(conversationId: conversationId, accountId: self.conversation.accountId),
                   !conversationId.isEmpty else {
                 self.shouldDismiss.accept(true)
                 return
             }
             self.request = nil
-            self.conversation.accept(conversation)
+            self.conversation = conversation
             self.conversationCreated.accept(true)
             if self.showInvitation.value {
                 self.showInvitation.accept(false)
@@ -566,13 +567,13 @@
         if let request = self.request {
             // show incoming request
             self.stateSubject.onNext(ConversationState.openIncomingInvitationView(displayName: name, request: request, parentView: parentView, invitationHandeledCB: handler))
-        } else if self.conversation.value.id.isEmpty {
+        } else if self.conversation.id.isEmpty {
             // send invitation for search result
-            let alias = (self.conversation.value.type == .jams ? self.displayName.value : "") ?? ""
+            let alias = (self.conversation.type == .jams ? self.displayName.value : "") ?? ""
             self.stateSubject.onNext(ConversationState
                                         .openOutgoingInvitationView(displayName: name, alias: alias, avatar: self.profileImageData.value,
-                                                                    contactJamiId: self.conversation.value.hash,
-                                                                    accountId: self.conversation.value.accountId,
+                                                                    contactJamiId: self.conversation.hash,
+                                                                    accountId: self.conversation.accountId,
                                                                     parentView: parentView,
                                                                     invitationHandeledCB: handler))
         }
@@ -597,11 +598,11 @@
     }
 
     private func subscribePresenceServiceContactPresence() {
-        if !self.conversation.value.isDialog() {
+        if !self.conversation.isDialog() {
             return
         }
         // subscribe to presence updates for the conversation's associated contact
-        if let jamiId = self.conversation.value.getParticipants().first?.jamiId, let contactPresence = self.presenceService.getSubscriptionsForContact(contactId: jamiId) {
+        if let jamiId = self.conversation.getParticipants().first?.jamiId, let contactPresence = self.presenceService.getSubscriptionsForContact(contactId: jamiId) {
             self.contactPresence = contactPresence
         } else {
             self.contactPresence.accept(.offline)
@@ -609,19 +610,20 @@
                 .sharedResponseStream
                 .filter({ [weak self] serviceEvent in
                     guard let uri: String = serviceEvent.getEventInput(ServiceEventInput.uri),
-                          let accountID: String = serviceEvent.getEventInput(ServiceEventInput.accountId) else { return false }
-                    return uri == self?.conversation.value.getParticipants().first?.jamiId && accountID == self?.conversation.value.accountId
+                          let accountID: String = serviceEvent.getEventInput(ServiceEventInput.accountId),
+                    let conversation = self?.conversation else { return false }
+                    return uri == conversation.getParticipants().first?.jamiId && accountID == conversation.accountId
                 })
                 .subscribe(onNext: { [weak self] _ in
                     self?.subscribePresence()
                 })
                 .disposed(by: self.disposeBag)
-            self.presenceService.subscribeBuddy(withAccountId: self.conversation.value.accountId, withUri: self.conversation.value.getParticipants().first!.jamiId, withFlag: true)
+            self.presenceService.subscribeBuddy(withAccountId: self.conversation.accountId, withUri: self.conversation.getParticipants().first!.jamiId, withFlag: true)
         }
     }
 
     private func subscribeUnreadMessages() {
-        self.conversation.value.numberOfUnreadMessages
+        self.conversation.numberOfUnreadMessages
             .subscribe { [weak self] unreadMessages in
                 guard let self = self else { return }
                 self.hideNewMessagesLabel.accept(unreadMessages == 0)
@@ -632,7 +634,7 @@
     }
 
     private func subscribePresence() {
-        guard let jamiId = self.conversation.value.getParticipants().first?.jamiId, self.conversation.value.isDialog() else { return }
+        guard let jamiId = self.conversation.getParticipants().first?.jamiId, self.conversation.isDialog() else { return }
         if let contactPresence = self.presenceService
             .getSubscriptionsForContact(contactId: jamiId) {
             self.contactPresence = contactPresence
@@ -642,15 +644,15 @@
     }
 
     private func subscribeUserServiceLookupStatus() {
-        let contact = self.contactsService.contact(withHash: self.conversation.value.getParticipants().first?.jamiId ?? "")
+        let contact = self.contactsService.contact(withHash: self.conversation.getParticipants().first?.jamiId ?? "")
 
         // Return an observer for the username lookup
         self.nameService
             .usernameLookupStatus
             .filter({ [weak self] lookupNameResponse in
                 return lookupNameResponse.address != nil &&
-                    (lookupNameResponse.address == self?.conversation.value.getParticipants().first?.jamiId ||
-                        lookupNameResponse.address == self?.conversation.value.getParticipants().first?.jamiId)
+                (lookupNameResponse.address == self?.conversation.getParticipants().first?.jamiId ||
+                 lookupNameResponse.address == self?.conversation.getParticipants().first?.jamiId)
             })
             .subscribe(onNext: { [weak self] lookupNameResponse in
                 if let name = lookupNameResponse.name, !name.isEmpty {
@@ -680,22 +682,22 @@
 extension ConversationViewModel {
 
     func isAlreadySharingLocation() -> Bool {
-        guard let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return true }
-        let accountId = self.conversation.value.accountId
+        guard let jamiId = self.conversation.getParticipants().first?.jamiId else { return true }
+        let accountId = self.conversation.accountId
         return self.locationSharingService.isAlreadySharing(accountId: accountId,
                                                             contactUri: jamiId)
     }
 
     func isAlreadySharingMyLocation() -> Bool {
-        guard let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return true }
-        let accountId = self.conversation.value.accountId
+        guard let jamiId = self.conversation.getParticipants().first?.jamiId else { return true }
+        let accountId = self.conversation.accountId
         return self.locationSharingService.isAlreadySharingMyLocation(accountId: accountId,
                                                                       contactUri: jamiId)
     }
 
     func startSendingLocation(duration: TimeInterval? = nil) {
         guard let account = self.accountService.currentAccount,
-              let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return }
+              let jamiId = self.conversation.getParticipants().first?.jamiId else { return }
         self.locationSharingService.startSharingLocation(from: account.id,
                                                          to: jamiId,
                                                          duration: duration)
@@ -703,13 +705,13 @@
 
     func stopSendingLocation() {
         guard let account = self.accountService.currentAccount,
-              let jamiId = self.conversation.value.getParticipants().first?.jamiId else { return }
+              let jamiId = self.conversation.getParticipants().first?.jamiId else { return }
         self.locationSharingService.stopSharingLocation(accountId: account.id,
                                                         contactUri: jamiId)
     }
 
     func model() -> ConversationModel {
-        return self.conversation.value
+        return self.conversation
     }
 
     func subscribeLocationEvents() {
@@ -745,19 +747,19 @@
 
     private func changeConversationIfNeeded(items: [String]) {
         guard let accountId = self.accountService.currentAccount?.id else { return }
-        if items.contains(where: { $0 == self.conversation.value.id }) { return } // if items contains the current conversation, we do not need to change it
+        if items.contains(where: { $0 == self.conversation.id }) { return } // if items contains the current conversation, we do not need to change it
         guard let selectedConversationId = items.first else { return }
         self.stateSubject.onNext(ConversationState.openConversationForConversationId(conversationId: selectedConversationId, accountId: accountId, shouldOpenSmarList: true))
     }
 
     private func shareMessage(message: MessageContentVM, with conversationId: String, fileURL: URL?, fileName: String) {
         guard let accountId = self.accountService.currentAccount?.id else { return }
-        let conversationModel = self.conversationsService.getConversationForId(conversationId: conversationId, accountId: accountId) ?? self.conversation.value
+        let conversationModel = self.conversationsService.getConversationForId(conversationId: conversationId, accountId: accountId) ?? self.conversation
         if message.type != .fileTransfer {
             self.sendMessage(withContent: message.content, conversationModel: conversationModel)
             return
         }
-        if let url = fileURL {
+        if let url = fileURL, let conversationModel = conversationModel {
             if conversationModel.messages.contains(where: { $0.content == message.content }) {
                 self.sendFile(filePath: url.path, displayName: fileName, conversationModel: conversationModel)
             } else if let data = FileManager.default.contents(atPath: url.path) {
@@ -795,18 +797,18 @@
 extension ConversationViewModel {
 
     func sendFile(filePath: String, displayName: String, localIdentifier: String? = nil, conversationModel: ConversationModel? = nil) {
-        let conversation = conversationModel ?? self.conversation.value
+        guard let conversation = (conversationModel ?? self.conversation) else { return }
         self.dataTransferService.sendFile(conversation: conversation, filePath: filePath, displayName: displayName, localIdentifier: localIdentifier)
     }
 
     func sendAndSaveFile(displayName: String, imageData: Data, conversationModel: ConversationModel? = nil) {
-        let conversation = conversationModel ?? self.conversation.value
+        guard let conversation = (conversationModel ?? self.conversation) else { return }
         self.dataTransferService.sendAndSaveFile(displayName: displayName, conversation: conversation, imageData: imageData)
     }
 }
 
 extension ConversationViewModel: Equatable {
     static func == (lhs: ConversationViewModel, rhs: ConversationViewModel) -> Bool {
-        lhs.conversation.value == rhs.conversation.value
+        lhs.conversation == rhs.conversation
     }
 }
diff --git a/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift b/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift
index ad4643c..4c7d502 100644
--- a/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift
+++ b/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift
@@ -276,16 +276,16 @@
             return playerModel
         }
         let transferInfo = transferFileData
-        let name = !conversationViewModel.conversation.value.isSwarm() ? transferInfo.fileName : self.message.daemonId
+        let name = !conversationViewModel.conversation.isSwarm() ? transferInfo.fileName : self.message.daemonId
         guard let fileExtension = NSURL(fileURLWithPath: name).pathExtension else {
             return nil
         }
         if fileExtension.isMediaExtension() {
-            if conversationViewModel.conversation.value.isSwarm() {
+            if conversationViewModel.conversation.isSwarm() {
                 let path = self.dataTransferService
                     .getFileUrlForSwarm(fileName: self.message.daemonId,
-                                        accountID: conversationViewModel.conversation.value.accountId,
-                                        conversationID: conversationViewModel.conversation.value.id)
+                                        accountID: conversationViewModel.conversation.accountId,
+                                        conversationID: conversationViewModel.conversation.id)
                 let pathString = path?.path ?? ""
                 if pathString.isEmpty {
                     return nil
@@ -299,8 +299,8 @@
             var path = self.dataTransferService
                 .getFileUrlNonSwarm(fileName: name,
                                     inFolder: folderName,
-                                    accountID: conversationViewModel.conversation.value.accountId,
-                                    conversationID: conversationViewModel.conversation.value.id)
+                                    accountID: conversationViewModel.conversation.accountId,
+                                    conversationID: conversationViewModel.conversation.id)
             var pathString = path?.path ?? ""
             if pathString.isEmpty && self.message.incoming {
                 return nil
@@ -309,8 +309,8 @@
                 path = self.dataTransferService
                     .getFileUrlNonSwarm(fileName: name,
                                         inFolder: Directories.downloads.rawValue,
-                                        accountID: conversationViewModel.conversation.value.accountId,
-                                        conversationID: conversationViewModel.conversation.value.id)
+                                        accountID: conversationViewModel.conversation.accountId,
+                                        conversationID: conversationViewModel.conversation.id)
                 pathString = path?.path ?? ""
                 if pathString.isEmpty {
                     return nil
diff --git a/Ring/Ring/Features/Conversations/ConversationsCoordinator.swift b/Ring/Ring/Features/Conversations/ConversationsCoordinator.swift
index 2bac8af..b773086 100644
--- a/Ring/Ring/Features/Conversations/ConversationsCoordinator.swift
+++ b/Ring/Ring/Features/Conversations/ConversationsCoordinator.swift
@@ -206,7 +206,7 @@
         let conversation = ConversationModel(withParticipantUri: uri,
                                              accountId: account.id)
         let newConversation = ConversationViewModel(with: self.injectionBag)
-        newConversation.conversation = BehaviorRelay<ConversationModel>(value: conversation)
+        newConversation.conversation = conversation
         self.showConversation(withConversationViewModel: newConversation)
     }
 
@@ -293,7 +293,7 @@
         let controllers = navigationController.children
         for controller in controllers
         where controller.isKind(of: (ConversationViewController).self) {
-            if let conversationController = controller as? ConversationViewController, conversationController.viewModel.conversation.value == conversationModel {
+            if let conversationController = controller as? ConversationViewController, conversationController.viewModel.conversation == conversationModel {
                 navigationController.popToViewController(conversationController, animated: true)
                 conversationController.becomeFirstResponder()
                 return
@@ -311,7 +311,7 @@
         } else if let request = self.requestsService.getRequest(withId: conversationId, accountId: accountId) {
             let conversationViewModel = ConversationViewModel(with: self.injectionBag)
             let conversation = ConversationModel(request: request)
-            conversationViewModel.conversation = BehaviorRelay<ConversationModel>(value: conversation)
+            conversationViewModel.conversation =  conversation
             conversationViewModel.request = request
             self.showConversation(withConversationViewModel: conversationViewModel)
         }
@@ -339,7 +339,7 @@
             return
         }
         let conversationViewModel = ConversationViewModel(with: self.injectionBag)
-        conversationViewModel.conversation = BehaviorRelay<ConversationModel>(value: conversation)
+        conversationViewModel.conversation = conversation
         self.showConversation(withConversationViewModel: conversationViewModel)
     }
 
@@ -372,7 +372,7 @@
         for controller in viewControllers {
             if let smartController = controller as? SmartlistViewController {
                 for model in smartController.viewModel.conversationViewModels where
-                    model.conversation.value.isCoredialog() && model.conversation.value.getParticipants().first?.jamiId == jamiId {
+                model.conversation.isCoredialog() && model.conversation.getParticipants().first?.jamiId == jamiId {
                     return model
                 }
             }
@@ -385,7 +385,7 @@
         for controller in viewControllers {
             if let smartController = controller as? SmartlistViewController {
                 for model in smartController.viewModel.conversationViewModels where
-                    model.conversation.value.id == conversationId {
+                model.conversation.id == conversationId {
                     return model
                 }
             }
diff --git a/Ring/Ring/Features/Conversations/SmartList/IncognitoSmartListViewModel.swift b/Ring/Ring/Features/Conversations/SmartList/IncognitoSmartListViewModel.swift
index a2599cb..0a36ee2 100644
--- a/Ring/Ring/Features/Conversations/SmartList/IncognitoSmartListViewModel.swift
+++ b/Ring/Ring/Features/Conversations/SmartList/IncognitoSmartListViewModel.swift
@@ -85,7 +85,7 @@
     }
 
     func startCall(audioOnly: Bool) {
-        guard let conversation = self.temporaryConversation.value?.conversation.value,
+        guard let conversation = self.temporaryConversation.value?.conversation,
               let participantId = conversation.getParticipants().first?.jamiId,
               let username = self.temporaryConversation.value?.userName.value else {
             return
diff --git a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewModel.swift b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewModel.swift
index ba76e77..3796d9c 100644
--- a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewModel.swift
+++ b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewModel.swift
@@ -151,18 +151,18 @@
                     .compactMap({ conversationModel in
                         var conversationViewModel: ConversationViewModel?
                         if let foundConversationViewModel = self.conversationViewModels.filter({ conversationViewModel in
-                            return conversationViewModel.conversation.value == conversationModel
+                            return conversationViewModel.conversation == conversationModel
                         }).first {
                             conversationViewModel = foundConversationViewModel
-                            conversationViewModel?.conversation.accept(conversationModel)
-                        } else if let contactFound = self.contactFoundConversation.value, contactFound.conversation.value == conversationModel {
+                            conversationViewModel?.conversation = conversationModel
+                        } else if let contactFound = self.contactFoundConversation.value, contactFound.conversation == conversationModel {
                             conversationViewModel = contactFound
-                            conversationViewModel?.conversation = BehaviorRelay(value: conversationModel)
+                            conversationViewModel?.conversation = conversationModel
                             conversationViewModel?.conversationCreated.accept(true)
                             self.conversationViewModels.append(contactFound)
                         } else {
                             conversationViewModel = ConversationViewModel(with: self.injectionBag)
-                            conversationViewModel?.conversation = BehaviorRelay<ConversationModel>(value: conversationModel)
+                            conversationViewModel?.conversation = conversationModel
                             if let conversation = conversationViewModel {
                                 self.conversationViewModels
                                     .append(conversation)
@@ -297,7 +297,7 @@
                 guard let conversationId: String = event.getEventInput(.conversationId),
                       let accountId: String = event.getEventInput(.accountId) else { return }
                 guard let index = self?.conversationViewModels.firstIndex(where: { conversationModel in
-                    conversationModel.conversation.value.id == conversationId && conversationModel.conversation.value.accountId == accountId
+                    conversationModel.conversation.id == conversationId && conversationModel.conversation.accountId == accountId
                 }) else { return }
                 self?.conversationViewModels.remove(at: index)
             })
@@ -319,10 +319,10 @@
 
     func delete(conversationViewModel: ConversationViewModel) {
         conversationViewModel.closeAllPlayers()
-        let accountId = conversationViewModel.conversation.value.accountId
-        let conversationId = conversationViewModel.conversation.value.id
-        if conversationViewModel.conversation.value.isCoredialog(),
-           let participantId = conversationViewModel.conversation.value.getParticipants().first?.jamiId {
+        let accountId = conversationViewModel.conversation.accountId
+        let conversationId = conversationViewModel.conversation.id
+        if conversationViewModel.conversation.isCoredialog(),
+           let participantId = conversationViewModel.conversation.getParticipants().first?.jamiId {
             self.contactsService
                 .removeContact(withId: participantId,
                                ban: false,
@@ -331,7 +331,7 @@
                 .subscribe(onCompleted: { [weak self, weak conversationViewModel] in
                     guard let conversationViewModel = conversationViewModel else { return }
                     self?.conversationsService
-                        .removeConversationFromDB(conversation: conversationViewModel.conversation.value,
+                        .removeConversationFromDB(conversation: conversationViewModel.conversation,
                                                   keepConversation: false)
                 })
                 .disposed(by: self.disposeBag)
@@ -342,10 +342,10 @@
 
     func blockConversationsContact(conversationViewModel: ConversationViewModel) {
         conversationViewModel.closeAllPlayers()
-        let accountId = conversationViewModel.conversation.value.accountId
-        let conversationId = conversationViewModel.conversation.value.id
-        if conversationViewModel.conversation.value.isCoredialog(),
-           let participantId = conversationViewModel.conversation.value.getParticipants().first?.jamiId {
+        let accountId = conversationViewModel.conversation.accountId
+        let conversationId = conversationViewModel.conversation.id
+        if conversationViewModel.conversation.isCoredialog(),
+           let participantId = conversationViewModel.conversation.getParticipants().first?.jamiId {
             self.contactsService
                 .removeContact(withId: participantId,
                                ban: true,
@@ -354,7 +354,7 @@
                 .subscribe(onCompleted: { [weak self, weak conversationViewModel] in
                     guard let conversationViewModel = conversationViewModel else { return }
                     self?.conversationsService
-                        .removeConversationFromDB(conversation: conversationViewModel.conversation.value,
+                        .removeConversationFromDB(conversation: conversationViewModel.conversation,
                                                   keepConversation: false)
                 })
                 .disposed(by: self.disposeBag)
@@ -391,7 +391,7 @@
                                              hash: number)
         conversation.type = .sip
         let newConversation = ConversationViewModel(with: self.injectionBag)
-        newConversation.conversation = BehaviorRelay<ConversationModel>(value: conversation)
+        newConversation.conversation = conversation
         self.stateSubject
             .onNext(ConversationState
                         .conversationDetail(conversationViewModel:
diff --git a/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchViewModel.swift b/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchViewModel.swift
index c68b83c..4250270 100644
--- a/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchViewModel.swift
+++ b/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchViewModel.swift
@@ -346,7 +346,7 @@
         } else {
             newConversation.userName.accept(hash)
         }
-        newConversation.conversation = BehaviorRelay<ConversationModel>(value: conversation)
+        newConversation.conversation = conversation
         return newConversation
     }
 
@@ -359,7 +359,7 @@
         conversation.type = .sip
         let newConversation = ConversationViewModel(with: self.injectionBag)
         newConversation.userName.accept(trimmed)
-        newConversation.conversation = BehaviorRelay<ConversationModel>(value: conversation)
+        newConversation.conversation = conversation
         return newConversation
     }
 
diff --git a/Ring/RingTests/JamiSearchViewModelTests.swift b/Ring/RingTests/JamiSearchViewModelTests.swift
index ab48b9f..77ede1f 100644
--- a/Ring/RingTests/JamiSearchViewModelTests.swift
+++ b/Ring/RingTests/JamiSearchViewModelTests.swift
@@ -75,7 +75,7 @@
                                     withRequestsService: requestsService,
                                     withSystemService: systemService)
         conversationVM = ConversationViewModel(with: injectionBag)
-        conversationVM.conversation = BehaviorRelay(value: ConversationModel())
+        conversationVM.conversation = ConversationModel()
         dataSource = TestableFilteredDataSource(conversations: [conversationVM])
         searchViewModel = JamiSearchViewModel(with: injectionBag, source: dataSource)
     }
@@ -106,7 +106,7 @@
     func testConversationExists_ForOneToOneConversation_QueryIsHash_Exists() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         // Act
         let searchQuery = jamiId1
         let result = searchViewModel.isConversationExists(for: searchQuery)
@@ -118,7 +118,7 @@
     func testConversationExists_ForOneToOneConversation_QueryIsHash_DoesNotExist() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         // Act
         let searchQuery = jamiId2
         let result = searchViewModel.isConversationExists(for: searchQuery)
@@ -129,7 +129,7 @@
     func testConversationExists_ForOneToOneConversation_QueryIsRegisteredName_Exists() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: true, hasParticipantWithRegisteredName: true)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -142,7 +142,7 @@
     func testConversationExists_PrivateConversation_QueryIsRegisteredName_Exists() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .invitesOnly)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: true, hasParticipantWithRegisteredName: true)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -155,7 +155,7 @@
     func testConversationExists_PrivateConversation_QueryIsRegisteredName_DoesNotExist() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .invitesOnly)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: false, hasParticipantWithRegisteredName: false)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -168,7 +168,7 @@
     func testConversationExists_PrivateConversation_QueryIsHash_DoesNotExist() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .invitesOnly)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         // Act
         let searchQuery = jamiId2
         let result = searchViewModel.isConversationExists(for: searchQuery)
@@ -179,7 +179,7 @@
     func testConversationExists_PrivateConversation_QueryIsHash_Exists() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .invitesOnly)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         // Act
         let searchQuery = jamiId1
         let result = searchViewModel.isConversationExists(for: searchQuery)
@@ -190,7 +190,7 @@
     func testConversationExists_ForOneToOneConversation_QueryIsRegisteredName_DoesNotExist() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: false, hasParticipantWithRegisteredName: false)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -203,7 +203,7 @@
     func testConversationMatch_OneToOneConversation_QueryIsHash_Match() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         // Act
         let searchQuery = jamiId1
         let result = searchViewModel.isConversation(conversationVM, match: searchQuery)
@@ -214,7 +214,7 @@
     func testConversationMatch_OneToOneConversation_QueryIsRegisteredName_Match() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: true, hasParticipantWithRegisteredName: true)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -227,7 +227,7 @@
     func testConversationMatch_PrivateConversation_QueryIsRegisteredName_Match() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .invitesOnly)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: true, hasParticipantWithRegisteredName: true)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -240,7 +240,7 @@
     func testConversationMatch_SwarmConversation_QueryIsRegisteredName_DoesNotMatch() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: false, hasParticipantWithRegisteredName: false)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -254,7 +254,7 @@
         // Arrange
         let uri = JamiURI(schema: .sip, infoHash: sipTestNumber1)
         let conversation = ConversationModel(withParticipantUri: uri, accountId: "", hash: sipTestNumber1)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         conversationVM.userName.accept(sipTestNumber1)
         // Act
         let searchQuery = sipTestNumber1
@@ -267,7 +267,7 @@
         // Arrange
         let uri = JamiURI(schema: .sip, infoHash: sipTestNumber1)
         let conversation = ConversationModel(withParticipantUri: uri, accountId: "", hash: sipTestNumber1)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         conversationVM.userName.accept(sipTestNumber1)
         // Act
         let searchQuery = sipTestNumber1 + "1"
@@ -279,7 +279,7 @@
     func testConversationMatch_PrivateConversaion_QueryIsHash() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .invitesOnly)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         // Act
         let searchQuery = jamiId1
         let result = searchViewModel.isConversation(conversationVM, match: searchQuery)
@@ -290,7 +290,7 @@
     func testConversationContains_PrivateConversation_QueryIsRegisteredName_Contains() {
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .invitesOnly)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         let swarmInfo = self.createSwarmInfo(jamiId: jamiId1, name: registeredName1, containsSearchQuery: true, hasParticipantWithRegisteredName: true)
         conversationVM.swarmInfo = swarmInfo
         // Act
@@ -304,7 +304,7 @@
         // Arrange
         let uri = JamiURI(schema: .sip, infoHash: sipTestNumber1)
         let conversation = ConversationModel(withParticipantUri: uri, accountId: "", hash: sipTestNumber1)
-        conversationVM.conversation.accept(conversation)
+        conversationVM.conversation = conversation
         conversationVM.userName.accept(sipTestNumber1)
         // Act
         let searchQuery = sipTestNumber1
@@ -317,7 +317,7 @@
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
         conversationVM = ConversationViewModel(with: injectionBag)
-        conversationVM.conversation = BehaviorRelay(value: conversation)
+        conversationVM.conversation = conversation
         searchViewModel.temporaryConversation.accept(conversationVM)
         // Act
         let result = searchViewModel.temporaryConversationExists(for: jamiId1)
@@ -329,7 +329,7 @@
         // Arrange
         let conversation = self.createSwarmConversation(jamiId: jamiId1, type: .oneToOne)
         conversationVM = ConversationViewModel(with: injectionBag)
-        conversationVM.conversation = BehaviorRelay(value: conversation)
+        conversationVM.conversation = conversation
         searchViewModel.temporaryConversation.accept(conversationVM)
         // Act
         let result = searchViewModel.temporaryConversationExists(for: jamiId2)