diff --git a/Linphone/Core/CorePreferences.swift b/Linphone/Core/CorePreferences.swift index 2926ef260..795bb7feb 100644 --- a/Linphone/Core/CorePreferences.swift +++ b/Linphone/Core/CorePreferences.swift @@ -250,6 +250,15 @@ class CorePreferences { Config.get().setString(section: "app", key: "default_domain", value: newValue) } } + + static var disableChatFeature: Bool { + get { + return Config.get().getBool(section: "app", key: "disable_chat_feature", defaultValue: false) + } + set { + Config.get().setBool(section: "app", key: "disable_chat_feature", value: newValue) + } + } private func copy(from: String, to: String, overrideIfExists: Bool = false) { let fileManager = FileManager.default diff --git a/Linphone/UI/Call/CallView.swift b/Linphone/UI/Call/CallView.swift index e2852264d..12d8bf46f 100644 --- a/Linphone/UI/Call/CallView.swift +++ b/Linphone/UI/Call/CallView.swift @@ -2191,45 +2191,47 @@ struct CallView: View { .frame(height: geo.size.height * 0.15) HStack(spacing: 0) { - VStack { - Button { - callViewModel.createConversation() - } label: { - HStack { - if !callViewModel.operationInProgress { - Image("chat-teardrop-text") - .renderingMode(.template) - .resizable() - .foregroundStyle(.white) - .frame(width: 32, height: 32) - } else { - ProgressView() - .controlSize(.mini) - .progressViewStyle(CircularProgressViewStyle(tint: .white)) - .frame(width: 32, height: 32, alignment: .center) - .onDisappear { - if SharedMainViewModel.shared.displayedConversation != nil { - SharedMainViewModel.shared.changeIndexView(indexViewInt: 2) - callViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) - SharedMainViewModel.shared.displayedConversation = nil - withAnimation { - telecomManager.callDisplayed = false + if !CorePreferences.disableChatFeature { + VStack { + Button { + callViewModel.createConversation() + } label: { + HStack { + if !callViewModel.operationInProgress { + Image("chat-teardrop-text") + .renderingMode(.template) + .resizable() + .foregroundStyle(.white) + .frame(width: 32, height: 32) + } else { + ProgressView() + .controlSize(.mini) + .progressViewStyle(CircularProgressViewStyle(tint: .white)) + .frame(width: 32, height: 32, alignment: .center) + .onDisappear { + if SharedMainViewModel.shared.displayedConversation != nil { + SharedMainViewModel.shared.changeIndexView(indexViewInt: 2) + callViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) + SharedMainViewModel.shared.displayedConversation = nil + withAnimation { + telecomManager.callDisplayed = false + } } } - } + } } } + .buttonStyle(PressedButtonStyle(buttonSize: buttonSize)) + .frame(width: buttonSize, height: buttonSize) + .background(Color.gray500) + .cornerRadius(40) + + Text("call_action_show_messages") + .foregroundStyle(.white) + .default_text_style(styleSize: 15) } - .buttonStyle(PressedButtonStyle(buttonSize: buttonSize)) - .frame(width: buttonSize, height: buttonSize) - .background(Color.gray500) - .cornerRadius(40) - - Text("call_action_show_messages") - .foregroundStyle(.white) - .default_text_style(styleSize: 15) + .frame(width: geo.size.width * 0.24, height: geo.size.width * 0.24) } - .frame(width: geo.size.width * 0.24, height: geo.size.width * 0.24) VStack { Button { @@ -2326,6 +2328,31 @@ struct CallView: View { } .frame(width: geo.size.width * 0.24, height: geo.size.width * 0.24) .hidden() + + if CorePreferences.disableChatFeature { + VStack { + Button { + } label: { + HStack { + Image("video-camera") + .renderingMode(.template) + .resizable() + .foregroundStyle(.white) + .frame(width: 32, height: 32) + } + } + .buttonStyle(PressedButtonStyle(buttonSize: buttonSize)) + .frame(width: buttonSize, height: buttonSize) + .background(Color.gray500) + .cornerRadius(40) + + Text("call_action_change_layout") + .foregroundStyle(.white) + .default_text_style(styleSize: 15) + } + .frame(width: geo.size.width * 0.24, height: geo.size.width * 0.24) + .hidden() + } } .frame(height: geo.size.height * 0.15) } else { @@ -2562,45 +2589,47 @@ struct CallView: View { .frame(width: geo.size.width * 0.125, height: geo.size.width * 0.125) } - VStack { - Button { - callViewModel.createConversation() - } label: { - HStack { - if !callViewModel.operationInProgress { - Image("chat-teardrop-text") - .renderingMode(.template) - .resizable() - .foregroundStyle(.white) - .frame(width: 32, height: 32) - } else { - ProgressView() - .controlSize(.mini) - .progressViewStyle(CircularProgressViewStyle(tint: .white)) - .frame(width: 32, height: 32, alignment: .center) - .onDisappear { - if SharedMainViewModel.shared.displayedConversation != nil { - SharedMainViewModel.shared.changeIndexView(indexViewInt: 2) - callViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) - SharedMainViewModel.shared.displayedConversation = nil - withAnimation { - telecomManager.callDisplayed = false + if !CorePreferences.disableChatFeature { + VStack { + Button { + callViewModel.createConversation() + } label: { + HStack { + if !callViewModel.operationInProgress { + Image("chat-teardrop-text") + .renderingMode(.template) + .resizable() + .foregroundStyle(.white) + .frame(width: 32, height: 32) + } else { + ProgressView() + .controlSize(.mini) + .progressViewStyle(CircularProgressViewStyle(tint: .white)) + .frame(width: 32, height: 32, alignment: .center) + .onDisappear { + if SharedMainViewModel.shared.displayedConversation != nil { + SharedMainViewModel.shared.changeIndexView(indexViewInt: 2) + callViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) + SharedMainViewModel.shared.displayedConversation = nil + withAnimation { + telecomManager.callDisplayed = false + } } } - } + } } } + .buttonStyle(PressedButtonStyle(buttonSize: buttonSize)) + .frame(width: buttonSize, height: buttonSize) + .background(Color.gray500) + .cornerRadius(40) + + Text("call_action_show_messages") + .foregroundStyle(.white) + .default_text_style(styleSize: 15) } - .buttonStyle(PressedButtonStyle(buttonSize: buttonSize)) - .frame(width: buttonSize, height: buttonSize) - .background(Color.gray500) - .cornerRadius(40) - - Text("call_action_show_messages") - .foregroundStyle(.white) - .default_text_style(styleSize: 15) + .frame(width: geo.size.width * 0.125, height: geo.size.width * 0.125) } - .frame(width: geo.size.width * 0.125, height: geo.size.width * 0.125) VStack { Button { diff --git a/Linphone/UI/Main/Contacts/Fragments/ContactInnerFragment.swift b/Linphone/UI/Main/Contacts/Fragments/ContactInnerFragment.swift index 3afe36d3f..5798a0311 100644 --- a/Linphone/UI/Main/Contacts/Fragments/ContactInnerFragment.swift +++ b/Linphone/UI/Main/Contacts/Fragments/ContactInnerFragment.swift @@ -171,40 +171,42 @@ struct ContactInnerFragment: View { } }) .disabled(contactAvatarModel.address.isEmpty) - - Spacer() - - Button(action: { - if contactAvatarModel.addresses.count <= 1 { - do { - let address = try Factory.Instance.createAddress(addr: contactAvatarModel.address) - contactsListViewModel.createOneToOneChatRoomWith(remote: address) - } catch { - Log.error("[ContactInnerFragment] unable to create address for a new outgoing call : \(contactAvatarModel.address) \(error) ") - } - } else { - isShowSipAddressesPopupType = 1 - isShowSipAddressesPopup = true - } - }, label: { - VStack { - HStack(alignment: .center) { - Image("chat-teardrop-text") - .renderingMode(.template) - .resizable() - .foregroundStyle(contactAvatarModel.address.isEmpty ? Color.grayMain2c400 : Color.grayMain2c600) - .frame(width: 25, height: 25) - } - .padding(16) - .background(contactAvatarModel.address.isEmpty ? Color.grayMain2c100 : Color.grayMain2c200) - .cornerRadius(40) - - Text("contact_message_action") - .default_text_style(styleSize: 14) - } - }) - .disabled(contactAvatarModel.address.isEmpty) - + + if !CorePreferences.disableChatFeature { + Spacer() + + Button(action: { + if contactAvatarModel.addresses.count <= 1 { + do { + let address = try Factory.Instance.createAddress(addr: contactAvatarModel.address) + contactsListViewModel.createOneToOneChatRoomWith(remote: address) + } catch { + Log.error("[ContactInnerFragment] unable to create address for a new outgoing call : \(contactAvatarModel.address) \(error) ") + } + } else { + isShowSipAddressesPopupType = 1 + isShowSipAddressesPopup = true + } + }, label: { + VStack { + HStack(alignment: .center) { + Image("chat-teardrop-text") + .renderingMode(.template) + .resizable() + .foregroundStyle(contactAvatarModel.address.isEmpty ? Color.grayMain2c400 : Color.grayMain2c600) + .frame(width: 25, height: 25) + } + .padding(16) + .background(contactAvatarModel.address.isEmpty ? Color.grayMain2c100 : Color.grayMain2c200) + .cornerRadius(40) + + Text("contact_message_action") + .default_text_style(styleSize: 14) + } + }) + .disabled(contactAvatarModel.address.isEmpty) + } + Spacer() Button(action: { diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index febe01e07..37dde86b2 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -245,53 +245,55 @@ struct ContentView: View { } .frame(height: geometry.size.height/4) - ZStack { - if let contactsListVM = conversationsListViewModel, contactsListVM.unreadMessages > 0 { - VStack { - HStack { - Text( - contactsListVM.unreadMessages < 99 - ? String(contactsListVM.unreadMessages) - : "99+" - ) - .foregroundStyle(.white) - .default_text_style(styleSize: 10) - .lineLimit(1) - } - .frame(width: 18, height: 18) - .background(Color.redDanger500) - .cornerRadius(50) - } - .padding(.bottom, 30) - .padding(.leading, 30) - } - - Button(action: { - sharedMainViewModel.changeIndexView(indexViewInt: 2) - sharedMainViewModel.displayedFriend = nil - sharedMainViewModel.displayedCall = nil - sharedMainViewModel.displayedMeeting = nil - }, label: { - VStack { - Image("chat-teardrop-text") - .renderingMode(.template) - .resizable() - .foregroundStyle(sharedMainViewModel.indexView == 2 ? Color.orangeMain500 : Color.grayMain2c600) - .frame(width: 25, height: 25) - - if sharedMainViewModel.indexView == 2 { - Text("bottom_navigation_conversations_label") - .default_text_style_700(styleSize: 10) - } else { - Text("bottom_navigation_conversations_label") - .default_text_style(styleSize: 10) - } - } - }) - .padding(.top) - } - .frame(height: geometry.size.height/4) - + if !CorePreferences.disableChatFeature { + ZStack { + if let contactsListVM = conversationsListViewModel, contactsListVM.unreadMessages > 0 { + VStack { + HStack { + Text( + contactsListVM.unreadMessages < 99 + ? String(contactsListVM.unreadMessages) + : "99+" + ) + .foregroundStyle(.white) + .default_text_style(styleSize: 10) + .lineLimit(1) + } + .frame(width: 18, height: 18) + .background(Color.redDanger500) + .cornerRadius(50) + } + .padding(.bottom, 30) + .padding(.leading, 30) + } + + Button(action: { + sharedMainViewModel.changeIndexView(indexViewInt: 2) + sharedMainViewModel.displayedFriend = nil + sharedMainViewModel.displayedCall = nil + sharedMainViewModel.displayedMeeting = nil + }, label: { + VStack { + Image("chat-teardrop-text") + .renderingMode(.template) + .resizable() + .foregroundStyle(sharedMainViewModel.indexView == 2 ? Color.orangeMain500 : Color.grayMain2c600) + .frame(width: 25, height: 25) + + if sharedMainViewModel.indexView == 2 { + Text("bottom_navigation_conversations_label") + .default_text_style_700(styleSize: 10) + } else { + Text("bottom_navigation_conversations_label") + .default_text_style(styleSize: 10) + } + } + }) + .padding(.top) + } + .frame(height: geometry.size.height/4) + } + Button(action: { sharedMainViewModel.changeIndexView(indexViewInt: 3) sharedMainViewModel.displayedFriend = nil @@ -803,56 +805,58 @@ struct ContentView: View { .padding(.top) .frame(width: 66) } - - Spacer() - - ZStack { - if let conversationsListVM = conversationsListViewModel, conversationsListVM.unreadMessages > 0 { - VStack { - HStack { - Text( - conversationsListVM.unreadMessages < 99 - ? String(conversationsListVM.unreadMessages) - : "99+" - ) - .foregroundStyle(.white) - .default_text_style(styleSize: 10) - .lineLimit(1) - } - .frame(width: 18, height: 18) - .background(Color.redDanger500) - .cornerRadius(50) - } - .padding(.bottom, 30) - .padding(.leading, 30) - } - - Button(action: { - sharedMainViewModel.changeIndexView(indexViewInt: 2) - sharedMainViewModel.displayedFriend = nil - sharedMainViewModel.displayedCall = nil - sharedMainViewModel.displayedMeeting = nil - }, label: { - VStack { - Image("chat-teardrop-text") - .renderingMode(.template) - .resizable() - .foregroundStyle(sharedMainViewModel.indexView == 2 ? Color.orangeMain500 : Color.grayMain2c600) - .frame(width: 25, height: 25) - - if sharedMainViewModel.indexView == 2 { - Text("bottom_navigation_conversations_label") - .default_text_style_700(styleSize: 9) - } else { - Text("bottom_navigation_conversations_label") - .default_text_style(styleSize: 9) - } - } - }) - .padding(.top) - .frame(width: 66) - } - + + if !CorePreferences.disableChatFeature { + Spacer() + + ZStack { + if let conversationsListVM = conversationsListViewModel, conversationsListVM.unreadMessages > 0 { + VStack { + HStack { + Text( + conversationsListVM.unreadMessages < 99 + ? String(conversationsListVM.unreadMessages) + : "99+" + ) + .foregroundStyle(.white) + .default_text_style(styleSize: 10) + .lineLimit(1) + } + .frame(width: 18, height: 18) + .background(Color.redDanger500) + .cornerRadius(50) + } + .padding(.bottom, 30) + .padding(.leading, 30) + } + + Button(action: { + sharedMainViewModel.changeIndexView(indexViewInt: 2) + sharedMainViewModel.displayedFriend = nil + sharedMainViewModel.displayedCall = nil + sharedMainViewModel.displayedMeeting = nil + }, label: { + VStack { + Image("chat-teardrop-text") + .renderingMode(.template) + .resizable() + .foregroundStyle(sharedMainViewModel.indexView == 2 ? Color.orangeMain500 : Color.grayMain2c600) + .frame(width: 25, height: 25) + + if sharedMainViewModel.indexView == 2 { + Text("bottom_navigation_conversations_label") + .default_text_style_700(styleSize: 9) + } else { + Text("bottom_navigation_conversations_label") + .default_text_style(styleSize: 9) + } + } + }) + .padding(.top) + .frame(width: 66) + } + } + Spacer() Button(action: { sharedMainViewModel.changeIndexView(indexViewInt: 3) @@ -1137,49 +1141,55 @@ struct ContentView: View { .zIndex(3) .onDisappear { if let contactsListVM = contactsListViewModel, let displayedConversation = contactsListVM.displayedConversation { - sharedMainViewModel.displayedFriend = nil - sharedMainViewModel.displayedCall = nil - sharedMainViewModel.changeIndexView(indexViewInt: 2) - - if let conversationsListVM = self.conversationsListViewModel { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - withAnimation { - conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) - } - contactsListVM.displayedConversation = nil - } - } else { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - if let conversationsListVM = self.conversationsListViewModel { - withAnimation { - conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) - } - } - contactsListVM.displayedConversation = nil - } - } + + if !CorePreferences.disableChatFeature { + sharedMainViewModel.displayedFriend = nil + sharedMainViewModel.displayedCall = nil + sharedMainViewModel.changeIndexView(indexViewInt: 2) + + if let conversationsListVM = self.conversationsListViewModel { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + withAnimation { + conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) + } + contactsListVM.displayedConversation = nil + } + } else { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + if let conversationsListVM = self.conversationsListViewModel { + withAnimation { + conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) + } + } + contactsListVM.displayedConversation = nil + } + } + } } else if let historyListVM = historyListViewModel, let displayedConversation = historyListVM.displayedConversation { - sharedMainViewModel.displayedFriend = nil - sharedMainViewModel.displayedCall = nil - sharedMainViewModel.changeIndexView(indexViewInt: 2) - - if let conversationsListVM = self.conversationsListViewModel { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - withAnimation { - conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) - } - historyListVM.displayedConversation = nil - } - } else { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - if let conversationsListVM = self.conversationsListViewModel { - withAnimation { - conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) - } - } - historyListVM.displayedConversation = nil - } - } + + if !CorePreferences.disableChatFeature { + sharedMainViewModel.displayedFriend = nil + sharedMainViewModel.displayedCall = nil + sharedMainViewModel.changeIndexView(indexViewInt: 2) + + if let conversationsListVM = self.conversationsListViewModel { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + withAnimation { + conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) + } + historyListVM.displayedConversation = nil + } + } else { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + if let conversationsListVM = self.conversationsListViewModel { + withAnimation { + conversationsListVM.changeDisplayedChatRoom(conversationModel: displayedConversation) + } + } + historyListVM.displayedConversation = nil + } + } + } } } } @@ -1227,7 +1237,7 @@ struct ContentView: View { if let meetingsListVM = meetingsListViewModel, isShowSendCancelMeetingNotificationPopup { PopupView(isShowPopup: $isShowSendCancelMeetingNotificationPopup, title: Text("meeting_schedule_cancel_dialog_title"), - content: Text("meeting_schedule_cancel_dialog_message"), + content: !CorePreferences.disableChatFeature ? Text("meeting_schedule_cancel_dialog_message") : Text(""), titleFirstButton: Text("dialog_cancel"), actionFirstButton: { sharedMainViewModel.displayedMeeting = nil @@ -1321,7 +1331,9 @@ struct ContentView: View { } .onChange(of: navigationManager.selectedCallId) { newCallId in if newCallId != nil { - sharedMainViewModel.changeIndexView(indexViewInt: 2) + if !CorePreferences.disableChatFeature { + sharedMainViewModel.changeIndexView(indexViewInt: 2) + } } } .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ContactLoaded"))) { _ in diff --git a/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift b/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift index b447b9c5e..29d217684 100644 --- a/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift +++ b/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift @@ -259,30 +259,32 @@ struct HistoryContactFragment: View { .frame(minWidth: 80) } }) - - Spacer() - - Button(action: { - historyListViewModel.createOneToOneChatRoomWith(remote: historyModel.addressLinphone) - }, label: { - VStack { - HStack(alignment: .center) { - Image("chat-teardrop-text") - .renderingMode(.template) - .resizable() - .foregroundStyle(Color.grayMain2c600) - .frame(width: 25, height: 25) - } - .padding(16) - .background(Color.grayMain2c200) - .cornerRadius(40) - - Text("contact_message_action") - .default_text_style(styleSize: 14) - .frame(minWidth: 80) - } - }) - + + if !CorePreferences.disableChatFeature { + Spacer() + + Button(action: { + historyListViewModel.createOneToOneChatRoomWith(remote: historyModel.addressLinphone) + }, label: { + VStack { + HStack(alignment: .center) { + Image("chat-teardrop-text") + .renderingMode(.template) + .resizable() + .foregroundStyle(Color.grayMain2c600) + .frame(width: 25, height: 25) + } + .padding(16) + .background(Color.grayMain2c200) + .cornerRadius(40) + + Text("contact_message_action") + .default_text_style(styleSize: 14) + .frame(minWidth: 80) + } + }) + } + Spacer() Button(action: { diff --git a/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift b/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift index e66677444..0796de619 100644 --- a/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift +++ b/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift @@ -288,20 +288,24 @@ struct ScheduleMeetingFragment: View { }.frame(maxHeight: .infinity) } } - Rectangle() - .foregroundStyle(.clear) - .frame(height: 1) - .background(Color.gray200) - - HStack(spacing: 10) { - Toggle("", isOn: $meetingViewModel.sendInvitations) - .padding(.leading, 16) - .labelsHidden() - .tint(Color.orangeMain300) - Text("meeting_schedule_send_invitations_title") - .default_text_style_500(styleSize: 14) - Spacer() - } + + if !CorePreferences.disableChatFeature { + Rectangle() + .foregroundStyle(.clear) + .frame(height: 1) + .background(Color.gray200) + + HStack(spacing: 10) { + Toggle("", isOn: $meetingViewModel.sendInvitations) + .padding(.leading, 16) + .labelsHidden() + .tint(Color.orangeMain300) + Text("meeting_schedule_send_invitations_title") + .default_text_style_500(styleSize: 14) + Spacer() + } + } + Spacer() } .background(.white) diff --git a/Linphone/UI/Main/Meetings/ViewModel/MeetingViewModel.swift b/Linphone/UI/Main/Meetings/ViewModel/MeetingViewModel.swift index 5ec77397f..83357ad27 100644 --- a/Linphone/UI/Main/Meetings/ViewModel/MeetingViewModel.swift +++ b/Linphone/UI/Main/Meetings/ViewModel/MeetingViewModel.swift @@ -205,8 +205,8 @@ class MeetingViewModel: ObservableObject { ) } } - - if self.sendInvitations { + + if self.sendInvitations && !CorePreferences.disableChatFeature { Log.info("\(MeetingViewModel.TAG) User asked for invitations to be sent, let's do it") self.sendIcsInvitation(core: core) } else { diff --git a/Linphone/UI/Main/Meetings/ViewModel/MeetingsListViewModel.swift b/Linphone/UI/Main/Meetings/ViewModel/MeetingsListViewModel.swift index 3fec57d8f..a310f9f41 100644 --- a/Linphone/UI/Main/Meetings/ViewModel/MeetingsListViewModel.swift +++ b/Linphone/UI/Main/Meetings/ViewModel/MeetingsListViewModel.swift @@ -145,11 +145,9 @@ class MeetingsListViewModel: ObservableObject { // Only remaining meeting is the fake TodayMeeting, remove it too meetingsList.removeAll() } - - DispatchQueue.main.async { - ToastViewModel.shared.toastMessage = "Success_toast_meeting_deleted" - ToastViewModel.shared.displayToast = true - } + + ToastViewModel.shared.toastMessage = "Success_toast_meeting_deleted" + ToastViewModel.shared.displayToast = true } } @@ -162,8 +160,13 @@ class MeetingsListViewModel: ObservableObject { let mSchedulerDelegate = ConferenceSchedulerDelegateStub(onStateChanged: { (_: ConferenceScheduler, state: ConferenceScheduler.State) in Log.info("\(MeetingViewModel.TAG) Conference state changed \(state)") if state == ConferenceScheduler.State.Ready { - self.sendIcsInvitation(core: core, conferenceScheduler: conferenceScheduler) - self.deleteSelectedMeeting() + if !CorePreferences.disableChatFeature { + self.sendIcsInvitation(core: core, conferenceScheduler: conferenceScheduler) + } + + DispatchQueue.main.async { + self.deleteSelectedMeeting() + } } }, onInvitationsSent: { (_: ConferenceScheduler, failedInvitations: [Address]) in diff --git a/msgNotificationService/NotificationService.swift b/msgNotificationService/NotificationService.swift index 62eec577f..d4ad38e14 100644 --- a/msgNotificationService/NotificationService.swift +++ b/msgNotificationService/NotificationService.swift @@ -97,7 +97,7 @@ class NotificationService: UNNotificationServiceExtension { */ if let bestAttemptContent = bestAttemptContent { createCore() - // if !lc!.config!.getBool(section: "app", key: "disable_chat_feature", defaultValue: false) { + if !lc!.config!.getBool(section: "app", key: "disable_chat_feature", defaultValue: false) { Log.info("received push payload : \(bestAttemptContent.userInfo.debugDescription)") if let defaultAccountParams = lc?.defaultAccount?.params, defaultAccountParams.publishEnabled == true { @@ -199,7 +199,10 @@ class NotificationService: UNNotificationServiceExtension { Log.info("Message not found for callid ["+callId+"]") } } - // } + } else { + contentHandler(UNNotificationContent()) + return + } serviceExtensionTimeWillExpire() } }