mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-17 11:48:27 +00:00
RC option to hide contact edition - ui/hide_contact_edition
This commit is contained in:
parent
5615d51e27
commit
54b8ae4b02
8 changed files with 35 additions and 22 deletions
|
|
@ -150,6 +150,15 @@ class CorePreferences: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
var hideContactEdition: Bool {
|
||||
get {
|
||||
config.getBool(section: "ui", key: "hide_contact_edition", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
config.setBool(section: "ui", key: "hide_contact_edition", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
var disableAddContact: Bool {
|
||||
get {
|
||||
config.getBool(section: "ui", key: "disable_add_contact", defaultValue: false)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ struct ContactsView: View {
|
|||
ZStack(alignment: .bottomTrailing) {
|
||||
ContactsFragment(isShowDeletePopup: $isShowDeletePopup, text: $text)
|
||||
|
||||
if !AppServices.corePreferences.disableAddContact {
|
||||
if !AppServices.corePreferences.disableAddContact && !AppServices.corePreferences.hideContactEdition {
|
||||
Button {
|
||||
withAnimation {
|
||||
contactsListViewModel.selectedEditFriend = nil
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ struct ContactInnerActionsFragment: View {
|
|||
.background(Color.gray100)
|
||||
|
||||
VStack(spacing: 0) {
|
||||
if !contactAvatarModel.isReadOnly {
|
||||
if !contactAvatarModel.isReadOnly && !AppServices.corePreferences.hideContactEdition {
|
||||
if !contactAvatarModel.editable {
|
||||
Button {
|
||||
actionEditButton()
|
||||
|
|
@ -502,7 +502,7 @@ struct ContactInnerActionsFragment: View {
|
|||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
|
||||
|
||||
Text("contact_details_edit")
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
|
@ -525,7 +525,7 @@ struct ContactInnerActionsFragment: View {
|
|||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
|
||||
|
||||
Text("contact_details_edit")
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
|
@ -542,12 +542,12 @@ struct ContactInnerActionsFragment: View {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
||||
|
||||
Button {
|
||||
contactsListViewModel.toggleStarredSelectedFriend()
|
||||
} label: {
|
||||
|
|
@ -570,7 +570,7 @@ struct ContactInnerActionsFragment: View {
|
|||
.padding(.vertical, 15)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
|
||||
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
|
|
@ -599,12 +599,12 @@ struct ContactInnerActionsFragment: View {
|
|||
.padding(.horizontal, 20)
|
||||
}
|
||||
|
||||
if !contactAvatarModel.isReadOnly {
|
||||
if !contactAvatarModel.isReadOnly && !AppServices.corePreferences.hideContactEdition {
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
||||
|
||||
Button {
|
||||
isShowDeletePopup.toggle()
|
||||
} label: {
|
||||
|
|
@ -615,7 +615,7 @@ struct ContactInnerActionsFragment: View {
|
|||
.foregroundStyle(Color.redDanger500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
|
||||
|
||||
Text("contact_details_delete")
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 14)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ struct ContactInnerFragment: View {
|
|||
|
||||
Spacer()
|
||||
|
||||
if !contactAvatarModel.isReadOnly {
|
||||
if !contactAvatarModel.isReadOnly && !AppServices.corePreferences.hideContactEdition {
|
||||
if !contactAvatarModel.editable {
|
||||
Button(action: {
|
||||
editNativeContact()
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct ContactsListBottomSheet: View {
|
|||
.padding(.trailing)
|
||||
}
|
||||
|
||||
if !contactsListViewModel.selectedFriend!.isReadOnly {
|
||||
if !contactsListViewModel.selectedFriend!.isReadOnly && !AppServices.corePreferences.hideContactEdition {
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
|
|
@ -137,12 +137,12 @@ struct ContactsListBottomSheet: View {
|
|||
.padding(.horizontal, 30)
|
||||
.background(Color.gray100)
|
||||
|
||||
if !contactsListViewModel.selectedFriend!.isReadOnly {
|
||||
if !contactsListViewModel.selectedFriend!.isReadOnly && !AppServices.corePreferences.hideContactEdition {
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
|
||||
Button {
|
||||
if contactsListViewModel.selectedFriend != nil {
|
||||
isShowDeletePopup.toggle()
|
||||
|
|
|
|||
|
|
@ -436,12 +436,13 @@ struct ConversationInfoFragment: View {
|
|||
where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressConv})})
|
||||
|
||||
let disableAddContact = AppServices.corePreferences.disableAddContact
|
||||
|
||||
if (!disableAddContact || (disableAddContact && friendIndex != nil)) {
|
||||
let hideContactEdition = AppServices.corePreferences.hideContactEdition
|
||||
|
||||
if (!disableAddContact || (disableAddContact && friendIndex != nil)) && !hideContactEdition {
|
||||
Button(
|
||||
action: {
|
||||
let addressConv = participantConversationModel.address
|
||||
|
||||
|
||||
let friendIndex = contactsManager.avatarListModel.first(
|
||||
where: {$0.addresses.contains(where: {$0 == addressConv})})
|
||||
|
||||
|
|
@ -679,8 +680,9 @@ struct ConversationInfoFragment: View {
|
|||
where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressConv})})
|
||||
|
||||
let disableAddContact = AppServices.corePreferences.disableAddContact
|
||||
|
||||
if !SharedMainViewModel.shared.displayedConversation!.isGroup && (!disableAddContact || (disableAddContact && friendIndex != nil)) {
|
||||
let hideContactEdition = AppServices.corePreferences.hideContactEdition
|
||||
|
||||
if !SharedMainViewModel.shared.displayedConversation!.isGroup && (!disableAddContact || (disableAddContact && friendIndex != nil)) && !hideContactEdition {
|
||||
Button(
|
||||
action: {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
|
|
|
|||
|
|
@ -71,9 +71,10 @@ struct HistoryContactFragment: View {
|
|||
|
||||
Menu {
|
||||
let disableAddContact = AppServices.corePreferences.disableAddContact
|
||||
let hideContactEdition = AppServices.corePreferences.hideContactEdition
|
||||
let isFriend = historyModel.isFriend == true
|
||||
|
||||
if !historyModel.isConf && (!disableAddContact || (disableAddContact && isFriend)) {
|
||||
|
||||
if !historyModel.isConf && (!disableAddContact || (disableAddContact && isFriend)) && !hideContactEdition {
|
||||
Button {
|
||||
isMenuOpen = false
|
||||
|
||||
|
|
|
|||
|
|
@ -60,9 +60,10 @@ struct HistoryListBottomSheet: View {
|
|||
Spacer()
|
||||
|
||||
let disableAddContact = AppServices.corePreferences.disableAddContact
|
||||
let hideContactEdition = AppServices.corePreferences.hideContactEdition
|
||||
let isFriend = historyListViewModel.selectedCall?.isFriend == true
|
||||
|
||||
if !disableAddContact || (disableAddContact && isFriend) {
|
||||
if (!disableAddContact || (disableAddContact && isFriend)) && !hideContactEdition {
|
||||
Button {
|
||||
|
||||
if #available(iOS 16.0, *) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue