Skip to content

Commit

Permalink
chore: use L10n strings
Browse files Browse the repository at this point in the history
  • Loading branch information
El-Fitz committed Jan 8, 2025
1 parent 1a3188f commit 0509462
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//

"authentication.identity.input.body" = "Simply enter you email adress to start!";
"authentication.identity.input.label.placeholder" = "Email or SSO code";
"authentication.identity.input.label.title" = "Email or SSO code";
"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](%@)";

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Wire
// Copyright (C) 2024 Wire Swiss GmbH
// 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
Expand All @@ -22,10 +22,17 @@ 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(termsURL: URL) {
package init(actionCallback: @escaping @Sendable (Action) -> Void, termsURL: URL) {
self.actionCallback = actionCallback
self.termsURL = termsURL
}

Expand All @@ -39,21 +46,21 @@ package struct AuthenticationIdentityInputView: View {
Spacer()
.frame(maxWidth: .infinity)
}
Text("Simply enter you email adress to start!")
Text(L10n.Authentication.Identity.Input.body)
.wireTextStyle(.body1)
LabeledTextField(
isMandatory: true,
placeholder: "Email or SSO code",
title: "Email or SSO code",
placeholder: L10n.Authentication.Identity.Input.Field.placeholder,
title: L10n.Authentication.Identity.Input.Field.title,
string: $identity
)
Button(action: {

actionCallback(.submit(identity: identity))
}, label: {
Text("Next")
Text(L10n.Authentication.Identity.Input.submit)
})
.wireButtonStyle(.primary)
Text(AttributedString.markdown(from: String(format: "By pressing on “Next”, you accept Wire’s [Terms and Conditions](%@)", termsURL.absoluteString)))
Text(AttributedString.markdown(from: L10n.Authentication.Identity.Input.terms(termsURL.absoluteString)))
.multilineTextAlignment(.center)
.wireTextStyle(.subline1)
}
Expand All @@ -62,9 +69,12 @@ package struct AuthenticationIdentityInputView: View {

struct AuthenticationIdentityInputPreview: View {
var body: some View {
AuthenticationIdentityInputView(termsURL: URL(string: "https://example.com")!)
.environment(\.wireTextStyleMapping, WireTextStyleMapping())
.padding(32)
AuthenticationIdentityInputView(
actionCallback: { _ in },
termsURL: URL(string: "https://example.com")!
)
.environment(\.wireTextStyleMapping, WireTextStyleMapping())
.padding(32)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class AuthenticationIdentityInputView: XCTestCase {
.verify(matching: view, named: "dark")
}


@MainActor
func testDynamicTypeVariants() {
let screenBounds = UIScreen.main.bounds
Expand Down

0 comments on commit 0509462

Please sign in to comment.