mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
Add third party sip account views
This commit is contained in:
parent
7bc754195b
commit
55d7bf8de7
20 changed files with 787 additions and 188 deletions
|
|
@ -18,6 +18,8 @@
|
|||
D719ABC92ABC6FD700B41C10 /* CoreContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = D719ABC82ABC6FD700B41C10 /* CoreContext.swift */; };
|
||||
D719ABCC2ABC769C00B41C10 /* AssistantView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D719ABCB2ABC769C00B41C10 /* AssistantView.swift */; };
|
||||
D719ABCF2ABC779A00B41C10 /* AccountLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D719ABCE2ABC779A00B41C10 /* AccountLoginViewModel.swift */; };
|
||||
D748BF2C2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */; };
|
||||
D748BF2E2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D748BF2D2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift */; };
|
||||
D74C9CF82ACACECE0021626A /* WelcomePage1Fragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9CF72ACACECE0021626A /* WelcomePage1Fragment.swift */; };
|
||||
D74C9CFA2ACACF2D0021626A /* WelcomePage2Fragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9CF92ACACF2D0021626A /* WelcomePage2Fragment.swift */; };
|
||||
D74C9CFC2ACACF370021626A /* WelcomePage3Fragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9CFB2ACACF370021626A /* WelcomePage3Fragment.swift */; };
|
||||
|
|
@ -53,6 +55,8 @@
|
|||
D719ABC82ABC6FD700B41C10 /* CoreContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreContext.swift; sourceTree = "<group>"; };
|
||||
D719ABCB2ABC769C00B41C10 /* AssistantView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssistantView.swift; sourceTree = "<group>"; };
|
||||
D719ABCE2ABC779A00B41C10 /* AccountLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountLoginViewModel.swift; sourceTree = "<group>"; };
|
||||
D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPartySipAccountLoginFragment.swift; sourceTree = "<group>"; };
|
||||
D748BF2D2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPartySipAccountWarningFragment.swift; sourceTree = "<group>"; };
|
||||
D74C9CF72ACACECE0021626A /* WelcomePage1Fragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomePage1Fragment.swift; sourceTree = "<group>"; };
|
||||
D74C9CF92ACACF2D0021626A /* WelcomePage2Fragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomePage2Fragment.swift; sourceTree = "<group>"; };
|
||||
D74C9CFB2ACACF370021626A /* WelcomePage3Fragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomePage3Fragment.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -275,6 +279,8 @@
|
|||
children = (
|
||||
D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */,
|
||||
D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */,
|
||||
D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */,
|
||||
D748BF2D2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift */,
|
||||
);
|
||||
path = Fragments;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -411,6 +417,8 @@
|
|||
D7A2EDD62AC18115005D90FC /* SharedMainViewModel.swift in Sources */,
|
||||
D7A03FC62ACC458A0081A588 /* SplashScreen.swift in Sources */,
|
||||
D7A03FC02ACC2E390081A588 /* HistoryView.swift in Sources */,
|
||||
D748BF2E2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift in Sources */,
|
||||
D748BF2C2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift in Sources */,
|
||||
D74C9CF82ACACECE0021626A /* WelcomePage1Fragment.swift in Sources */,
|
||||
D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */,
|
||||
D7DA67642ACCB31700E95002 /* ProfileModeFragment.swift in Sources */,
|
||||
|
|
|
|||
21
Linphone/Assets.xcassets/Conversation.imageset/Contents.json
vendored
Normal file
21
Linphone/Assets.xcassets/Conversation.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Conversation.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
4
Linphone/Assets.xcassets/Conversation.imageset/Conversation.svg
vendored
Normal file
4
Linphone/Assets.xcassets/Conversation.imageset/Conversation.svg
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M15.74 11.25C15.74 11.4489 15.6641 11.6397 15.5291 11.7803C15.3941 11.921 15.211 12 15.02 12H9.26C9.06904 12 8.88591 11.921 8.75088 11.7803C8.61586 11.6397 8.54 11.4489 8.54 11.25C8.54 11.0511 8.61586 10.8603 8.75088 10.7197C8.88591 10.579 9.06904 10.5 9.26 10.5H15.02C15.211 10.5 15.3941 10.579 15.5291 10.7197C15.6641 10.8603 15.74 11.0511 15.74 11.25ZM15.02 13.5H9.26C9.06904 13.5 8.88591 13.579 8.75088 13.7197C8.61586 13.8603 8.54 14.0511 8.54 14.25C8.54 14.4489 8.61586 14.6397 8.75088 14.7803C8.88591 14.921 9.06904 15 9.26 15H15.02C15.211 15 15.3941 14.921 15.5291 14.7803C15.6641 14.6397 15.74 14.4489 15.74 14.25C15.74 14.0511 15.6641 13.8603 15.5291 13.7197C15.3941 13.579 15.211 13.5 15.02 13.5ZM21.5 12.375C21.4974 14.8606 20.5483 17.2435 18.8611 19.0011C17.1738 20.7587 14.8861 21.7473 12.5 21.75H4.9103C4.53641 21.7495 4.17797 21.5946 3.91359 21.3192C3.64921 21.0438 3.50048 20.6704 3.5 20.2809V12.375C3.5 9.8886 4.44821 7.50403 6.13604 5.74587C7.82387 3.98772 10.1131 3 12.5 3C14.8869 3 17.1761 3.98772 18.864 5.74587C20.5518 7.50403 21.5 9.8886 21.5 12.375ZM20.06 12.375C20.06 10.2864 19.2635 8.28338 17.8457 6.80653C16.428 5.32969 14.505 4.5 12.5 4.5C10.495 4.5 8.57205 5.32969 7.15427 6.80653C5.7365 8.28338 4.94 10.2864 4.94 12.375V20.25H12.5C14.5044 20.2478 16.426 19.4174 17.8434 17.941C19.2607 16.4646 20.0579 14.4629 20.06 12.375Z" fill="#6C7A87"/>
|
||||
<line x1="2.91379" y1="1.96552" x2="22.4655" y2="20.5862" stroke="#6C7A87" stroke-width="2" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Linphone.svg",
|
||||
"filename" : "linphone.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
|
|
|
|||
21
Linphone/Assets.xcassets/caret-down.imageset/Contents.json
vendored
Normal file
21
Linphone/Assets.xcassets/caret-down.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "caret-down.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
1
Linphone/Assets.xcassets/caret-down.imageset/caret-down.svg
vendored
Normal file
1
Linphone/Assets.xcassets/caret-down.imageset/caret-down.svg
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 238 B |
21
Linphone/Assets.xcassets/caret-left.imageset/Contents.json
vendored
Normal file
21
Linphone/Assets.xcassets/caret-left.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "caret-left.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
1
Linphone/Assets.xcassets/caret-left.imageset/caret-left.svg
vendored
Normal file
1
Linphone/Assets.xcassets/caret-left.imageset/caret-left.svg
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 224 B |
21
Linphone/Assets.xcassets/video-call.imageset/Contents.json
vendored
Normal file
21
Linphone/Assets.xcassets/video-call.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "VideoCall.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
3
Linphone/Assets.xcassets/video-call.imageset/VideoCall.svg
vendored
Normal file
3
Linphone/Assets.xcassets/video-call.imageset/VideoCall.svg
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22.6123 6.96504C22.4953 6.90235 22.3636 6.87258 22.231 6.87887C22.0985 6.88517 21.9701 6.9273 21.8597 7.00079L18.6 9.16962V6.87337C18.6 6.48439 18.4455 6.11133 18.1704 5.83628C17.8954 5.56123 17.5223 5.4067 17.1333 5.4067H9.89717C9.70267 5.4067 9.51615 5.48396 9.37862 5.62149C9.2411 5.75902 9.16383 5.94554 9.16383 6.14004C9.16383 6.33453 9.2411 6.52105 9.37862 6.65858C9.51615 6.79611 9.70267 6.87337 9.89717 6.87337H17.1333V14.9061C17.1333 15.1006 17.2106 15.2871 17.3481 15.4247C17.4856 15.5622 17.6722 15.6395 17.8667 15.6395C18.0612 15.6395 18.2477 15.5622 18.3852 15.4247C18.5227 15.2871 18.6 15.1006 18.6 14.9061V14.8484L21.8597 17.0218C21.9807 17.1004 22.1223 17.1415 22.2667 17.14C22.4612 17.14 22.6477 17.0628 22.7852 16.9252C22.9227 16.7877 23 16.6012 23 16.4067V7.6067C22.9991 7.47476 22.9626 7.3455 22.8943 7.23257C22.8261 7.11964 22.7286 7.02721 22.6123 6.96504ZM21.5333 15.0363L18.6 13.081V10.9324L21.5333 8.9817V15.0363ZM4.476 3.44687C4.4116 3.37427 4.33343 3.31518 4.24603 3.27302C4.15862 3.23086 4.06372 3.20647 3.96681 3.20125C3.86991 3.19604 3.77294 3.21011 3.68152 3.24265C3.59009 3.27519 3.50603 3.32556 3.43422 3.39082C3.3624 3.45609 3.30425 3.53496 3.26314 3.62286C3.22203 3.71077 3.19878 3.80596 3.19473 3.90292C3.19067 3.99987 3.20591 4.09667 3.23954 4.1877C3.27318 4.27873 3.32454 4.36217 3.39067 4.4332L4.27525 5.4067H2.46667C2.07768 5.4067 1.70463 5.56123 1.42958 5.83628C1.15452 6.11133 1 6.48439 1 6.87337V17.14C1 17.529 1.15452 17.9021 1.42958 18.1771C1.70463 18.4522 2.07768 18.6067 2.46667 18.6067H16.2753L18.0573 20.5665C18.1217 20.6391 18.1999 20.6982 18.2873 20.7404C18.3747 20.7825 18.4696 20.8069 18.5665 20.8122C18.6634 20.8174 18.7604 20.8033 18.8518 20.7708C18.9432 20.7382 19.0273 20.6878 19.0991 20.6226C19.1709 20.5573 19.2291 20.4784 19.2702 20.3905C19.3113 20.3026 19.3346 20.2074 19.3386 20.1105C19.3427 20.0135 19.3274 19.9167 19.2938 19.8257C19.2602 19.7347 19.2088 19.6512 19.1427 19.5802L4.476 3.44687ZM2.46667 17.14V6.87337H5.609L14.9425 17.14H2.46667Z" fill="#6C7A87"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
|
@ -6,6 +6,12 @@
|
|||
},
|
||||
" or " : {
|
||||
|
||||
},
|
||||
"[Forgotten password?](https://subscribe.linphone.org/)" : {
|
||||
|
||||
},
|
||||
"[linphone.org/contact](https://linphone.org/contact)" : {
|
||||
|
||||
},
|
||||
"[nos conditions d’utilisation](https://linphone.org/general-terms)" : {
|
||||
|
||||
|
|
@ -106,6 +112,9 @@
|
|||
},
|
||||
"Contacts View" : {
|
||||
|
||||
},
|
||||
"Continue" : {
|
||||
|
||||
},
|
||||
"Default" : {
|
||||
|
||||
|
|
@ -115,6 +124,12 @@
|
|||
},
|
||||
"Deny all" : {
|
||||
|
||||
},
|
||||
"Display Name" : {
|
||||
|
||||
},
|
||||
"Domain" : {
|
||||
|
||||
},
|
||||
"En continuant, vous acceptez ces conditions, %@ et %@." : {
|
||||
"localizations" : {
|
||||
|
|
@ -126,10 +141,13 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Forgotten password?" : {
|
||||
"History View" : {
|
||||
|
||||
},
|
||||
"History View" : {
|
||||
"I prefere create an account" : {
|
||||
|
||||
},
|
||||
"I understand" : {
|
||||
|
||||
},
|
||||
"Interoperable" : {
|
||||
|
|
@ -169,6 +187,9 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Personnalize your profil mode" : {
|
||||
|
||||
},
|
||||
"Register" : {
|
||||
|
||||
|
|
@ -178,9 +199,15 @@
|
|||
},
|
||||
"Sécurisé" : {
|
||||
|
||||
},
|
||||
"sip.linphone.org" : {
|
||||
|
||||
},
|
||||
"Skip" : {
|
||||
|
||||
},
|
||||
"Some features require a Linphone account, such as group messaging, video conferences...\n\nThese features are hidden when you register with a third party SIP account.\n\nTo enable it in a commercial projet, please contact us. " : {
|
||||
|
||||
},
|
||||
"Start" : {
|
||||
|
||||
|
|
@ -199,12 +226,21 @@
|
|||
},
|
||||
"to Linphone" : {
|
||||
|
||||
},
|
||||
"Transport" : {
|
||||
|
||||
},
|
||||
"UDP" : {
|
||||
|
||||
},
|
||||
"Une application de communication **sécurisée**, **open source** et **française**." : {
|
||||
|
||||
},
|
||||
"Une application open source et un **service gratuit** depuis **2001**." : {
|
||||
|
||||
},
|
||||
"Use a SIP account" : {
|
||||
|
||||
},
|
||||
"Use SIP Account" : {
|
||||
|
||||
|
|
@ -231,6 +267,9 @@
|
|||
},
|
||||
"Welcome" : {
|
||||
|
||||
},
|
||||
"You will change this mode later" : {
|
||||
|
||||
}
|
||||
},
|
||||
"version" : "1.0"
|
||||
|
|
|
|||
|
|
@ -21,12 +21,17 @@ import SwiftUI
|
|||
|
||||
struct AssistantView: View {
|
||||
|
||||
@ObservedObject var sharedMainViewModel : SharedMainViewModel
|
||||
|
||||
var body: some View {
|
||||
//LoginFragment(accountLoginViewModel: AccountLoginViewModel())
|
||||
ProfileModeFragment()
|
||||
if sharedMainViewModel.displayProfileMode != true {
|
||||
LoginFragment(accountLoginViewModel: AccountLoginViewModel(), sharedMainViewModel: sharedMainViewModel)
|
||||
} else {
|
||||
ProfileModeFragment(sharedMainViewModel: sharedMainViewModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
AssistantView()
|
||||
AssistantView(sharedMainViewModel: SharedMainViewModel())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ struct LoginFragment: View {
|
|||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject var accountLoginViewModel : AccountLoginViewModel
|
||||
@ObservedObject var sharedMainViewModel : SharedMainViewModel
|
||||
|
||||
@State private var isSecured: Bool = true
|
||||
|
||||
|
|
@ -30,184 +31,141 @@ struct LoginFragment: View {
|
|||
@FocusState var isPasswordFocused:Bool
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
Text("assistant_account_login")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
Text("assistant_account_login")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
TextField("username", text : $accountLoginViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text : $accountLoginViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isNameFocused)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
} else {
|
||||
TextField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
}
|
||||
}
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}) {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
}
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
.stroke(isPasswordFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isNameFocused)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
|
||||
Button(action: {
|
||||
sharedMainViewModel.displayProfileMode = true
|
||||
if (self.coreContext.loggedIn){
|
||||
self.accountLoginViewModel.unregister()
|
||||
self.accountLoginViewModel.delete()
|
||||
} else {
|
||||
TextField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
self.accountLoginViewModel.login()
|
||||
}
|
||||
}
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}) {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
}
|
||||
.disabled(coreContext.loggedIn)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Button(action: {
|
||||
if (self.coreContext.loggedIn){
|
||||
self.accountLoginViewModel.unregister()
|
||||
self.accountLoginViewModel.delete()
|
||||
} else {
|
||||
self.accountLoginViewModel.login()
|
||||
}
|
||||
}) {
|
||||
Text(coreContext.loggedIn ? "Log out" : "assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background((accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty) ? Color.orange_main_100 : Color.orange_main_500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty)
|
||||
.padding(.bottom)
|
||||
|
||||
Button(action: {
|
||||
|
||||
}) {
|
||||
Text("Forgotten password?")
|
||||
.underline()
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.bottom, 30)
|
||||
|
||||
HStack {
|
||||
VStack{
|
||||
Divider()
|
||||
}
|
||||
Text(" or ")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
VStack{
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Button(action: {
|
||||
|
||||
}) {
|
||||
HStack {
|
||||
Image("qr-code")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orange_main_500)
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("Scan QR code")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
Text(coreContext.loggedIn ? "Log out" : "assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background((accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty) ? Color.orange_main_100 : Color.orange_main_500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
Text("[Forgotten password?](https://subscribe.linphone.org/)")
|
||||
.underline()
|
||||
.tint(Color.gray_main2_600)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orange_main_500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Button(action: {
|
||||
.padding(.bottom, 30)
|
||||
|
||||
}) {
|
||||
Text("Use SIP Account")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orange_main_500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("Not account yet?")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.gray_main2_700)
|
||||
.padding(.horizontal, 10)
|
||||
HStack {
|
||||
VStack{
|
||||
Divider()
|
||||
}
|
||||
Text(" or ")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
VStack{
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Button(action: {
|
||||
|
||||
}) {
|
||||
Text("Register")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
HStack {
|
||||
Image("qr-code")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orange_main_500)
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("Scan QR code")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
|
|
@ -217,13 +175,59 @@ struct LoginFragment: View {
|
|||
.inset(by: 0.5)
|
||||
.stroke(Color.orange_main_500, lineWidth: 1)
|
||||
)
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.bottom)
|
||||
|
||||
Spacer()
|
||||
NavigationLink(destination: {
|
||||
ThirdPartySipAccountWarningFragment(accountLoginViewModel: accountLoginViewModel)
|
||||
}, label: {
|
||||
Text("Use SIP Account")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orange_main_500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("Not account yet?")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.gray_main2_700)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
Button(action: {
|
||||
|
||||
}) {
|
||||
Text("Register")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orange_main_500, lineWidth: 1)
|
||||
)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
.padding(.bottom)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -231,5 +235,5 @@ struct LoginFragment: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
LoginFragment(accountLoginViewModel: AccountLoginViewModel())
|
||||
LoginFragment(accountLoginViewModel: AccountLoginViewModel(), sharedMainViewModel: SharedMainViewModel())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import SwiftUI
|
|||
|
||||
struct ProfileModeFragment: View {
|
||||
|
||||
@ObservedObject var sharedMainViewModel : SharedMainViewModel
|
||||
|
||||
@State var options: Int = 1
|
||||
@State private var isShowPopup = false
|
||||
@State private var isShowPopupForDefault = true
|
||||
|
|
@ -35,9 +37,12 @@ struct ProfileModeFragment: View {
|
|||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
Text("assistant_account_login")
|
||||
Text("Personnalize your profil mode")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
.padding(.top, -10)
|
||||
Text("You will change this mode later")
|
||||
.default_text_style_white(styleSize: 15)
|
||||
.padding(.top, 40)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
|
@ -110,12 +115,29 @@ struct ProfileModeFragment: View {
|
|||
.cornerRadius(15)
|
||||
}
|
||||
.padding()
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
sharedMainViewModel.displayProfileMode = false
|
||||
}) {
|
||||
Text("Continue")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orange_main_500)
|
||||
.cornerRadius(60)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
|
||||
if self.isShowPopup {
|
||||
PopupView(isShowPopup: $isShowPopup, title: Text(isShowPopupForDefault ? "Default mode" : "Interoperable mode"), content: Text(isShowPopupForDefault ? "Texte explicatif du default mode : lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam velit sapien, egestas sit amet dictum eget, condimentum a ligula." : "Texte explicatif du interoperable mode : lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam velit sapien, egestas sit amet dictum eget, condimentum a ligula."), titleFirstButton: nil, actionFirstButton: {}, titleSecondButton: Text("Close"), actionSecondButton: {self.isShowPopup.toggle()})
|
||||
.background(.black.opacity(0.65))
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
|
|
@ -125,5 +147,5 @@ struct ProfileModeFragment: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
ProfileModeFragment()
|
||||
ProfileModeFragment(sharedMainViewModel: SharedMainViewModel())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ThirdPartySipAccountLoginFragment: View {
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject var accountLoginViewModel : AccountLoginViewModel
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
@State private var isSecured: Bool = true
|
||||
|
||||
@FocusState var isNameFocused:Bool
|
||||
@FocusState var isPasswordFocused:Bool
|
||||
@FocusState var isDomainFocused:Bool
|
||||
@FocusState var isDisplayNameFocused:Bool
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
VStack (alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
.padding(.top, -65)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
accountLoginViewModel.domain = "sip.linphone.org"
|
||||
accountLoginViewModel.transportType = "TLS"
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
|
||||
Text("Use a SIP account")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text : $accountLoginViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isNameFocused)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
} else {
|
||||
TextField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
}
|
||||
}
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}) {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
}
|
||||
.disabled(coreContext.loggedIn)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(String(localized: "Domain")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("sip.linphone.org", text : $accountLoginViewModel.domain)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isDomainFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isDomainFocused)
|
||||
|
||||
Text(String(localized: "Display Name"))
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("Display Name", text : $accountLoginViewModel.displayName)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isDisplayNameFocused ? Color.orange_main_500 : Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isDisplayNameFocused)
|
||||
|
||||
Text(String(localized: "Transport"))
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
Menu {
|
||||
Button("TLS") {accountLoginViewModel.transportType = "TLS"}
|
||||
Button("TCP") {accountLoginViewModel.transportType = "TCP"}
|
||||
Button("UDP") {accountLoginViewModel.transportType = "UDP"}
|
||||
} label: {
|
||||
Text(accountLoginViewModel.transportType)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Image("caret-down")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.gray_200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
if (self.coreContext.loggedIn){
|
||||
self.accountLoginViewModel.unregister()
|
||||
self.accountLoginViewModel.delete()
|
||||
} else {
|
||||
self.accountLoginViewModel.login()
|
||||
}
|
||||
|
||||
accountLoginViewModel.domain = "sip.linphone.org"
|
||||
accountLoginViewModel.transportType = "TLS"
|
||||
}) {
|
||||
Text(coreContext.loggedIn ? "Log out" : "assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background((accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty) ? Color.orange_main_100 : Color.orange_main_500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ThirdPartySipAccountLoginFragment(accountLoginViewModel: AccountLoginViewModel())
|
||||
}
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ThirdPartySipAccountWarningFragment: View {
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject var accountLoginViewModel : AccountLoginViewModel
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
VStack (alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
.padding(.top, -65)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
|
||||
Text("Use a SIP account")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Spacer()
|
||||
HStack(alignment: .center) {
|
||||
Image("conversation")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.gray_main2_200)
|
||||
.cornerRadius(40)
|
||||
.padding(.horizontal)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Image("video-call")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.gray_main2_500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.gray_main2_200)
|
||||
.cornerRadius(40)
|
||||
.padding(.horizontal)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom, 40)
|
||||
|
||||
Text("Some features require a Linphone account, such as group messaging, video conferences...\n\nThese features are hidden when you register with a third party SIP account.\n\nTo enable it in a commercial projet, please contact us. ")
|
||||
.default_text_style(styleSize: 15)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
HStack {
|
||||
Text("[linphone.org/contact](https://linphone.org/contact)")
|
||||
.tint(Color.orange_main_500)
|
||||
.default_text_style_orange_600(styleSize: 15)
|
||||
.frame(height: 35)
|
||||
}
|
||||
.padding(.horizontal, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orange_main_500, lineWidth: 1)
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}) {
|
||||
Text("I prefere create an account")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orange_main_500, lineWidth: 1)
|
||||
)
|
||||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
ThirdPartySipAccountLoginFragment(accountLoginViewModel: accountLoginViewModel)
|
||||
}, label: {
|
||||
Text("I understand")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orange_main_500)
|
||||
.cornerRadius(60)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ThirdPartySipAccountWarningFragment(accountLoginViewModel: AccountLoginViewModel())
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ class AccountLoginViewModel : ObservableObject {
|
|||
@Published var username : String = ""
|
||||
@Published var passwd : String = ""
|
||||
@Published var domain : String = "sip.linphone.org"
|
||||
@Published var displayName : String = ""
|
||||
@Published var transportType : String = "TLS"
|
||||
|
||||
init() {}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ struct ContentView: View {
|
|||
var body: some View {
|
||||
if UserDefaults.standard.bool(forKey: "general_terms") == false {
|
||||
WelcomeView(sharedMainViewModel: sharedMainViewModel)
|
||||
} else if coreContext.mCore.defaultAccount == nil {
|
||||
AssistantView()
|
||||
} else {
|
||||
} else if coreContext.mCore.defaultAccount == nil || sharedMainViewModel.displayProfileMode {
|
||||
AssistantView(sharedMainViewModel: sharedMainViewModel)
|
||||
} else {
|
||||
TabView {
|
||||
ContactsView()
|
||||
.tabItem {
|
||||
|
|
@ -46,5 +46,5 @@ struct ContentView: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
ContentView(sharedMainViewModel: SharedMainViewModel())
|
||||
ContentView(sharedMainViewModel: SharedMainViewModel())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@
|
|||
import linphonesw
|
||||
|
||||
class SharedMainViewModel : ObservableObject {
|
||||
|
||||
|
||||
@Published var displayProfileMode : Bool = false
|
||||
|
||||
@Published var generalTermsAccepted = false
|
||||
|
||||
init() {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ struct WelcomeView: View{
|
|||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
ZStack {
|
||||
ScrollView {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
|
|
@ -67,6 +67,8 @@ struct WelcomeView: View{
|
|||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack{
|
||||
TabView(selection: $index) {
|
||||
ForEach((0..<3), id: \.self) { index in
|
||||
|
|
@ -82,11 +84,14 @@ struct WelcomeView: View{
|
|||
}
|
||||
}
|
||||
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))
|
||||
.frame(minHeight: 300)
|
||||
.onAppear {
|
||||
setupAppearance()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
if index < 2 {
|
||||
withAnimation {
|
||||
|
|
@ -107,18 +112,17 @@ struct WelcomeView: View{
|
|||
.padding(.vertical, 10)
|
||||
.background(Color.orange_main_500)
|
||||
.cornerRadius(60)
|
||||
.padding(.bottom)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
if self.isShowPopup {
|
||||
PopupView(isShowPopup: $isShowPopup, title: Text("Conditions de service"), content: Text("En continuant, vous acceptez ces conditions, \(Text("[notre politique de confidentialité](https://linphone.org/privacy-policy)").underline()) et \(Text("[nos conditions d’utilisation](https://linphone.org/general-terms)").underline())."), titleFirstButton: Text("Deny all"), actionFirstButton: {self.isShowPopup.toggle()}, titleSecondButton: Text("Accept all"), actionSecondButton: {permissionManager.photoLibraryRequestPermission()})
|
||||
.background(.black.opacity(0.65))
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
|
||||
if self.isShowPopup {
|
||||
PopupView(isShowPopup: $isShowPopup, title: Text("Conditions de service"), content: Text("En continuant, vous acceptez ces conditions, \(Text("[notre politique de confidentialité](https://linphone.org/privacy-policy)").underline()) et \(Text("[nos conditions d’utilisation](https://linphone.org/general-terms)").underline())."), titleFirstButton: Text("Deny all"), actionFirstButton: {self.isShowPopup.toggle()}, titleSecondButton: Text("Accept all"), actionSecondButton: {permissionManager.photoLibraryRequestPermission()})
|
||||
.background(.black.opacity(0.65))
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(permissionManager.$photoLibraryPermissionGranted, perform: { (granted) in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue