diff --git a/Linphone.xcodeproj/project.pbxproj b/Linphone.xcodeproj/project.pbxproj index 461240c2c..c8f9d54ca 100644 --- a/Linphone.xcodeproj/project.pbxproj +++ b/Linphone.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 0DF2F35F000C9BBAE8FCB4A0 /* Pods_Linphone.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C92C314A5427A62F953EB70 /* Pods_Linphone.framework */; }; D70C93DE2AC2D0F60063CA3B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */; }; D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D717071D2AC5922E0037746F /* ColorExtension.swift */; }; D71707202AC5989C0037746F /* TextExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D717071F2AC5989C0037746F /* TextExtension.swift */; }; @@ -43,13 +42,14 @@ D7D24D182AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */; }; D7DA67622ACCB2FA00E95002 /* LoginFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */; }; D7DA67642ACCB31700E95002 /* ProfileModeFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */; }; + D7EAACCF2AD6ED8000AA6A8A /* PermissionsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7EAACCE2AD6ED8000AA6A8A /* PermissionsFragment.swift */; }; D7FB55112AD447FD00A5AB15 /* RegisterFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */; }; + F4BB8DFBA0FF08430EBA9351 /* Pods_Linphone.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F5B27C5576B1EAED2F205EB /* Pods_Linphone.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 3A132937ACADB95696E2F906 /* 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 = ""; }; - 3E2758142B8F42856C3A34DF /* Pods-Linphone.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Linphone.release.xcconfig"; path = "Target Support Files/Pods-Linphone/Pods-Linphone.release.xcconfig"; sourceTree = ""; }; - 7C92C314A5427A62F953EB70 /* Pods_Linphone.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Linphone.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 377E0B5C2B1F38192E694334 /* 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 = ""; }; + 6F5B27C5576B1EAED2F205EB /* Pods_Linphone.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Linphone.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; D717071D2AC5922E0037746F /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = ""; }; D717071F2AC5989C0037746F /* TextExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextExtension.swift; sourceTree = ""; }; @@ -88,7 +88,9 @@ D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NotoSans-ExtraBold.ttf"; sourceTree = ""; }; D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginFragment.swift; sourceTree = ""; }; D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileModeFragment.swift; sourceTree = ""; }; + D7EAACCE2AD6ED8000AA6A8A /* PermissionsFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionsFragment.swift; sourceTree = ""; }; D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterFragment.swift; sourceTree = ""; }; + F76FB87556A3109F61F9E2D5 /* Pods-Linphone.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Linphone.release.xcconfig"; path = "Target Support Files/Pods-Linphone/Pods-Linphone.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -96,17 +98,17 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 0DF2F35F000C9BBAE8FCB4A0 /* Pods_Linphone.framework in Frameworks */, + F4BB8DFBA0FF08430EBA9351 /* Pods_Linphone.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1110B8CBF3C1BFD76F8BBFB2 /* Frameworks */ = { + 52EFCC310713B3CA01062945 /* Frameworks */ = { isa = PBXGroup; children = ( - 7C92C314A5427A62F953EB70 /* Pods_Linphone.framework */, + 6F5B27C5576B1EAED2F205EB /* Pods_Linphone.framework */, ); name = Frameworks; sourceTree = ""; @@ -114,8 +116,8 @@ A31AF2AB8C6A3D7B7EA3B424 /* Pods */ = { isa = PBXGroup; children = ( - 3A132937ACADB95696E2F906 /* Pods-Linphone.debug.xcconfig */, - 3E2758142B8F42856C3A34DF /* Pods-Linphone.release.xcconfig */, + 377E0B5C2B1F38192E694334 /* Pods-Linphone.debug.xcconfig */, + F76FB87556A3109F61F9E2D5 /* Pods-Linphone.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -136,7 +138,7 @@ D719ABB52ABC67BF00B41C10 /* Linphone */, D719ABB42ABC67BF00B41C10 /* Products */, A31AF2AB8C6A3D7B7EA3B424 /* Pods */, - 1110B8CBF3C1BFD76F8BBFB2 /* Frameworks */, + 52EFCC310713B3CA01062945 /* Frameworks */, ); sourceTree = ""; }; @@ -294,11 +296,12 @@ isa = PBXGroup; children = ( D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */, + D7EAACCE2AD6ED8000AA6A8A /* PermissionsFragment.swift */, D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */, - D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */, - D748BF2D2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift */, D723432F2ACEFEF8009AA24E /* QrCodeScannerFragment.swift */, D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */, + D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */, + D748BF2D2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift */, ); path = Fragments; sourceTree = ""; @@ -310,12 +313,12 @@ isa = PBXNativeTarget; buildConfigurationList = D719ABC22ABC67BF00B41C10 /* Build configuration list for PBXNativeTarget "Linphone" */; buildPhases = ( - EAE6BD221624F991B659AC2E /* [CP] Check Pods Manifest.lock */, + 6FE8573A5CFC1DA89D3172B5 /* [CP] Check Pods Manifest.lock */, D719ABAF2ABC67BF00B41C10 /* Sources */, D719ABB02ABC67BF00B41C10 /* Frameworks */, D719ABB12ABC67BF00B41C10 /* Resources */, D7FB55122AD53FE200A5AB15 /* Run Script */, - A35AE8ABA69001024776F16C /* [CP] Embed Pods Frameworks */, + 230129DD87A6EBB04DF458AD /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -379,7 +382,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - A35AE8ABA69001024776F16C /* [CP] Embed Pods Frameworks */ = { + 230129DD87A6EBB04DF458AD /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -396,26 +399,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Linphone/Pods-Linphone-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - D7FB55122AD53FE200A5AB15 /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 12; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which swiftlint > /dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; - }; - EAE6BD221624F991B659AC2E /* [CP] Check Pods Manifest.lock */ = { + 6FE8573A5CFC1DA89D3172B5 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -437,6 +421,25 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + D7FB55122AD53FE200A5AB15 /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 12; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which swiftlint > /dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -448,6 +451,7 @@ D719ABB92ABC67BF00B41C10 /* ContentView.swift in Sources */, D750D3392AD3E6EE00EC99C5 /* PopupLoadingView.swift in Sources */, D719ABC92ABC6FD700B41C10 /* CoreContext.swift in Sources */, + D7EAACCF2AD6ED8000AA6A8A /* PermissionsFragment.swift in Sources */, D7A03FBD2ACC2DB60081A588 /* ContactsView.swift in Sources */, D719ABCF2ABC779A00B41C10 /* AccountLoginViewModel.swift in Sources */, D74C9D012ACB098C0021626A /* PermissionManager.swift in Sources */, @@ -592,7 +596,7 @@ }; D719ABC32ABC67BF00B41C10 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3A132937ACADB95696E2F906 /* Pods-Linphone.debug.xcconfig */; + baseConfigurationReference = 377E0B5C2B1F38192E694334 /* Pods-Linphone.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -636,7 +640,7 @@ }; D719ABC42ABC67BF00B41C10 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3E2758142B8F42856C3A34DF /* Pods-Linphone.release.xcconfig */; + baseConfigurationReference = F76FB87556A3109F61F9E2D5 /* Pods-Linphone.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; diff --git a/Linphone/Assets.xcassets/Linphone.imageset/Contents.json b/Linphone/Assets.xcassets/Linphone.imageset/Contents.json index ff043ddb2..e87351a00 100644 --- a/Linphone/Assets.xcassets/Linphone.imageset/Contents.json +++ b/Linphone/Assets.xcassets/Linphone.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "linphone.svg", + "filename" : "Linphone.svg", "idiom" : "universal", "scale" : "1x" }, diff --git a/Linphone/Assets.xcassets/bell-ringing.imageset/Contents.json b/Linphone/Assets.xcassets/bell-ringing.imageset/Contents.json new file mode 100644 index 000000000..d406bf8d4 --- /dev/null +++ b/Linphone/Assets.xcassets/bell-ringing.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "bell-ringing.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Linphone/Assets.xcassets/bell-ringing.imageset/bell-ringing.svg b/Linphone/Assets.xcassets/bell-ringing.imageset/bell-ringing.svg new file mode 100644 index 000000000..247d2a164 --- /dev/null +++ b/Linphone/Assets.xcassets/bell-ringing.imageset/bell-ringing.svg @@ -0,0 +1,3 @@ + + + diff --git a/Linphone/Assets.xcassets/microphone.imageset/Contents.json b/Linphone/Assets.xcassets/microphone.imageset/Contents.json new file mode 100644 index 000000000..49b7a33fb --- /dev/null +++ b/Linphone/Assets.xcassets/microphone.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "microphone.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Linphone/Assets.xcassets/microphone.imageset/microphone.svg b/Linphone/Assets.xcassets/microphone.imageset/microphone.svg new file mode 100644 index 000000000..c4aeceaeb --- /dev/null +++ b/Linphone/Assets.xcassets/microphone.imageset/microphone.svg @@ -0,0 +1,3 @@ + + + diff --git a/Linphone/Assets.xcassets/video-camera.imageset/Contents.json b/Linphone/Assets.xcassets/video-camera.imageset/Contents.json new file mode 100644 index 000000000..e7745ecc4 --- /dev/null +++ b/Linphone/Assets.xcassets/video-camera.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "video-camera.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Linphone/Assets.xcassets/video-camera.imageset/video-camera.svg b/Linphone/Assets.xcassets/video-camera.imageset/video-camera.svg new file mode 100644 index 000000000..1f42d14cc --- /dev/null +++ b/Linphone/Assets.xcassets/video-camera.imageset/video-camera.svg @@ -0,0 +1,3 @@ + + + diff --git a/Linphone/Localizable.xcstrings b/Linphone/Localizable.xcstrings index 6490fa139..220ead687 100644 --- a/Linphone/Localizable.xcstrings +++ b/Linphone/Localizable.xcstrings @@ -24,6 +24,18 @@ }, "[notre politique de confidentialité](https://linphone.org/privacy-policy)" : { + }, + "**Camera** : Pour capturer votre vidéo lors des appels vidéo et conférence." : { + + }, + "**Contacts** : Pour vous afficher vos contacts et retrouver qui utilise Linphone." : { + + }, + "**Micro** : Pour permettre à vos correspondants de vous entendre." : { + + }, + "**Notifications** : Pour vous informé quand vous recevez un message ou un appel." : { + }, "%lld Book (Example)" : { "extractionState" : "manual", @@ -121,12 +133,18 @@ }, "Continue" : { + }, + "D'accord" : { + }, "Default" : { }, "Default mode" : { + }, + "Demande d’autorisations" : { + }, "Deny all" : { @@ -201,6 +219,12 @@ }, "Personnalize your profil mode" : { + }, + "Plus tard" : { + + }, + "Pour vous permettre de vous profitez pleinement de Linphone nous avons besoin des autorisations suivantes :" : { + }, "QR code validated!" : { diff --git a/Linphone/UI/Assistant/Fragments/LoginFragment.swift b/Linphone/UI/Assistant/Fragments/LoginFragment.swift index b340a8ad4..0d5cac6b9 100644 --- a/Linphone/UI/Assistant/Fragments/LoginFragment.swift +++ b/Linphone/UI/Assistant/Fragments/LoginFragment.swift @@ -34,7 +34,6 @@ struct LoginFragment: View { @State private var linkActive = "" - @State private var isLinkQRActive = false @State private var isLinkSIPActive = false @State private var isLinkREGActive = false @@ -155,7 +154,7 @@ struct LoginFragment: View { } .padding(.bottom, 10) - NavigationLink(isActive: $isLinkQRActive, destination: { + NavigationLink(destination: { QrCodeScannerFragment() }, label: { HStack { @@ -172,7 +171,6 @@ struct LoginFragment: View { .frame(maxWidth: .infinity) }) - .disabled(!sharedMainViewModel.generalTermsAccepted) .padding(.horizontal, 20) .padding(.vertical, 10) .cornerRadius(60) @@ -182,18 +180,6 @@ struct LoginFragment: View { .stroke(Color.orangeMain500, lineWidth: 1) ) .padding(.bottom) - .simultaneousGesture( - TapGesture().onEnded { - self.linkActive = "QR" - if !sharedMainViewModel.generalTermsAccepted { - withAnimation { - self.isShowPopup.toggle() - } - } else { - self.isLinkQRActive = true - } - } - ) NavigationLink(isActive: $isLinkSIPActive, destination: { ThirdPartySipAccountWarningFragment(sharedMainViewModel: sharedMainViewModel, accountLoginViewModel: accountLoginViewModel) @@ -320,8 +306,6 @@ struct LoginFragment: View { sharedMainViewModel.changeGeneralTerms() self.isShowPopup.toggle() switch linkActive { - case "QR": - self.isLinkQRActive = true case "SIP": self.isLinkSIPActive = true case "REG": diff --git a/Linphone/UI/Assistant/Fragments/PermissionsFragment.swift b/Linphone/UI/Assistant/Fragments/PermissionsFragment.swift new file mode 100644 index 000000000..cbb56aa76 --- /dev/null +++ b/Linphone/UI/Assistant/Fragments/PermissionsFragment.swift @@ -0,0 +1,227 @@ +/* + * 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 . + */ + +import SwiftUI + +struct PermissionsFragment: View { + + @ObservedObject var sharedMainViewModel: SharedMainViewModel + + var permissionManager = PermissionManager.shared + + @Environment(\.dismiss) var dismiss + + 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.grayMain2c500) + .frame(width: 25, height: 25, alignment: .leading) + .padding(.top, -65) + .onTapGesture { + withAnimation { + dismiss() + } + } + + Spacer() + } + .padding(.leading) + } + .frame(width: geometry.size.width) + + Text("Demande d’autorisations") + .default_text_style_white_800(styleSize: 20) + .padding(.top, 20) + } + .padding(.top, 35) + .padding(.bottom, 10) + + Text("Pour vous permettre de vous profitez pleinement de Linphone nous avons besoin des autorisations suivantes :") + .default_text_style(styleSize: 15) + .multilineTextAlignment(.center) + + Spacer() + + VStack(alignment: .leading) { + HStack { + HStack(alignment: .center) { + Image("bell-ringing") + .renderingMode(.template) + .resizable() + .foregroundStyle(Color.grayMain2c500) + .frame(width: 20, height: 20, alignment: .leading) + .onTapGesture { + withAnimation { + dismiss() + } + } + } + .padding(16) + .background(Color.grayMain2c200) + .cornerRadius(40) + + Text("**Notifications** : Pour vous informé quand vous recevez un message ou un appel.") + .default_text_style(styleSize: 15) + .padding(.leading, 10) + } + .padding(.bottom) + + HStack { + HStack(alignment: .center) { + Image("address-book") + .renderingMode(.template) + .resizable() + .foregroundStyle(Color.grayMain2c500) + .frame(width: 20, height: 20, alignment: .leading) + .onTapGesture { + withAnimation { + dismiss() + } + } + } + .padding(16) + .background(Color.grayMain2c200) + .cornerRadius(40) + + Text("**Contacts** : Pour vous afficher vos contacts et retrouver qui utilise Linphone.") + .default_text_style(styleSize: 15) + .padding(.leading, 10) + } + .padding(.bottom) + + HStack { + HStack(alignment: .center) { + Image("microphone") + .renderingMode(.template) + .resizable() + .foregroundStyle(Color.grayMain2c500) + .frame(width: 20, height: 20, alignment: .leading) + .onTapGesture { + withAnimation { + dismiss() + } + } + } + .padding(16) + .background(Color.grayMain2c200) + .cornerRadius(40) + + Text("**Micro** : Pour permettre à vos correspondants de vous entendre.") + .default_text_style(styleSize: 15) + .padding(.leading, 10) + } + .padding(.bottom) + + HStack { + HStack(alignment: .center) { + Image("video-camera") + .renderingMode(.template) + .resizable() + .foregroundStyle(Color.grayMain2c500) + .frame(width: 20, height: 20, alignment: .leading) + .onTapGesture { + withAnimation { + dismiss() + } + } + } + .padding(16) + .background(Color.grayMain2c200) + .cornerRadius(40) + + Text("**Camera** : Pour capturer votre vidéo lors des appels vidéo et conférence.") + .default_text_style(styleSize: 15) + .padding(.leading, 10) + } + .padding(.bottom) + } + .frame(maxWidth: sharedMainViewModel.maxWidth) + .frame(maxHeight: .infinity) + .padding(.horizontal, 20) + + Spacer() + + Button(action: { + withAnimation { + sharedMainViewModel.changeWelcomeView() + } + }, label: { + Text("Plus tard") + .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.orangeMain500, lineWidth: 1) + ) + .frame(maxWidth: sharedMainViewModel.maxWidth) + .padding(.horizontal) + + Button { + permissionManager.cameraRequestPermission() + } label: { + Text("D'accord") + .default_text_style_white_600(styleSize: 20) + .frame(height: 35) + .frame(maxWidth: .infinity) + } + .padding(.horizontal, 20) + .padding(.vertical, 10) + .background(Color.orangeMain500) + .cornerRadius(60) + .frame(maxWidth: sharedMainViewModel.maxWidth) + .padding(.horizontal) + .padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0) + } + .frame(minHeight: geometry.size.height) + } + } + .navigationViewStyle(StackNavigationViewStyle()) + .navigationBarHidden(true) + .onReceive(permissionManager.$cameraPermissionGranted, perform: { (granted) in + if granted { + withAnimation { + sharedMainViewModel.changeWelcomeView() + } + } + }) + } +} + +#Preview { + PermissionsFragment(sharedMainViewModel: SharedMainViewModel()) +} diff --git a/Linphone/UI/Assistant/Fragments/RegisterFragment.swift b/Linphone/UI/Assistant/Fragments/RegisterFragment.swift index 8b80a1101..194bd5b5a 100644 --- a/Linphone/UI/Assistant/Fragments/RegisterFragment.swift +++ b/Linphone/UI/Assistant/Fragments/RegisterFragment.swift @@ -1,9 +1,21 @@ -// -// RegisterFragment.swift -// Linphone -// -// Created by Benoît Martins on 09/10/2023. -// +/* + * 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 . + */ import SwiftUI diff --git a/Linphone/UI/Welcome/WelcomeView.swift b/Linphone/UI/Welcome/WelcomeView.swift index b568f88f7..9bad70c3a 100644 --- a/Linphone/UI/Welcome/WelcomeView.swift +++ b/Linphone/UI/Welcome/WelcomeView.swift @@ -23,106 +23,118 @@ struct WelcomeView: View { @ObservedObject var sharedMainViewModel: SharedMainViewModel - var permissionManager = PermissionManager.shared - @State private var index = 0 var body: some View { - GeometryReader { geometry in - ScrollView { - VStack { - ZStack { - Image("mountain") - .resizable() - .scaledToFill() - .frame(width: geometry.size.width, height: 100) - .clipped() - - VStack(alignment: .trailing) { - Text("Skip") - .underline() - .default_text_style_600(styleSize: 15) + NavigationView { + GeometryReader { geometry in + ScrollView { + VStack { + ZStack { + Image("mountain") + .resizable() + .scaledToFill() + .frame(width: geometry.size.width, height: 100) + .clipped() + + VStack(alignment: .trailing) { + NavigationLink(destination: { + PermissionsFragment(sharedMainViewModel: sharedMainViewModel) + }, label: { + Text("Skip") + .underline() + .default_text_style_600(styleSize: 15) + + }) .padding(.top, -35) .padding(.trailing, 20) - .onTapGesture { - withAnimation { + .simultaneousGesture( + TapGesture().onEnded { self.index = 2 - permissionManager.cameraRequestPermission() + } + ) + Text("Welcome") + .welcome_text_style_white_800(styleSize: 35) + .padding(.trailing, 100) + .frame(width: geometry.size.width) + .padding(.bottom, -25) + Text("to Linphone") + .welcome_text_style_white_800(styleSize: 25) + .padding(.leading, 100) + .frame(width: geometry.size.width) + .padding(.bottom, -10) + } + .frame(width: geometry.size.width) + } + .padding(.top, 35) + .padding(.bottom, 10) + + Spacer() + + VStack { + TabView(selection: $index) { + ForEach((0..<3), id: \.self) { index in + if index == 0 { + WelcomePage1Fragment() + } else if index == 1 { + WelcomePage2Fragment() + } else if index == 2 { + WelcomePage3Fragment() + } else { + WelcomePage1Fragment() } } - Text("Welcome") - .welcome_text_style_white_800(styleSize: 35) - .padding(.trailing, 100) - .frame(width: geometry.size.width) - .padding(.bottom, -25) - Text("to Linphone") - .welcome_text_style_white_800(styleSize: 25) - .padding(.leading, 100) - .frame(width: geometry.size.width) - .padding(.bottom, -10) + } + .tabViewStyle(PageTabViewStyle(indexDisplayMode: .always)) + .frame(minHeight: 300) + .onAppear { + setupAppearance() + } } - .frame(width: geometry.size.width) - } - .padding(.top, 35) - .padding(.bottom, 10) - - Spacer() - - VStack { - TabView(selection: $index) { - ForEach((0..<3), id: \.self) { index in - if index == 0 { - WelcomePage1Fragment() - } else if index == 1 { - WelcomePage2Fragment() - } else if index == 2 { - WelcomePage3Fragment() - } else { - WelcomePage1Fragment() + + Spacer() + + if index == 2 { + NavigationLink(destination: { + PermissionsFragment(sharedMainViewModel: sharedMainViewModel) + }, label: { + Text("Start") + .default_text_style_white_600(styleSize: 20) + .frame(height: 35) + .frame(maxWidth: .infinity) + + }) + .padding(.horizontal, 20) + .padding(.vertical, 10) + .background(Color.orangeMain500) + .cornerRadius(60) + .padding(.horizontal) + .padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0) + .frame(maxWidth: sharedMainViewModel.maxWidth) + } else { + Button(action: { + withAnimation { + index += 1 } - } - } - .tabViewStyle(PageTabViewStyle(indexDisplayMode: .always)) - .frame(minHeight: 300) - .onAppear { - setupAppearance() + }, label: { + Text("Next") + .default_text_style_white_600(styleSize: 20) + .frame(height: 35) + .frame(maxWidth: .infinity) + }) + .padding(.horizontal, 20) + .padding(.vertical, 10) + .background(Color.orangeMain500) + .cornerRadius(60) + .padding(.horizontal) + .padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0) + .frame(maxWidth: sharedMainViewModel.maxWidth) } } - - Spacer() - - Button(action: { - if index < 2 { - withAnimation { - index += 1 - } - } else if index == 2 { - permissionManager.cameraRequestPermission() - } - }, label: { - Text(index == 2 ? "Start" : "Next") - .default_text_style_white_600(styleSize: 20) - .frame(height: 35) - .frame(maxWidth: .infinity) - }) - .padding(.horizontal, 20) - .padding(.vertical, 10) - .background(Color.orangeMain500) - .cornerRadius(60) - .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) } } - .onReceive(permissionManager.$cameraPermissionGranted, perform: { (granted) in - if granted { - withAnimation { - sharedMainViewModel.changeWelcomeView() - } - } - }) } func setupAppearance() {