-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create authentication identity input view - WPB-15221 (#2343)
Co-authored-by: KaterinaWire <[email protected]>
- Loading branch information
1 parent
f5cd12e
commit 0b9b184
Showing
38 changed files
with
399 additions
and
59 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,14 @@ | ||
# Every input/output paths in the rest of the config will then be expressed relative to these. | ||
|
||
input_dir: ./ | ||
output_dir: ${GENERATED}/ | ||
|
||
# Generate constants for your localized strings. | ||
|
||
strings: | ||
inputs: | ||
- Resources/en.lproj/Localizable.strings | ||
filter: | ||
outputs: | ||
- templateName: structured-swift5 | ||
output: Strings+Generated.swift |
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
24 changes: 24 additions & 0 deletions
24
WireUI/Sources/WireAuthenticationUI/Resources/en.lproj/Localizable.strings
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,24 @@ | ||
// | ||
// Wire | ||
// Copyright (C) 2025 Wire Swiss GmbH | ||
// | ||
// 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/. | ||
// | ||
|
||
"authentication.identity.input.body" = "Simply enter your email address to start!"; | ||
"authentication.identity.input.field.placeholder" = "Email or SSO code"; | ||
"authentication.identity.input.field.title" = "Email or SSO code"; | ||
"authentication.identity.input.submit" = "Next"; | ||
"authentication.identity.input.terms" = "By pressing on “Next”, you accept Wire’s [Terms and Conditions](%@)"; | ||
|
106 changes: 106 additions & 0 deletions
106
WireUI/Sources/WireAuthenticationUI/Views/AuthenticationIdentityInputView.swift
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,106 @@ | ||
// | ||
// Wire | ||
// Copyright (C) 2025 Wire Swiss GmbH | ||
// | ||
// 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 WireDesign | ||
import WireFoundation | ||
import WireReusableUIComponents | ||
|
||
package struct AuthenticationIdentityInputView: View { | ||
|
||
package enum Action { | ||
case submit(identity: String) | ||
} | ||
|
||
@State private var identity: String = "" | ||
private let actionCallback: @Sendable (Action) -> Void | ||
private let termsURL: URL | ||
|
||
package init(actionCallback: @escaping @Sendable (Action) -> Void, termsURL: URL) { | ||
self.actionCallback = actionCallback | ||
self.termsURL = termsURL | ||
} | ||
|
||
package var body: some View { | ||
VStack(alignment: .center, spacing: 16) { | ||
HStack { | ||
Spacer() | ||
.frame(maxWidth: .infinity) | ||
Logo() | ||
.frame(width: 164, height: 95) | ||
Spacer() | ||
.frame(maxWidth: .infinity) | ||
} | ||
Text(L10n.Authentication.Identity.Input.body) | ||
.wireTextStyle(.body1) | ||
.lineLimit(nil) | ||
LabeledTextField( | ||
isMandatory: false, | ||
placeholder: L10n.Authentication.Identity.Input.Field.placeholder, | ||
title: L10n.Authentication.Identity.Input.Field.title, | ||
string: $identity | ||
) | ||
.lineLimit(nil) | ||
Button(action: { | ||
actionCallback(.submit(identity: identity)) | ||
}, label: { | ||
Text(L10n.Authentication.Identity.Input.submit) | ||
.lineLimit(nil) | ||
}) | ||
.wireButtonStyle(.primary) | ||
.disabled(identity.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty) | ||
Text(AttributedString.markdown(from: L10n.Authentication.Identity.Input.terms(termsURL.absoluteString))) | ||
.multilineTextAlignment(.center) | ||
.wireTextStyle(.subline1) | ||
.lineLimit(nil) | ||
} | ||
} | ||
} | ||
|
||
struct AuthenticationIdentityInputPreview: View { | ||
var body: some View { | ||
AuthenticationIdentityInputView( | ||
actionCallback: { _ in }, | ||
termsURL: URL(string: "https://example.com")! | ||
) | ||
.environment(\.wireTextStyleMapping, WireTextStyleMapping()) | ||
.padding(32) | ||
} | ||
} | ||
|
||
#Preview { | ||
BackgroundView() | ||
.overlay { | ||
VStack(spacing: 0) { | ||
Spacer() | ||
.frame(maxHeight: .infinity) | ||
if #available(iOS 16.4, *) { | ||
ScrollView(.vertical) { | ||
AuthenticationIdentityInputPreview() | ||
} | ||
.background() | ||
.scrollBounceBehavior(.basedOnSize) | ||
} else { | ||
ScrollView(.vertical) { | ||
AuthenticationIdentityInputPreview() | ||
} | ||
.background() | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.