mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Hide SIP addresses via settings
This commit is contained in:
parent
1c3680df65
commit
e9eebbd45a
7 changed files with 175 additions and 150 deletions
|
|
@ -274,6 +274,15 @@ class CorePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static var hideSipAddresses: Bool {
|
||||||
|
get {
|
||||||
|
return Config.get().getBool(section: "ui", key: "hide_sip_addresses", defaultValue: false)
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
Config.get().setBool(section: "ui", key: "hide_sip_addresses", value: newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func copy(from: String, to: String, overrideIfExists: Bool = false) {
|
private func copy(from: String, to: String, overrideIfExists: Bool = false) {
|
||||||
let fileManager = FileManager.default
|
let fileManager = FileManager.default
|
||||||
if fileManager.fileExists(atPath: to), !overrideIfExists {
|
if fileManager.fileExists(atPath: to), !overrideIfExists {
|
||||||
|
|
|
||||||
|
|
@ -526,8 +526,10 @@ struct CallView: View {
|
||||||
.padding(.top)
|
.padding(.top)
|
||||||
.default_text_style_white(styleSize: 22)
|
.default_text_style_white(styleSize: 22)
|
||||||
|
|
||||||
Text(callViewModel.remoteAddressCleanedString)
|
if !CorePreferences.hideSipAddresses {
|
||||||
.default_text_style_white_300(styleSize: 16)
|
Text(callViewModel.remoteAddressCleanedString)
|
||||||
|
.default_text_style_white_300(styleSize: 16)
|
||||||
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,127 +39,135 @@ struct ContactInnerActionsFragment: View {
|
||||||
|
|
||||||
var actionEditButton: () -> Void
|
var actionEditButton: () -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .center) {
|
if !CorePreferences.hideSipAddresses || (CorePreferences.hideSipAddresses && !contactAvatarModel.phoneNumbersWithLabel.isEmpty) {
|
||||||
Text("contact_details_numbers_and_addresses_title")
|
HStack(alignment: .center) {
|
||||||
.default_text_style_800(styleSize: 15)
|
Text("contact_details_numbers_and_addresses_title")
|
||||||
|
.default_text_style_800(styleSize: 15)
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Image(informationIsOpen ? "caret-up" : "caret-down")
|
|
||||||
.renderingMode(.template)
|
|
||||||
.resizable()
|
|
||||||
.foregroundStyle(Color.grayMain2c600)
|
|
||||||
.frame(width: 25, height: 25, alignment: .leading)
|
|
||||||
.padding(.all, 10)
|
|
||||||
}
|
|
||||||
.padding(.top, 30)
|
|
||||||
.padding(.bottom, 10)
|
|
||||||
.padding(.horizontal, 16)
|
|
||||||
.background(Color.gray100)
|
|
||||||
.onTapGesture {
|
|
||||||
withAnimation {
|
|
||||||
informationIsOpen.toggle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if informationIsOpen {
|
|
||||||
VStack(spacing: 0) {
|
|
||||||
ForEach(0..<contactAvatarModel.addresses.count, id: \.self) { index in
|
|
||||||
HStack {
|
|
||||||
HStack {
|
|
||||||
VStack {
|
|
||||||
Text(String(localized: "sip_address") + ":")
|
|
||||||
.default_text_style_700(styleSize: 14)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
Text(contactAvatarModel.addresses[index].dropFirst(4))
|
|
||||||
.default_text_style(styleSize: 14)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
.lineLimit(1)
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Image("phone")
|
|
||||||
.renderingMode(.template)
|
|
||||||
.resizable()
|
|
||||||
.foregroundStyle(Color.grayMain2c600)
|
|
||||||
.frame(width: 25, height: 25)
|
|
||||||
.padding(.all, 10)
|
|
||||||
}
|
|
||||||
.padding(.vertical, 15)
|
|
||||||
.padding(.horizontal, 20)
|
|
||||||
}
|
|
||||||
.background(.white)
|
|
||||||
.onTapGesture {
|
|
||||||
do {
|
|
||||||
let address = try Factory.Instance.createAddress(addr: contactAvatarModel.addresses[index])
|
|
||||||
withAnimation {
|
|
||||||
telecomManager.doCallOrJoinConf(address: address)
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
Log.error("[ContactInnerActionsFragment] unable to create address for a new outgoing call : \(contactAvatarModel.addresses[index]) \(error) ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onLongPressGesture(minimumDuration: 0.2) {
|
|
||||||
contactsListViewModel.stringToCopy = contactAvatarModel.addresses[index]
|
|
||||||
showingSheet.toggle()
|
|
||||||
}
|
|
||||||
|
|
||||||
if !contactAvatarModel.phoneNumbersWithLabel.isEmpty
|
|
||||||
|| index < contactAvatarModel.addresses.count - 1 {
|
|
||||||
VStack {
|
|
||||||
Divider()
|
|
||||||
}
|
|
||||||
.padding(.horizontal)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ForEach(contactAvatarModel.phoneNumbersWithLabel.indices, id: \.self) { index in
|
Spacer()
|
||||||
let entry = contactAvatarModel.phoneNumbersWithLabel[index]
|
|
||||||
HStack {
|
Image(informationIsOpen ? "caret-up" : "caret-down")
|
||||||
HStack {
|
.renderingMode(.template)
|
||||||
VStack {
|
.resizable()
|
||||||
if !entry.label.isEmpty {
|
.foregroundStyle(Color.grayMain2c600)
|
||||||
Text(String(localized: "phone_number") + " (\(entry.label)):")
|
.frame(width: 25, height: 25, alignment: .leading)
|
||||||
.default_text_style_700(styleSize: 14)
|
.padding(.all, 10)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
}
|
||||||
} else {
|
.padding(.top, 30)
|
||||||
Text(String(localized: "phone_number") + ":")
|
.padding(.bottom, 10)
|
||||||
.default_text_style_700(styleSize: 14)
|
.padding(.horizontal, 16)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.background(Color.gray100)
|
||||||
|
.onTapGesture {
|
||||||
|
withAnimation {
|
||||||
|
informationIsOpen.toggle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if informationIsOpen {
|
||||||
|
VStack(spacing: 0) {
|
||||||
|
if !CorePreferences.hideSipAddresses {
|
||||||
|
ForEach(0..<contactAvatarModel.addresses.count, id: \.self) { index in
|
||||||
|
HStack {
|
||||||
|
HStack {
|
||||||
|
VStack {
|
||||||
|
Text(String(localized: "sip_address") + ":")
|
||||||
|
.default_text_style_700(styleSize: 14)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
Text(contactAvatarModel.addresses[index].dropFirst(4))
|
||||||
|
.default_text_style(styleSize: 14)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Image("phone")
|
||||||
|
.renderingMode(.template)
|
||||||
|
.resizable()
|
||||||
|
.foregroundStyle(Color.grayMain2c600)
|
||||||
|
.frame(width: 25, height: 25)
|
||||||
|
.padding(.all, 10)
|
||||||
}
|
}
|
||||||
Text(entry.phoneNumber)
|
.padding(.vertical, 15)
|
||||||
.default_text_style(styleSize: 14)
|
.padding(.horizontal, 20)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
}
|
||||||
.lineLimit(1)
|
.background(.white)
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
.onTapGesture {
|
||||||
|
do {
|
||||||
|
let address = try Factory.Instance.createAddress(addr: contactAvatarModel.addresses[index])
|
||||||
|
withAnimation {
|
||||||
|
telecomManager.doCallOrJoinConf(address: address)
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Log.error("[ContactInnerActionsFragment] unable to create address for a new outgoing call : \(contactAvatarModel.addresses[index]) \(error) ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onLongPressGesture(minimumDuration: 0.2) {
|
||||||
|
contactsListViewModel.stringToCopy = contactAvatarModel.addresses[index]
|
||||||
|
showingSheet.toggle()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !contactAvatarModel.phoneNumbersWithLabel.isEmpty
|
||||||
|
|| index < contactAvatarModel.addresses.count - 1 {
|
||||||
|
VStack {
|
||||||
|
Divider()
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
Spacer()
|
|
||||||
}
|
}
|
||||||
.padding(.vertical, 15)
|
|
||||||
.padding(.horizontal, 20)
|
|
||||||
}
|
|
||||||
.background(.white)
|
|
||||||
.onLongPressGesture(minimumDuration: 0.2) {
|
|
||||||
contactsListViewModel.stringToCopy = entry.phoneNumber
|
|
||||||
showingSheet.toggle()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if index < contactAvatarModel.phoneNumbersWithLabel.count - 1 {
|
ForEach(contactAvatarModel.phoneNumbersWithLabel.indices, id: \.self) { index in
|
||||||
VStack {
|
let entry = contactAvatarModel.phoneNumbersWithLabel[index]
|
||||||
Divider()
|
HStack {
|
||||||
|
HStack {
|
||||||
|
VStack {
|
||||||
|
if !entry.label.isEmpty {
|
||||||
|
Text(String(localized: "phone_number") + " (\(entry.label)):")
|
||||||
|
.default_text_style_700(styleSize: 14)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
} else {
|
||||||
|
Text(String(localized: "phone_number") + ":")
|
||||||
|
.default_text_style_700(styleSize: 14)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
Text(entry.phoneNumber)
|
||||||
|
.default_text_style(styleSize: 14)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(.vertical, 15)
|
||||||
|
.padding(.horizontal, 20)
|
||||||
|
}
|
||||||
|
.background(.white)
|
||||||
|
.onLongPressGesture(minimumDuration: 0.2) {
|
||||||
|
contactsListViewModel.stringToCopy = entry.phoneNumber
|
||||||
|
showingSheet.toggle()
|
||||||
|
}
|
||||||
|
|
||||||
|
if index < contactAvatarModel.phoneNumbersWithLabel.count - 1 {
|
||||||
|
VStack {
|
||||||
|
Divider()
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.background(.white)
|
||||||
|
.cornerRadius(15)
|
||||||
|
.padding(.horizontal)
|
||||||
|
.zIndex(-1)
|
||||||
|
.transition(.move(edge: .top))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
HStack {}
|
||||||
|
.frame(height: 20)
|
||||||
}
|
}
|
||||||
.background(.white)
|
|
||||||
.cornerRadius(15)
|
|
||||||
.padding(.horizontal)
|
|
||||||
.zIndex(-1)
|
|
||||||
.transition(.move(edge: .top))
|
|
||||||
}
|
|
||||||
|
|
||||||
if !contactAvatarModel.organization.isEmpty || !contactAvatarModel.jobTitle.isEmpty {
|
if !contactAvatarModel.organization.isEmpty || !contactAvatarModel.jobTitle.isEmpty {
|
||||||
VStack {
|
VStack {
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,11 @@ class EditContactViewModel: ObservableObject {
|
||||||
|
|
||||||
func resetValues() {
|
func resetValues() {
|
||||||
CoreContext.shared.doOnCoreQueue { _ in
|
CoreContext.shared.doOnCoreQueue { _ in
|
||||||
let nativeUriTmp = (self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.nativeUri) ?? ""
|
let nativeUriTmp = self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.nativeUri
|
||||||
let givenNameTmp = (self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.vcard?.givenName) ?? ""
|
let givenNameTmp = (self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.vcard?.givenName) ?? ""
|
||||||
let familyNameTmp = (self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.vcard?.familyName) ?? ""
|
let familyNameTmp = (self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.vcard?.familyName) ?? ""
|
||||||
let organizationTmp = (self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.organization) ?? ""
|
let organizationTmp = self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.organization
|
||||||
let jobTitleTmp = (self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.jobTitle) ?? ""
|
let jobTitleTmp = self.selectedEditFriend == nil ? "" : self.selectedEditFriend!.jobTitle
|
||||||
|
|
||||||
var sipAddressesTmp: [String] = []
|
var sipAddressesTmp: [String] = []
|
||||||
var phoneNumbersTmp: [String] = []
|
var phoneNumbersTmp: [String] = []
|
||||||
|
|
|
||||||
|
|
@ -104,12 +104,14 @@ struct ConversationInfoFragment: View {
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.padding(.top, 10)
|
.padding(.top, 10)
|
||||||
|
|
||||||
Text(conversationViewModel.participantConversationModel.first?.address ?? "")
|
if !CorePreferences.hideSipAddresses {
|
||||||
.foregroundStyle(Color.grayMain2c700)
|
Text(conversationViewModel.participantConversationModel.first?.address ?? "")
|
||||||
.multilineTextAlignment(.center)
|
.foregroundStyle(Color.grayMain2c700)
|
||||||
.default_text_style(styleSize: 14)
|
.multilineTextAlignment(.center)
|
||||||
.frame(maxWidth: .infinity)
|
.default_text_style(styleSize: 14)
|
||||||
.padding(.top, 5)
|
.frame(maxWidth: .infinity)
|
||||||
|
.padding(.top, 5)
|
||||||
|
}
|
||||||
|
|
||||||
if !SharedMainViewModel.shared.displayedConversation!.avatarModel.lastPresenceInfo.isEmpty {
|
if !SharedMainViewModel.shared.displayedConversation!.avatarModel.lastPresenceInfo.isEmpty {
|
||||||
Text(SharedMainViewModel.shared.displayedConversation!.avatarModel.lastPresenceInfo)
|
Text(SharedMainViewModel.shared.displayedConversation!.avatarModel.lastPresenceInfo)
|
||||||
|
|
|
||||||
|
|
@ -187,12 +187,14 @@ struct HistoryContactFragment: View {
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.padding(.top, 10)
|
.padding(.top, 10)
|
||||||
|
|
||||||
Text(historyModel.address)
|
if !CorePreferences.hideSipAddresses {
|
||||||
.foregroundStyle(Color.grayMain2c700)
|
Text(historyModel.address)
|
||||||
.multilineTextAlignment(.center)
|
.foregroundStyle(Color.grayMain2c700)
|
||||||
.default_text_style(styleSize: 14)
|
.multilineTextAlignment(.center)
|
||||||
.frame(maxWidth: .infinity)
|
.default_text_style(styleSize: 14)
|
||||||
.padding(.top, 5)
|
.frame(maxWidth: .infinity)
|
||||||
|
.padding(.top, 5)
|
||||||
|
}
|
||||||
|
|
||||||
if let avatarModel = historyModel.avatarModel {
|
if let avatarModel = historyModel.avatarModel {
|
||||||
Text(avatarModel.lastPresenceInfo)
|
Text(avatarModel.lastPresenceInfo)
|
||||||
|
|
|
||||||
|
|
@ -270,29 +270,31 @@ struct AccountProfileFragment: View {
|
||||||
if accountModel.avatarModel != nil {
|
if accountModel.avatarModel != nil {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
VStack(spacing: 30) {
|
VStack(spacing: 30) {
|
||||||
HStack {
|
if !CorePreferences.hideSipAddresses {
|
||||||
Text(String(localized: "sip_address") + ":")
|
HStack {
|
||||||
.default_text_style_700(styleSize: 15)
|
Text(String(localized: "sip_address") + ":")
|
||||||
|
.default_text_style_700(styleSize: 15)
|
||||||
Text(accountModel.avatarModel!.address)
|
|
||||||
.foregroundStyle(Color.grayMain2c700)
|
|
||||||
.default_text_style(styleSize: 15)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
.lineLimit(1)
|
|
||||||
|
|
||||||
Button(action: {
|
|
||||||
UIPasteboard.general.setValue(
|
|
||||||
accountModel.avatarModel!.address,
|
|
||||||
forPasteboardType: UTType.plainText.identifier
|
|
||||||
)
|
|
||||||
|
|
||||||
ToastViewModel.shared.toastMessage = "Success_address_copied_into_clipboard"
|
Text(accountModel.avatarModel!.address)
|
||||||
ToastViewModel.shared.displayToast.toggle()
|
.foregroundStyle(Color.grayMain2c700)
|
||||||
}, label: {
|
.default_text_style(styleSize: 15)
|
||||||
Image("copy")
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.resizable()
|
.lineLimit(1)
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
})
|
Button(action: {
|
||||||
|
UIPasteboard.general.setValue(
|
||||||
|
accountModel.avatarModel!.address,
|
||||||
|
forPasteboardType: UTType.plainText.identifier
|
||||||
|
)
|
||||||
|
|
||||||
|
ToastViewModel.shared.toastMessage = "Success_address_copied_into_clipboard"
|
||||||
|
ToastViewModel.shared.displayToast.toggle()
|
||||||
|
}, label: {
|
||||||
|
Image("copy")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue