Several fixes

Fix iPad and landscape views
This commit is contained in:
Benoit Martins 2023-10-09 14:47:04 +02:00
parent b967b67598
commit 3669674eae
21 changed files with 684 additions and 298 deletions

View file

@ -29,6 +29,7 @@
D74C9CFC2ACACF370021626A /* WelcomePage3Fragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9CFB2ACACF370021626A /* WelcomePage3Fragment.swift */; }; D74C9CFC2ACACF370021626A /* WelcomePage3Fragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9CFB2ACACF370021626A /* WelcomePage3Fragment.swift */; };
D74C9CFF2ACAEC5E0021626A /* PopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9CFE2ACAEC5E0021626A /* PopupView.swift */; }; D74C9CFF2ACAEC5E0021626A /* PopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9CFE2ACAEC5E0021626A /* PopupView.swift */; };
D74C9D012ACB098C0021626A /* PermissionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9D002ACB098C0021626A /* PermissionManager.swift */; }; D74C9D012ACB098C0021626A /* PermissionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9D002ACB098C0021626A /* PermissionManager.swift */; };
D750D3392AD3E6EE00EC99C5 /* PopupLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D750D3382AD3E6EE00EC99C5 /* PopupLoadingView.swift */; };
D7702EF22AC7205000557C00 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7702EF12AC7205000557C00 /* WelcomeView.swift */; }; D7702EF22AC7205000557C00 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7702EF12AC7205000557C00 /* WelcomeView.swift */; };
D7A03FBD2ACC2DB60081A588 /* ContactsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7A03FBC2ACC2DB60081A588 /* ContactsView.swift */; }; D7A03FBD2ACC2DB60081A588 /* ContactsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7A03FBC2ACC2DB60081A588 /* ContactsView.swift */; };
D7A03FC02ACC2E390081A588 /* HistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7A03FBF2ACC2E390081A588 /* HistoryView.swift */; }; D7A03FC02ACC2E390081A588 /* HistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7A03FBF2ACC2E390081A588 /* HistoryView.swift */; };
@ -42,6 +43,7 @@
D7D24D182AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */; }; D7D24D182AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */; };
D7DA67622ACCB2FA00E95002 /* LoginFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */; }; D7DA67622ACCB2FA00E95002 /* LoginFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */; };
D7DA67642ACCB31700E95002 /* ProfileModeFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */; }; D7DA67642ACCB31700E95002 /* ProfileModeFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */; };
D7FB55112AD447FD00A5AB15 /* RegisterFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@ -70,6 +72,7 @@
D74C9CFB2ACACF370021626A /* WelcomePage3Fragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomePage3Fragment.swift; sourceTree = "<group>"; }; D74C9CFB2ACACF370021626A /* WelcomePage3Fragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomePage3Fragment.swift; sourceTree = "<group>"; };
D74C9CFE2ACAEC5E0021626A /* PopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupView.swift; sourceTree = "<group>"; }; D74C9CFE2ACAEC5E0021626A /* PopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupView.swift; sourceTree = "<group>"; };
D74C9D002ACB098C0021626A /* PermissionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionManager.swift; sourceTree = "<group>"; }; D74C9D002ACB098C0021626A /* PermissionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionManager.swift; sourceTree = "<group>"; };
D750D3382AD3E6EE00EC99C5 /* PopupLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupLoadingView.swift; sourceTree = "<group>"; };
D7702EF12AC7205000557C00 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; }; D7702EF12AC7205000557C00 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
D7A03FBC2ACC2DB60081A588 /* ContactsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsView.swift; sourceTree = "<group>"; }; D7A03FBC2ACC2DB60081A588 /* ContactsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsView.swift; sourceTree = "<group>"; };
D7A03FBF2ACC2E390081A588 /* HistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryView.swift; sourceTree = "<group>"; }; D7A03FBF2ACC2E390081A588 /* HistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryView.swift; sourceTree = "<group>"; };
@ -84,6 +87,7 @@
D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NotoSans-ExtraBold.ttf"; sourceTree = "<group>"; }; D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NotoSans-ExtraBold.ttf"; sourceTree = "<group>"; };
D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginFragment.swift; sourceTree = "<group>"; }; D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginFragment.swift; sourceTree = "<group>"; };
D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileModeFragment.swift; sourceTree = "<group>"; }; D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileModeFragment.swift; sourceTree = "<group>"; };
D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterFragment.swift; sourceTree = "<group>"; };
FBDE73581C1DC4F98CC3DF3A /* Pods-Linphone.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Linphone.debug.xcconfig"; path = "Target Support Files/Pods-Linphone/Pods-Linphone.debug.xcconfig"; sourceTree = "<group>"; }; FBDE73581C1DC4F98CC3DF3A /* Pods-Linphone.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Linphone.debug.xcconfig"; path = "Target Support Files/Pods-Linphone/Pods-Linphone.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -235,6 +239,7 @@
children = ( children = (
D74C9CFE2ACAEC5E0021626A /* PopupView.swift */, D74C9CFE2ACAEC5E0021626A /* PopupView.swift */,
D72343352AD037AF009AA24E /* ToastView.swift */, D72343352AD037AF009AA24E /* ToastView.swift */,
D750D3382AD3E6EE00EC99C5 /* PopupLoadingView.swift */,
); );
path = Fragments; path = Fragments;
sourceTree = "<group>"; sourceTree = "<group>";
@ -293,6 +298,7 @@
D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */, D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */,
D748BF2D2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift */, D748BF2D2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift */,
D723432F2ACEFEF8009AA24E /* QrCodeScannerFragment.swift */, D723432F2ACEFEF8009AA24E /* QrCodeScannerFragment.swift */,
D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */,
); );
path = Fragments; path = Fragments;
sourceTree = "<group>"; sourceTree = "<group>";
@ -420,6 +426,7 @@
files = ( files = (
D71707202AC5989C0037746F /* TextExtension.swift in Sources */, D71707202AC5989C0037746F /* TextExtension.swift in Sources */,
D719ABB92ABC67BF00B41C10 /* ContentView.swift in Sources */, D719ABB92ABC67BF00B41C10 /* ContentView.swift in Sources */,
D750D3392AD3E6EE00EC99C5 /* PopupLoadingView.swift in Sources */,
D719ABC92ABC6FD700B41C10 /* CoreContext.swift in Sources */, D719ABC92ABC6FD700B41C10 /* CoreContext.swift in Sources */,
D7A03FBD2ACC2DB60081A588 /* ContactsView.swift in Sources */, D7A03FBD2ACC2DB60081A588 /* ContactsView.swift in Sources */,
D719ABCF2ABC779A00B41C10 /* AccountLoginViewModel.swift in Sources */, D719ABCF2ABC779A00B41C10 /* AccountLoginViewModel.swift in Sources */,
@ -433,6 +440,7 @@
D748BF2C2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift in Sources */, D748BF2C2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift in Sources */,
D74C9CF82ACACECE0021626A /* WelcomePage1Fragment.swift in Sources */, D74C9CF82ACACECE0021626A /* WelcomePage1Fragment.swift in Sources */,
D72343362AD037AF009AA24E /* ToastView.swift in Sources */, D72343362AD037AF009AA24E /* ToastView.swift in Sources */,
D7FB55112AD447FD00A5AB15 /* RegisterFragment.swift in Sources */,
D72343322ACEFF58009AA24E /* QRScannerController.swift in Sources */, D72343322ACEFF58009AA24E /* QRScannerController.swift in Sources */,
D72343342ACEFFC3009AA24E /* QRScanner.swift in Sources */, D72343342ACEFFC3009AA24E /* QRScanner.swift in Sources */,
D72343302ACEFEF8009AA24E /* QrCodeScannerFragment.swift in Sources */, D72343302ACEFEF8009AA24E /* QrCodeScannerFragment.swift in Sources */,

View file

@ -29,7 +29,8 @@ final class CoreContext : ObservableObject {
var coreVersion: String = Core.getVersion var coreVersion: String = Core.getVersion
@Published var loggedIn : Bool = false @Published var loggedIn : Bool = false
@Published var configuringSuccessful : String = "" @Published var loggingInProgress : Bool = false
@Published var toastMessage : String = ""
private init() {} private init() {}
@ -49,9 +50,9 @@ final class CoreContext : ObservableObject {
onConfiguringStatus: { (core: Core, state: Config.ConfiguringState, message: String) in onConfiguringStatus: { (core: Core, state: Config.ConfiguringState, message: String) in
NSLog("New configuration state is \(state) = \(message)\n") NSLog("New configuration state is \(state) = \(message)\n")
if (state == .Successful) { if (state == .Successful) {
self.configuringSuccessful = "Successful" self.toastMessage = "Successful"
} else { } else {
self.configuringSuccessful = "Failed" self.toastMessage = "Failed"
} }
}, },
@ -60,8 +61,13 @@ final class CoreContext : ObservableObject {
// Otherwise, we will be Failed. // Otherwise, we will be Failed.
NSLog("New registration state is \(state) for user id \( String(describing: account.params?.identityAddress?.asString()))\n") NSLog("New registration state is \(state) for user id \( String(describing: account.params?.identityAddress?.asString()))\n")
if (state == .Ok) { if (state == .Ok) {
self.loggingInProgress = false
self.loggedIn = true self.loggedIn = true
} else if (state == .Cleared) { } else if (state == .Progress) {
self.loggingInProgress = true
} else {
self.toastMessage = "Registration failed"
self.loggingInProgress = false
self.loggedIn = false self.loggedIn = false
} }
} }

View file

@ -29,7 +29,7 @@ struct LinphoneApp: App {
WindowGroup { WindowGroup {
if isActive { if isActive {
ContentView(sharedMainViewModel: SharedMainViewModel()) ContentView(sharedMainViewModel: SharedMainViewModel())
.toast(isShowing: $coreContext.configuringSuccessful) .toast(isShowing: $coreContext.toastMessage)
}else { }else {
SplashScreen(isActive: $isActive) SplashScreen(isActive: $isActive)
} }

View file

@ -140,6 +140,9 @@
} }
} }
} }
},
"Error" : {
}, },
"History View" : { "History View" : {
@ -176,6 +179,9 @@
}, },
"Open source" : { "Open source" : {
},
"Opération en cours..." : {
}, },
"password" : { "password" : {
"extractionState" : "manual", "extractionState" : "manual",
@ -229,6 +235,9 @@
}, },
"Texte explicatif du interoperable 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." : {
},
"The user name or password is incorrects" : {
}, },
"TLS" : { "TLS" : {

View file

@ -1,9 +1,21 @@
// /*
// SplashScreen.swift * Copyright (c) 2010-2023 Belledonne Communications SARL.
// Linphone *
// * This file is part of Linphone
// Created by Benoît Martins on 03/10/2023. *
// * 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 import SwiftUI

View file

@ -22,12 +22,13 @@ import SwiftUI
struct AssistantView: View { struct AssistantView: View {
@ObservedObject var sharedMainViewModel : SharedMainViewModel @ObservedObject var sharedMainViewModel : SharedMainViewModel
@ObservedObject private var coreContext = CoreContext.shared
var body: some View { var body: some View {
if sharedMainViewModel.displayProfileMode != true { if (sharedMainViewModel.displayProfileMode && coreContext.loggedIn){
LoginFragment(accountLoginViewModel: AccountLoginViewModel(), sharedMainViewModel: sharedMainViewModel)
} else {
ProfileModeFragment(sharedMainViewModel: sharedMainViewModel) ProfileModeFragment(sharedMainViewModel: sharedMainViewModel)
} else {
LoginFragment(accountLoginViewModel: AccountLoginViewModel(), sharedMainViewModel: sharedMainViewModel)
} }
} }
} }

View file

@ -30,8 +30,17 @@ struct LoginFragment: View {
@FocusState var isNameFocused:Bool @FocusState var isNameFocused:Bool
@FocusState var isPasswordFocused:Bool @FocusState var isPasswordFocused:Bool
@State private var isShowPopup = false
@State private var linkActive = ""
@State private var isLinkQRActive = false
@State private var isLinkSIPActive = false
@State private var isLinkREGActive = false
var body: some View { var body: some View {
NavigationView { NavigationView {
ZStack {
GeometryReader { geometry in GeometryReader { geometry in
ScrollView(.vertical) { ScrollView(.vertical) {
VStack { VStack {
@ -108,7 +117,6 @@ struct LoginFragment: View {
.padding(.bottom) .padding(.bottom)
Button(action: { Button(action: {
sharedMainViewModel.displayProfileMode = true
if (self.coreContext.loggedIn){ if (self.coreContext.loggedIn){
self.accountLoginViewModel.unregister() self.accountLoginViewModel.unregister()
self.accountLoginViewModel.delete() self.accountLoginViewModel.delete()
@ -151,7 +159,7 @@ struct LoginFragment: View {
} }
.padding(.bottom, 10) .padding(.bottom, 10)
NavigationLink(destination: { NavigationLink(isActive: $isLinkQRActive, destination: {
QrCodeScannerFragment() QrCodeScannerFragment()
}, label: { }, label: {
HStack { HStack {
@ -168,6 +176,7 @@ struct LoginFragment: View {
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
}) })
.disabled(!sharedMainViewModel.generalTermsAccepted)
.padding(.horizontal, 20) .padding(.horizontal, 20)
.padding(.vertical, 10) .padding(.vertical, 10)
.cornerRadius(60) .cornerRadius(60)
@ -177,9 +186,19 @@ struct LoginFragment: View {
.stroke(Color.orange_main_500, lineWidth: 1) .stroke(Color.orange_main_500, lineWidth: 1)
) )
.padding(.bottom) .padding(.bottom)
.simultaneousGesture(TapGesture().onEnded{
self.linkActive = "QR"
if !sharedMainViewModel.generalTermsAccepted {
withAnimation {
self.isShowPopup.toggle()
}
} else {
self.isLinkQRActive = true
}
})
NavigationLink(destination: { NavigationLink(isActive: $isLinkSIPActive, destination: {
ThirdPartySipAccountWarningFragment(accountLoginViewModel: accountLoginViewModel) ThirdPartySipAccountWarningFragment(sharedMainViewModel: sharedMainViewModel, accountLoginViewModel: accountLoginViewModel)
}, label: { }, label: {
Text("Use SIP Account") Text("Use SIP Account")
.default_text_style_orange_600(styleSize: 20) .default_text_style_orange_600(styleSize: 20)
@ -187,6 +206,7 @@ struct LoginFragment: View {
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
}) })
.disabled(!sharedMainViewModel.generalTermsAccepted)
.padding(.horizontal, 20) .padding(.horizontal, 20)
.padding(.vertical, 10) .padding(.vertical, 10)
.cornerRadius(60) .cornerRadius(60)
@ -196,6 +216,18 @@ struct LoginFragment: View {
.stroke(Color.orange_main_500, lineWidth: 1) .stroke(Color.orange_main_500, lineWidth: 1)
) )
.padding(.bottom) .padding(.bottom)
.simultaneousGesture(TapGesture().onEnded{
self.linkActive = "SIP"
if !sharedMainViewModel.generalTermsAccepted {
withAnimation {
self.isShowPopup.toggle()
}
} else {
self.isLinkSIPActive = true
}
})
Spacer()
HStack(alignment: .center) { HStack(alignment: .center) {
@ -206,13 +238,11 @@ struct LoginFragment: View {
.foregroundStyle(Color.gray_main2_700) .foregroundStyle(Color.gray_main2_700)
.padding(.horizontal, 10) .padding(.horizontal, 10)
Button(action: { NavigationLink(destination: RegisterFragment(), isActive: $isLinkREGActive, label: {Text("Register")
}) {
Text("Register")
.default_text_style_orange_600(styleSize: 20) .default_text_style_orange_600(styleSize: 20)
.frame(height: 35) .frame(height: 35)
} })
.disabled(!sharedMainViewModel.generalTermsAccepted)
.padding(.horizontal, 20) .padding(.horizontal, 20)
.padding(.vertical, 10) .padding(.vertical, 10)
.cornerRadius(60) .cornerRadius(60)
@ -222,18 +252,71 @@ struct LoginFragment: View {
.stroke(Color.orange_main_500, lineWidth: 1) .stroke(Color.orange_main_500, lineWidth: 1)
) )
.padding(.horizontal, 10) .padding(.horizontal, 10)
.simultaneousGesture(TapGesture().onEnded{
self.linkActive = "REG"
if !sharedMainViewModel.generalTermsAccepted {
withAnimation {
self.isShowPopup.toggle()
}
} else {
self.isLinkREGActive = true
}
})
Spacer() Spacer()
} }
.padding(.bottom) .padding(.bottom)
} }
.frame(maxWidth: sharedMainViewModel.maxWidth)
.padding(.horizontal, 20) .padding(.horizontal, 20)
} }
.frame(minHeight: geometry.size.height)
}
if self.isShowPopup {
PopupView(sharedMainViewModel: sharedMainViewModel, 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 dutilisation](https://linphone.org/general-terms)").underline())."), titleFirstButton: Text("Deny all"), actionFirstButton: {self.isShowPopup.toggle()}, titleSecondButton: Text("Accept all"), actionSecondButton: {acceptGeneralTerms()})
.background(.black.opacity(0.65))
.onTapGesture {
self.isShowPopup.toggle()
}
}
}
.onAppear{
sharedMainViewModel.changeDisplayProfileMode()
}
if coreContext.loggingInProgress {
PopupLoadingView(sharedMainViewModel: sharedMainViewModel)
.background(.black.opacity(0.65))
}
if !coreContext.loggingInProgress && !coreContext.loggedIn {
ZStack{
}.onAppear {
self.accountLoginViewModel.unregister()
self.accountLoginViewModel.delete()
}
} }
} }
} }
.navigationViewStyle(StackNavigationViewStyle()) .navigationViewStyle(StackNavigationViewStyle())
} }
func acceptGeneralTerms(){
sharedMainViewModel.changeGeneralTerms()
self.isShowPopup.toggle()
switch linkActive {
case "QR":
self.isLinkQRActive = true
case "SIP":
self.isLinkSIPActive = true
case "REG":
self.isLinkREGActive = true
default:
print("Link Not Active")
}
}
} }
#Preview { #Preview {

View file

@ -114,12 +114,13 @@ struct ProfileModeFragment: View {
.background(Color.gray_100) .background(Color.gray_100)
.cornerRadius(15) .cornerRadius(15)
} }
.frame(maxWidth: sharedMainViewModel.maxWidth)
.padding() .padding()
Spacer() Spacer()
Button(action: { Button(action: {
sharedMainViewModel.displayProfileMode = false sharedMainViewModel.changeHideProfileMode()
}) { }) {
Text("Continue") Text("Continue")
.default_text_style_white_600(styleSize: 20) .default_text_style_white_600(styleSize: 20)
@ -131,12 +132,17 @@ struct ProfileModeFragment: View {
.background(Color.orange_main_500) .background(Color.orange_main_500)
.cornerRadius(60) .cornerRadius(60)
.padding(.horizontal) .padding(.horizontal)
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
.frame(maxWidth: sharedMainViewModel.maxWidth)
} }
.frame(minHeight: geometry.size.height) .frame(minHeight: geometry.size.height)
} }
.onAppear {
UserDefaults.standard.set(false, forKey: "display_profile_mode")
}
if self.isShowPopup { 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()}) PopupView(sharedMainViewModel: sharedMainViewModel, 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)) .background(.black.opacity(0.65))
.onTapGesture { .onTapGesture {
self.isShowPopup.toggle() self.isShowPopup.toggle()

View file

@ -1,9 +1,21 @@
// /*
// QrCodeScannerFragment.swift * Copyright (c) 2010-2023 Belledonne Communications SARL.
// Linphone *
// * This file is part of Linphone
// Created by Benoît Martins on 05/10/2023. *
// * 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 import SwiftUI
@ -42,7 +54,7 @@ struct QrCodeScannerFragment: View {
.edgesIgnoringSafeArea(.all) .edgesIgnoringSafeArea(.all)
.navigationBarHidden(true) .navigationBarHidden(true)
if coreContext.configuringSuccessful == "Successful" { if coreContext.toastMessage == "Successful" {
ZStack{ ZStack{
}.onAppear { }.onAppear {

View file

@ -0,0 +1,64 @@
//
// RegisterFragment.swift
// Linphone
//
// Created by Benoît Martins on 09/10/2023.
//
import SwiftUI
struct RegisterFragment: View {
@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: 25, height: 25, alignment: .leading)
.padding(.top, -65)
.onTapGesture {
withAnimation {
dismiss()
}
}
Spacer()
}
.padding(.leading)
}
.frame(width: geometry.size.width)
Text("Register")
.default_text_style_white_800(styleSize: 20)
.padding(.top, 20)
}
.padding(.top, 35)
.padding(.bottom, 10)
}
}
}
}
.navigationViewStyle(StackNavigationViewStyle())
.navigationBarHidden(true)
}
}
#Preview {
RegisterFragment()
}

View file

@ -21,6 +21,7 @@ import SwiftUI
struct ThirdPartySipAccountLoginFragment: View { struct ThirdPartySipAccountLoginFragment: View {
@ObservedObject var sharedMainViewModel : SharedMainViewModel
@ObservedObject private var coreContext = CoreContext.shared @ObservedObject private var coreContext = CoreContext.shared
@ObservedObject var accountLoginViewModel : AccountLoginViewModel @ObservedObject var accountLoginViewModel : AccountLoginViewModel
@ -222,7 +223,9 @@ struct ThirdPartySipAccountLoginFragment: View {
.background((accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty) ? Color.orange_main_100 : Color.orange_main_500) .background((accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty) ? Color.orange_main_100 : Color.orange_main_500)
.cornerRadius(60) .cornerRadius(60)
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty) .disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty)
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
} }
.frame(maxWidth: sharedMainViewModel.maxWidth)
.padding(.horizontal, 20) .padding(.horizontal, 20)
} }
.frame(minHeight: geometry.size.height) .frame(minHeight: geometry.size.height)
@ -233,5 +236,5 @@ struct ThirdPartySipAccountLoginFragment: View {
} }
#Preview { #Preview {
ThirdPartySipAccountLoginFragment(accountLoginViewModel: AccountLoginViewModel()) ThirdPartySipAccountLoginFragment(sharedMainViewModel: SharedMainViewModel(), accountLoginViewModel: AccountLoginViewModel())
} }

View file

@ -21,6 +21,7 @@ import SwiftUI
struct ThirdPartySipAccountWarningFragment: View { struct ThirdPartySipAccountWarningFragment: View {
@ObservedObject var sharedMainViewModel : SharedMainViewModel
@ObservedObject private var coreContext = CoreContext.shared @ObservedObject private var coreContext = CoreContext.shared
@ObservedObject var accountLoginViewModel : AccountLoginViewModel @ObservedObject var accountLoginViewModel : AccountLoginViewModel
@ -134,6 +135,7 @@ struct ThirdPartySipAccountWarningFragment: View {
} }
.padding(.vertical) .padding(.vertical)
} }
.frame(maxWidth: sharedMainViewModel.maxWidth)
.padding(.horizontal, 20) .padding(.horizontal, 20)
Spacer() Spacer()
@ -154,10 +156,11 @@ struct ThirdPartySipAccountWarningFragment: View {
.inset(by: 0.5) .inset(by: 0.5)
.stroke(Color.orange_main_500, lineWidth: 1) .stroke(Color.orange_main_500, lineWidth: 1)
) )
.frame(maxWidth: sharedMainViewModel.maxWidth)
.padding(.horizontal) .padding(.horizontal)
NavigationLink(destination: { NavigationLink(destination: {
ThirdPartySipAccountLoginFragment(accountLoginViewModel: accountLoginViewModel) ThirdPartySipAccountLoginFragment(sharedMainViewModel: sharedMainViewModel, accountLoginViewModel: accountLoginViewModel)
}, label: { }, label: {
Text("I understand") Text("I understand")
.default_text_style_white_600(styleSize: 20) .default_text_style_white_600(styleSize: 20)
@ -169,7 +172,9 @@ struct ThirdPartySipAccountWarningFragment: View {
.padding(.vertical, 10) .padding(.vertical, 10)
.background(Color.orange_main_500) .background(Color.orange_main_500)
.cornerRadius(60) .cornerRadius(60)
.frame(maxWidth: sharedMainViewModel.maxWidth)
.padding(.horizontal) .padding(.horizontal)
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
} }
.frame(minHeight: geometry.size.height) .frame(minHeight: geometry.size.height)
} }
@ -181,5 +186,5 @@ struct ThirdPartySipAccountWarningFragment: View {
} }
#Preview { #Preview {
ThirdPartySipAccountWarningFragment(accountLoginViewModel: AccountLoginViewModel()) ThirdPartySipAccountWarningFragment(sharedMainViewModel: SharedMainViewModel(), accountLoginViewModel: AccountLoginViewModel())
} }

View file

@ -1,9 +1,21 @@
// /*
// QRScanner.swift * Copyright (c) 2010-2023 Belledonne Communications SARL.
// Linphone *
// * This file is part of Linphone
// Created by Benoît Martins on 05/10/2023. *
// * 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 Foundation import Foundation
import SwiftUI import SwiftUI
@ -66,10 +78,10 @@ class Coordinator: NSObject, AVCaptureMetadataOutputObjectsDelegate {
} }
} else { } else {
coreContext.configuringSuccessful = "Invalide URI" coreContext.toastMessage = "Invalide URI"
} }
} else { } else {
coreContext.configuringSuccessful = "Invalide URI" coreContext.toastMessage = "Invalide URI"
} }
} }
} }

View file

@ -25,7 +25,7 @@ struct ContentView: View {
@ObservedObject private var coreContext = CoreContext.shared @ObservedObject private var coreContext = CoreContext.shared
var body: some View { var body: some View {
if UserDefaults.standard.bool(forKey: "general_terms") == false { if !sharedMainViewModel.welcomeViewDisplayed {
WelcomeView(sharedMainViewModel: sharedMainViewModel) WelcomeView(sharedMainViewModel: sharedMainViewModel)
} else if coreContext.mCore.defaultAccount == nil || sharedMainViewModel.displayProfileMode { } else if coreContext.mCore.defaultAccount == nil || sharedMainViewModel.displayProfileMode {
AssistantView(sharedMainViewModel: sharedMainViewModel) AssistantView(sharedMainViewModel: sharedMainViewModel)

View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2010-2023 Belledonne Communications SARL.
*
* This file is part of Linphone
*
* 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 PopupLoadingView: View {
@ObservedObject var sharedMainViewModel : SharedMainViewModel
var body: some View {
GeometryReader { geometry in
VStack (alignment: .leading){
ProgressView()
.controlSize(.large)
.progressViewStyle(CircularProgressViewStyle(tint: Color.orange_main_500))
.frame(maxWidth: .infinity)
.padding(.top)
.padding(.bottom)
Text("Opération en cours...")
.tint(Color.gray_main2_600)
.default_text_style(styleSize: 15)
.frame(maxWidth: .infinity)
}
.padding(.horizontal, 20)
.padding(.vertical, 20)
.background(.white)
.cornerRadius(20)
.padding(.horizontal)
.frame(maxHeight: .infinity)
.frame(maxWidth: .infinity)
.shadow(color: Color.orange_main_500, radius: 0, x: 0, y: 2)
.frame(maxWidth: sharedMainViewModel.maxWidth)
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
}
}
}
#Preview {
PopupLoadingView(sharedMainViewModel: SharedMainViewModel())
.background(.black.opacity(0.65))
}

View file

@ -22,11 +22,13 @@ import Photos
struct PopupView: View { struct PopupView: View {
@ObservedObject var sharedMainViewModel : SharedMainViewModel
var permissionManager = PermissionManager.shared var permissionManager = PermissionManager.shared
@Binding var isShowPopup: Bool @Binding var isShowPopup: Bool
var title: Text var title: Text
var content: Text var content: Text?
var titleFirstButton: Text? var titleFirstButton: Text?
var actionFirstButton: () -> () var actionFirstButton: () -> ()
@ -42,10 +44,13 @@ struct PopupView: View {
.frame(alignment: .leading) .frame(alignment: .leading)
.padding(.bottom, 2) .padding(.bottom, 2)
if content != nil {
content content
.tint(Color.gray_main2_600) .tint(Color.gray_main2_600)
.default_text_style(styleSize: 15) .default_text_style(styleSize: 15)
.padding(.bottom, 20) .padding(.bottom, 20)
}
if titleFirstButton != nil { if titleFirstButton != nil {
Button(action: { Button(action: {
@ -89,10 +94,13 @@ struct PopupView: View {
.padding(.horizontal) .padding(.horizontal)
.frame(maxHeight: .infinity) .frame(maxHeight: .infinity)
.shadow(color: Color.orange_main_500, radius: 0, x: 0, y: 2) .shadow(color: Color.orange_main_500, radius: 0, x: 0, y: 2)
.frame(maxWidth: sharedMainViewModel.maxWidth)
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
} }
} }
} }
#Preview { #Preview {
PopupView(isShowPopup: .constant(true), title: Text("Title"), content: Text("Content"), titleFirstButton: Text("Deny all"), actionFirstButton: {}, titleSecondButton: Text("Accept all"), actionSecondButton: {}) PopupView(sharedMainViewModel: SharedMainViewModel(), isShowPopup: .constant(true), title: Text("Title"), content: Text("Content"), titleFirstButton: Text("Deny all"), actionFirstButton: {}, titleSecondButton: Text("Accept all"), actionSecondButton: {})
.background(.black.opacity(0.65))
} }

View file

@ -1,14 +1,28 @@
// /*
// ToastView.swift * Copyright (c) 2010-2023 Belledonne Communications SARL.
// Linphone *
// * This file is part of Linphone
// Created by Benoît Martins on 06/10/2023. *
// * 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 import SwiftUI
struct ToastView: ViewModifier { struct ToastView: ViewModifier {
@ObservedObject var sharedMainViewModel : SharedMainViewModel
@Binding var isShowing: String @Binding var isShowing: String
func body(content: Content) -> some View { func body(content: Content) -> some View {
@ -26,14 +40,44 @@ struct ToastView: ViewModifier {
.resizable() .resizable()
.frame(width: 25, height: 25, alignment: .leading) .frame(width: 25, height: 25, alignment: .leading)
Text(isShowing == "Successful" ? "QR code validated!" : (isShowing == "Failed" ? "Invalid QR code!" : "Invalide URI")) switch isShowing {
case "Successful":
Text("QR code validated!")
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.foregroundStyle(isShowing == "Successful" ? Color.green_success_500 : Color.red_danger_500) .foregroundStyle(Color.green_success_500)
.default_text_style(styleSize: 15)
.padding(8)
case "Failed":
Text("Invalid QR code!")
.multilineTextAlignment(.center)
.foregroundStyle(Color.red_danger_500)
.default_text_style(styleSize: 15)
.padding(8)
case "Invalide URI":
Text("Invalide URI")
.multilineTextAlignment(.center)
.foregroundStyle(Color.red_danger_500)
.default_text_style(styleSize: 15)
.padding(8)
case "Registration failed":
Text("The user name or password is incorrects")
.multilineTextAlignment(.center)
.foregroundStyle(Color.red_danger_500)
.default_text_style(styleSize: 15)
.padding(8)
default:
Text("Error")
.multilineTextAlignment(.center)
.foregroundStyle(Color.red_danger_500)
.default_text_style(styleSize: 15) .default_text_style(styleSize: 15)
.padding(8) .padding(8)
} }
}
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.frame(height: 40)
.background(.white) .background(.white)
.cornerRadius(50) .cornerRadius(50)
.overlay( .overlay(
@ -52,6 +96,7 @@ struct ToastView: ViewModifier {
} }
Spacer() Spacer()
} }
.frame(maxWidth: sharedMainViewModel.maxWidth)
.padding(.horizontal, 16) .padding(.horizontal, 16)
.padding(.bottom, 18) .padding(.bottom, 18)
.animation(.linear(duration: 0.3), value: isShowing) .animation(.linear(duration: 0.3), value: isShowing)
@ -61,10 +106,6 @@ struct ToastView: ViewModifier {
extension View { extension View {
func toast(isShowing: Binding<String>) -> some View { func toast(isShowing: Binding<String>) -> some View {
self.modifier(ToastView(isShowing: isShowing)) self.modifier(ToastView(sharedMainViewModel: SharedMainViewModel(), isShowing: isShowing))
} }
} }
//#Preview {
//ToastView()
//}

View file

@ -1,9 +1,21 @@
// /*
// HistoryView.swift * Copyright (c) 2010-2023 Belledonne Communications SARL.
// Linphone *
// * This file is part of Linphone
// Created by Benoît Martins on 03/10/2023. *
// * 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 import SwiftUI

View file

@ -21,13 +21,23 @@ import linphonesw
class SharedMainViewModel : ObservableObject { class SharedMainViewModel : ObservableObject {
@Published var displayProfileMode : Bool = false @Published var welcomeViewDisplayed = false
@Published var generalTermsAccepted = false @Published var generalTermsAccepted = false
@Published var displayProfileMode = false
var maxWidth = 400.0
init() { init() {
let preferences = UserDefaults.standard let preferences = UserDefaults.standard
let welcomeViewKey = "welcome_view"
if preferences.object(forKey: welcomeViewKey) == nil {
preferences.set(welcomeViewDisplayed, forKey: welcomeViewKey)
} else {
welcomeViewDisplayed = preferences.bool(forKey: welcomeViewKey)
}
let generalTermsKey = "general_terms" let generalTermsKey = "general_terms"
if preferences.object(forKey: generalTermsKey) == nil { if preferences.object(forKey: generalTermsKey) == nil {
@ -35,6 +45,22 @@ class SharedMainViewModel : ObservableObject {
} else { } else {
generalTermsAccepted = preferences.bool(forKey: generalTermsKey) generalTermsAccepted = preferences.bool(forKey: generalTermsKey)
} }
let displayProfileModeKey = "display_profile_mode"
if preferences.object(forKey: displayProfileModeKey) == nil {
preferences.set(displayProfileMode, forKey: displayProfileModeKey)
} else {
displayProfileMode = preferences.bool(forKey: displayProfileModeKey)
}
}
func changeWelcomeView(){
let preferences = UserDefaults.standard
welcomeViewDisplayed = true
let welcomeViewKey = "welcome_view"
preferences.set(welcomeViewDisplayed, forKey: welcomeViewKey)
} }
func changeGeneralTerms(){ func changeGeneralTerms(){
@ -44,4 +70,20 @@ class SharedMainViewModel : ObservableObject {
let generalTermsKey = "general_terms" let generalTermsKey = "general_terms"
preferences.set(generalTermsAccepted, forKey: generalTermsKey) preferences.set(generalTermsAccepted, forKey: generalTermsKey)
} }
func changeDisplayProfileMode(){
let preferences = UserDefaults.standard
displayProfileMode = true
let displayProfileModeKey = "display_profile_mode"
preferences.set(displayProfileMode, forKey: displayProfileModeKey)
}
func changeHideProfileMode(){
let preferences = UserDefaults.standard
displayProfileMode = false
let displayProfileModeKey = "display_profile_mode"
preferences.set(displayProfileMode, forKey: displayProfileModeKey)
}
} }

View file

@ -26,7 +26,6 @@ struct WelcomeView: View{
var permissionManager = PermissionManager.shared var permissionManager = PermissionManager.shared
@State private var index = 0 @State private var index = 0
@State private var isShowPopup = false
var body: some View { var body: some View {
GeometryReader { geometry in GeometryReader { geometry in
@ -48,7 +47,7 @@ struct WelcomeView: View{
.onTapGesture { .onTapGesture {
withAnimation { withAnimation {
self.index = 2 self.index = 2
self.isShowPopup.toggle() permissionManager.cameraRequestPermission()
} }
} }
Text("Welcome") Text("Welcome")
@ -98,9 +97,7 @@ struct WelcomeView: View{
index += 1 index += 1
} }
} else if index == 2 { } else if index == 2 {
withAnimation{ permissionManager.cameraRequestPermission()
self.isShowPopup.toggle()
}
} }
}) { }) {
Text(index == 2 ? "Start" : "Next") Text(index == 2 ? "Start" : "Next")
@ -113,22 +110,16 @@ struct WelcomeView: View{
.background(Color.orange_main_500) .background(Color.orange_main_500)
.cornerRadius(60) .cornerRadius(60)
.padding(.horizontal) .padding(.horizontal)
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
.frame(maxWidth: sharedMainViewModel.maxWidth)
} }
.frame(minHeight: geometry.size.height) .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 dutilisation](https://linphone.org/general-terms)").underline())."), titleFirstButton: Text("Deny all"), actionFirstButton: {self.isShowPopup.toggle()}, titleSecondButton: Text("Accept all"), actionSecondButton: {permissionManager.cameraRequestPermission()})
.background(.black.opacity(0.65))
.onTapGesture {
self.isShowPopup.toggle()
}
}
} }
.onReceive(permissionManager.$cameraPermissionGranted, perform: { (granted) in .onReceive(permissionManager.$cameraPermissionGranted, perform: { (granted) in
if granted { if granted {
withAnimation { withAnimation {
sharedMainViewModel.changeGeneralTerms() sharedMainViewModel.changeWelcomeView()
} }
} }
}) })

View file

@ -1,9 +1,21 @@
// /*
// QRScannerController.swift * Copyright (c) 2010-2023 Belledonne Communications SARL.
// Linphone *
// * This file is part of Linphone
// Created by Benoît Martins on 05/10/2023. *
// * 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 Foundation import Foundation
import SwiftUI import SwiftUI