forked from mirrors/linphone-iphone
Update the internationalPrefix when a dial plan is selected in the account profile
This commit is contained in:
parent
8609f880fb
commit
e4b90b58e8
4 changed files with 342 additions and 269 deletions
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4e6074" viewBox="0 0 256 256"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 466 B After Width: | Height: | Size: 466 B |
|
|
@ -3814,6 +3814,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"manage_account_dialog_international_prefix_help_message" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Pick your country to allow Linphone to match your contacts."
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Choisissez votre pays pour permettre à Linphone de faire le lien avec vos contacts."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"manage_account_edit_picture" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
|
|
@ -3830,6 +3847,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"manage_account_international_prefix" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "International Prefix"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Indicatif international"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"manage_account_remove_picture" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
|
|
|
|||
|
|
@ -34,12 +34,14 @@ struct AccountProfileFragment: View {
|
|||
@State private var showPhotoPicker = false
|
||||
@State private var selectedImage: UIImage?
|
||||
@State private var removedImage = false
|
||||
@State private var isShowPopup = false
|
||||
|
||||
@FocusState var isDisplayNameFocused: Bool
|
||||
|
||||
private let avatarSize = 100.0
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
VStack(spacing: 1) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
|
|
@ -308,16 +310,32 @@ struct AccountProfileFragment: View {
|
|||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("sip_address_display_name")
|
||||
HStack {
|
||||
Text("manage_account_international_prefix")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
.lineLimit(1)
|
||||
|
||||
Button(action: {
|
||||
isShowPopup = true
|
||||
}, label: {
|
||||
Image("question")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
.padding(.bottom, -5)
|
||||
}
|
||||
Menu {
|
||||
Picker("", selection: $accountProfileViewModel.dialPlanValueSelected) {
|
||||
ForEach(registerViewModel.dialPlansLabelList, id: \.self) { dialPlan in
|
||||
Text(dialPlan).tag(dialPlan)
|
||||
}
|
||||
}
|
||||
.onChange(of: accountProfileViewModel.dialPlanValueSelected) { newValue in
|
||||
accountProfileViewModel.updateDialPlan(newDialPlan: newValue)
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Text(accountProfileViewModel.dialPlanValueSelected)
|
||||
|
|
@ -354,11 +372,28 @@ struct AccountProfileFragment: View {
|
|||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 2)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
|
||||
if self.isShowPopup {
|
||||
PopupView(isShowPopup: $isShowPopup,
|
||||
title: Text("manage_account_international_prefix"),
|
||||
content: Text("manage_account_dialog_international_prefix_help_message"),
|
||||
titleFirstButton: nil,
|
||||
actionFirstButton: {},
|
||||
titleSecondButton: Text("Ok"),
|
||||
actionSecondButton: {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
)
|
||||
.background(.black.opacity(0.65))
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func saveImage() {
|
||||
|
|
|
|||
|
|
@ -54,11 +54,12 @@ class AccountProfileViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if self.dialPlanSelected != nil
|
||||
&& (self.dialPlanSelected!.countryCallingCode != newParams?.internationalPrefix || self.dialPlanSelected!.isoCountryCode != newParams?.internationalPrefixIsoCountryCode) {
|
||||
newParams?.internationalPrefix = self.dialPlanSelected?.countryCallingCode
|
||||
newParams?.internationalPrefixIsoCountryCode = self.dialPlanSelected?.isoCountryCode
|
||||
newParams?.useInternationalPrefixForCallsAndChats = true
|
||||
*/
|
||||
}
|
||||
|
||||
core.defaultAccount!.params = newParams
|
||||
}
|
||||
|
|
@ -105,8 +106,11 @@ class AccountProfileViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
func changeDialPlan() {
|
||||
|
||||
func updateDialPlan(newDialPlan: String) {
|
||||
if let dialPlan = self.dialPlansList.first(where: { newDialPlan.contains($0.isoCountryCode) }) ??
|
||||
self.dialPlansList.first(where: { newDialPlan.contains($0.countryCallingCode) }) {
|
||||
self.dialPlanSelected = dialPlan
|
||||
}
|
||||
}
|
||||
|
||||
func saveImage(image: UIImage, name: String, prefix: String) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue