mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Hide group chat and group call buttons when settings are disabled
This commit is contained in:
parent
6d81455b56
commit
65f965385c
6 changed files with 112 additions and 67 deletions
|
|
@ -260,6 +260,15 @@ class CorePreferences {
|
|||
}
|
||||
}
|
||||
|
||||
static var disableMeetings: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "ui", key: "disable_meetings_feature", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "ui", key: "disable_meetings_feature", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
private func copy(from: String, to: String, overrideIfExists: Bool = false) {
|
||||
let fileManager = FileManager.default
|
||||
if fileManager.fileExists(atPath: to), !overrideIfExists {
|
||||
|
|
|
|||
|
|
@ -130,43 +130,45 @@ struct StartConversationFragment: View {
|
|||
.padding(.vertical)
|
||||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
StartGroupConversationFragment(isShowStartConversationFragment: $isShowStartConversationFragment)
|
||||
.environmentObject(startConversationViewModel)
|
||||
}, label: {
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("users-three")
|
||||
if !startConversationViewModel.hideGroupChatButton {
|
||||
NavigationLink(destination: {
|
||||
StartGroupConversationFragment(isShowStartConversationFragment: $isShowStartConversationFragment)
|
||||
.environmentObject(startConversationViewModel)
|
||||
}, label: {
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("users-three")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: 28, height: 28)
|
||||
}
|
||||
.padding(10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("new_conversation_create_group")
|
||||
.foregroundStyle(.black)
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("caret-right")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: 28, height: 28)
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
}
|
||||
.padding(10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("new_conversation_create_group")
|
||||
.foregroundStyle(.black)
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("caret-right")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
}
|
||||
})
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 20)
|
||||
.background(
|
||||
LinearGradient(gradient: Gradient(colors: [.grayMain2c100, .white]), startPoint: .leading, endPoint: .trailing)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 40)
|
||||
)
|
||||
})
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 20)
|
||||
.background(
|
||||
LinearGradient(gradient: Gradient(colors: [.grayMain2c100, .white]), startPoint: .leading, endPoint: .trailing)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 40)
|
||||
)
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
if !ContactsManager.shared.lastSearch.isEmpty {
|
||||
|
|
|
|||
|
|
@ -40,11 +40,21 @@ class StartConversationViewModel: ObservableObject {
|
|||
@Published var operationGroupInProgress: Bool = false
|
||||
@Published var displayedConversation: ConversationModel?
|
||||
|
||||
@Published var hideGroupChatButton: Bool = false
|
||||
|
||||
private var chatRoomDelegate: ChatRoomDelegate?
|
||||
|
||||
init() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
self.domain = core.defaultAccount?.params?.domain ?? ""
|
||||
self.updateGroupChatButtonVisibility(core: core)
|
||||
}
|
||||
}
|
||||
|
||||
func updateGroupChatButtonVisibility(core: Core) {
|
||||
let hideGroupChat = !LinphoneUtils.isGroupChatAvailable(core: core)
|
||||
DispatchQueue.main.async {
|
||||
self.hideGroupChatButton = hideGroupChat
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,42 +195,45 @@ struct StartCallFragment: View {
|
|||
.padding(.vertical)
|
||||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
StartGroupCallFragment(isShowStartCallFragment: $isShowStartCallFragment)
|
||||
.environmentObject(startCallViewModel)
|
||||
}, label: {
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("video-conference")
|
||||
|
||||
if !startCallViewModel.hideGroupCallButton {
|
||||
NavigationLink(destination: {
|
||||
StartGroupCallFragment(isShowStartCallFragment: $isShowStartCallFragment)
|
||||
.environmentObject(startCallViewModel)
|
||||
}, label: {
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("video-conference")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: 28, height: 28)
|
||||
}
|
||||
.padding(10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("history_call_start_create_group_call")
|
||||
.foregroundStyle(.black)
|
||||
.default_text_style_800(styleSize: 16)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("caret-right")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: 28, height: 28)
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
}
|
||||
.padding(10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("history_call_start_create_group_call")
|
||||
.foregroundStyle(.black)
|
||||
.default_text_style_800(styleSize: 16)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("caret-right")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
}
|
||||
})
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 20)
|
||||
.background(
|
||||
LinearGradient(gradient: Gradient(colors: [.grayMain2c100, .white]), startPoint: .leading, endPoint: .trailing)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 40)
|
||||
)
|
||||
})
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 20)
|
||||
.background(
|
||||
LinearGradient(gradient: Gradient(colors: [.grayMain2c100, .white]), startPoint: .leading, endPoint: .trailing)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 40)
|
||||
)
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
if !ContactsManager.shared.lastSearch.isEmpty {
|
||||
|
|
|
|||
|
|
@ -38,14 +38,27 @@ class StartCallViewModel: ObservableObject {
|
|||
|
||||
@Published var operationInProgress: Bool = false
|
||||
|
||||
@Published var hideGroupCallButton: Bool = false
|
||||
|
||||
private var conferenceDelegate: ConferenceDelegate?
|
||||
|
||||
init() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
self.domain = core.defaultAccount?.params?.domain ?? ""
|
||||
self.updateGroupCallButtonVisibility(core: core)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func updateGroupCallButtonVisibility(core: Core) {
|
||||
let hideGroupCall = CorePreferences.disableMeetings ||
|
||||
!LinphoneUtils.isRemoteConferencingAvailable(core: core) ||
|
||||
core.callsNb > 0
|
||||
DispatchQueue.main.async {
|
||||
self.hideGroupCallButton = hideGroupCall
|
||||
}
|
||||
}
|
||||
|
||||
func addParticipants(participantsToAdd: [SelectedAddressModel]) {
|
||||
var list = participants
|
||||
for selectedAddr in participantsToAdd {
|
||||
|
|
|
|||
|
|
@ -115,4 +115,12 @@ class LinphoneUtils: NSObject {
|
|||
public class func getAccountForAddress(address: Address) -> Account? {
|
||||
return CoreContext.shared.mCore.accountList.first { $0.params?.identityAddress?.weakEqual(address2: address) == true }
|
||||
}
|
||||
|
||||
public class func isRemoteConferencingAvailable(core: Core) -> Bool {
|
||||
return core.defaultAccount?.params?.audioVideoConferenceFactoryAddress != nil
|
||||
}
|
||||
|
||||
public class func isGroupChatAvailable(core: Core) -> Bool {
|
||||
return core.defaultAccount?.params?.conferenceFactoryUri != nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue