-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #928 from Infomaniak/createAccount-view
feat: Create account view
- Loading branch information
Showing
15 changed files
with
632 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
Infomaniak Mail - iOS App | ||
Copyright (C) 2022 Infomaniak Network SA | ||
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 InfomaniakCoreUI | ||
import InfomaniakCreateAccount | ||
import InfomaniakDI | ||
import InfomaniakLogin | ||
import MailCore | ||
import MailResources | ||
import SwiftUI | ||
|
||
struct CreateAccountView: View { | ||
@AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor | ||
|
||
@State private var isPresentingCreateAccount = false | ||
@StateObject private var loginHandler = LoginHandler() | ||
|
||
var body: some View { | ||
VStack(spacing: 0) { | ||
accentColor.createAccountImage.swiftUIImage | ||
.resizable() | ||
.scaledToFit() | ||
.padding(.top, 24) | ||
.padding(.bottom, 48) | ||
|
||
Text(MailResourcesStrings.Localizable.newAccountTitle) | ||
.textStyle(.header1) | ||
.multilineTextAlignment(.center) | ||
.padding(.bottom, 24) | ||
|
||
HStack { | ||
Text(MailResourcesStrings.Localizable.newAccountStorageMail) | ||
.textStyle(.labelMediumAccent) | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.padding(8) | ||
.background(accentColor.secondary.swiftUIColor) | ||
.clipShape(Capsule()) | ||
.multilineTextAlignment(.center) | ||
Text(MailResourcesStrings.Localizable.newAccountStorageDrive) | ||
.textStyle(.labelMediumAccent) | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.padding(8) | ||
.background(accentColor.secondary.swiftUIColor) | ||
.clipShape(Capsule()) | ||
.multilineTextAlignment(.center) | ||
} | ||
.fixedSize(horizontal: false, vertical: true) | ||
.padding(.bottom, 24) | ||
|
||
Text(MailResourcesStrings.Localizable.newAccountDescription) | ||
.textStyle(.bodySmallSecondary) | ||
.padding(.bottom, 24) | ||
.multilineTextAlignment(.center) | ||
|
||
Spacer() | ||
|
||
MailButton(label: MailResourcesStrings.Localizable.buttonStart) { | ||
@InjectService var matomo: MatomoUtils | ||
matomo.track(eventWithCategory: .account, name: "openCreationWebview") | ||
isPresentingCreateAccount.toggle() | ||
} | ||
.mailButtonFullWidth(true) | ||
.padding(.bottom, 24) | ||
} | ||
.padding(.horizontal, 24) | ||
.sheet(isPresented: $isPresentingCreateAccount) { | ||
RegisterView(registrationProcess: .mail) { viewController in | ||
guard let viewController else { return } | ||
loginHandler.loginAfterAccountCreation(from: viewController) | ||
} | ||
} | ||
.matomoView(view: [MatomoUtils.View.onboarding.displayName, "CreateAccount"]) | ||
} | ||
} | ||
|
||
struct CreateAccountView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
CreateAccountView() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
MailResources/Assets.xcassets/create-account-blue.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "create-account-blue-light.svg", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"filename" : "create-account-blue-dark.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Oops, something went wrong.