diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index 7b61f1cea..398f48d83 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -346,32 +346,34 @@ struct ContentView: View { } .frame(height: geometry.size.height/4) } - - Button(action: { - sharedMainViewModel.changeIndexView(indexViewInt: 3) - sharedMainViewModel.displayedFriend = nil - sharedMainViewModel.displayedCall = nil - sharedMainViewModel.displayedConversation = nil - }, label: { - VStack { - Image("video-conference") - .renderingMode(.template) - .resizable() - .foregroundStyle(sharedMainViewModel.indexView == 3 ? Color.orangeMain500 : Color.grayMain2c600) - .frame(width: 25, height: 25) - if sharedMainViewModel.indexView == 0 { - Text("bottom_navigation_meetings_label") - .default_text_style_700(styleSize: 10) - } else { - Text("bottom_navigation_meetings_label") - .default_text_style(styleSize: 10) - } - } - }) - .padding(.top) - .frame(height: geometry.size.height/4) - Spacer() + if !sharedMainViewModel.disableMeetingFeature { + Button(action: { + sharedMainViewModel.changeIndexView(indexViewInt: 3) + sharedMainViewModel.displayedFriend = nil + sharedMainViewModel.displayedCall = nil + sharedMainViewModel.displayedConversation = nil + }, label: { + VStack { + Image("video-conference") + .renderingMode(.template) + .resizable() + .foregroundStyle(sharedMainViewModel.indexView == 3 ? Color.orangeMain500 : Color.grayMain2c600) + .frame(width: 25, height: 25) + if sharedMainViewModel.indexView == 0 { + Text("bottom_navigation_meetings_label") + .default_text_style_700(styleSize: 10) + } else { + Text("bottom_navigation_meetings_label") + .default_text_style(styleSize: 10) + } + } + }) + .padding(.top) + .frame(height: geometry.size.height/4) + + Spacer() + } } } .frame(width: 75, height: geometry.size.height) @@ -906,31 +908,33 @@ struct ContentView: View { .frame(width: 66) } } - - Spacer() - Button(action: { - sharedMainViewModel.changeIndexView(indexViewInt: 3) - sharedMainViewModel.displayedFriend = nil - sharedMainViewModel.displayedCall = nil - sharedMainViewModel.displayedConversation = nil - }, label: { - VStack { - Image("video-conference") - .renderingMode(.template) - .resizable() - .foregroundStyle(sharedMainViewModel.indexView == 3 ? Color.orangeMain500 : Color.grayMain2c600) - .frame(width: 25, height: 25) - if sharedMainViewModel.indexView == 3 { - Text("bottom_navigation_meetings_label") - .default_text_style_700(styleSize: 9) - } else { - Text("bottom_navigation_meetings_label") - .default_text_style(styleSize: 9) + + if !sharedMainViewModel.disableMeetingFeature { + Spacer() + Button(action: { + sharedMainViewModel.changeIndexView(indexViewInt: 3) + sharedMainViewModel.displayedFriend = nil + sharedMainViewModel.displayedCall = nil + sharedMainViewModel.displayedConversation = nil + }, label: { + VStack { + Image("video-conference") + .renderingMode(.template) + .resizable() + .foregroundStyle(sharedMainViewModel.indexView == 3 ? Color.orangeMain500 : Color.grayMain2c600) + .frame(width: 25, height: 25) + if sharedMainViewModel.indexView == 3 { + Text("bottom_navigation_meetings_label") + .default_text_style_700(styleSize: 9) + } else { + Text("bottom_navigation_meetings_label") + .default_text_style(styleSize: 9) + } } - } - }) - .padding(.top) - .frame(width: 66) + }) + .padding(.top) + .frame(width: 66) + } Spacer() } diff --git a/Linphone/UI/Main/Settings/ViewModel/AccountSettingsViewModel.swift b/Linphone/UI/Main/Settings/ViewModel/AccountSettingsViewModel.swift index 77b8b3208..011edb193 100644 --- a/Linphone/UI/Main/Settings/ViewModel/AccountSettingsViewModel.swift +++ b/Linphone/UI/Main/Settings/ViewModel/AccountSettingsViewModel.swift @@ -215,6 +215,9 @@ class AccountSettingsViewModel: ObservableObject { newParams.limeServerUrl = self.limeServerUrl self.accountModel.account.params = newParams + + SharedMainViewModel.shared.updateDisableMeetingFeature() + print("\(AccountSettingsViewModel.TAG) Changes have been saved") } } diff --git a/Linphone/UI/Main/Viewmodel/SharedMainViewModel.swift b/Linphone/UI/Main/Viewmodel/SharedMainViewModel.swift index c70e3ebf1..f97724a95 100644 --- a/Linphone/UI/Main/Viewmodel/SharedMainViewModel.swift +++ b/Linphone/UI/Main/Viewmodel/SharedMainViewModel.swift @@ -47,6 +47,7 @@ class SharedMainViewModel: ObservableObject { @Published var missedCallsCount: Int = 0 @Published var disableChatFeature: Bool = false + @Published var disableMeetingFeature: Bool = false let welcomeViewKey = "welcome_view" let generalTermsKey = "general_terms" @@ -94,6 +95,7 @@ class SharedMainViewModel: ObservableObject { updateMissedCallsCount() updateUnreadMessagesCount() updateDisableChatFeature() + updateDisableMeetingFeature() } func changeWelcomeView() { @@ -224,4 +226,14 @@ class SharedMainViewModel: ObservableObject { } } } + + func updateDisableMeetingFeature() { + CoreContext.shared.doOnCoreQueue { core in + let disableMeetingFeatureTmp = CorePreferences.disableMeetings || + !LinphoneUtils.isRemoteConferencingAvailable(core: core) + DispatchQueue.main.async { + self.disableMeetingFeature = disableMeetingFeatureTmp + } + } + } }