Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Password intersection with borders when importing keyset via banana split #2430

Open
wants to merge 3 commits into
base: fix/xcode16-build
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ios/PolkadotVault.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
0C2F8C4D2D512C34003A9DA0 /* PlainTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C2F8C4C2D512C34003A9DA0 /* PlainTextField.swift */; };
2D48F35127609CDE004B27BE /* HistoryCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D48F35027609CDE004B27BE /* HistoryCard.swift */; };
2D48F3532760A2D8004B27BE /* PrimaryFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D48F3522760A2D8004B27BE /* PrimaryFont.swift */; };
2D48F3D2277A0AB2004B27BE /* HistoryCardExtended.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D48F3D1277A0AB2004B27BE /* HistoryCardExtended.swift */; };
Expand Down Expand Up @@ -427,6 +428,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
0C2F8C4C2D512C34003A9DA0 /* PlainTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlainTextField.swift; sourceTree = "<group>"; };
2D48F35027609CDE004B27BE /* HistoryCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryCard.swift; sourceTree = "<group>"; };
2D48F3522760A2D8004B27BE /* PrimaryFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryFont.swift; sourceTree = "<group>"; };
2D48F3D1277A0AB2004B27BE /* HistoryCardExtended.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryCardExtended.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2273,6 +2275,7 @@
6D932CE5292E0CE6008AD883 /* PrimaryTextField.swift */,
6DA08B8729ACFC230027CFCB /* InlineTextField.swift */,
6D850BE1292F85F200BA9017 /* SecuredTextField.swift */,
0C2F8C4C2D512C34003A9DA0 /* PlainTextField.swift */,
);
path = TextFields;
sourceTree = "<group>";
Expand Down Expand Up @@ -2656,6 +2659,7 @@
6DF5E7A42923DD4400F2B5B4 /* Text+Markdown.swift in Sources */,
6D7DE0D42ACB178800BFAACA /* DatabaseVersionMediator.swift in Sources */,
6DDEF13228AE6039004CA2FD /* signer.udl in Sources */,
0C2F8C4D2D512C34003A9DA0 /* PlainTextField.swift in Sources */,
6DF8316728F9BA4A00CB2BCE /* CapsuleButton.swift in Sources */,
6DCC572728D8C0490014278A /* BackupModal.swift in Sources */,
6DDD73732940471900F04CE7 /* Event+AdditionalValue.swift in Sources */,
Expand Down
45 changes: 45 additions & 0 deletions ios/PolkadotVault/Components/TextFields/PlainTextField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// PlainTextField.swift
// Polkadot Vault
//
// Created by Ruslan Rezin on 03/02/2025.
//

import SwiftUI

struct PlainTextFieldStyle: ViewModifier {
let placeholder: String
let keyboardType: UIKeyboardType
@Binding var text: String
@Binding var isValid: Bool

func body(content: Content) -> some View {
content
.foregroundColor(isValid ? .textAndIconsPrimary : .accentRed300)
.placeholder(placeholder, when: text.isEmpty)
.font(PrimaryFont.bodyL.font)
.autocapitalization(.none)
.disableAutocorrection(true)
.keyboardType(keyboardType)
.submitLabel(.return)
.frame(height: Heights.textFieldHeight)
}
}

extension View {
func plainTextFieldStyle(
_ placeholder: String,
keyboardType: UIKeyboardType = .asciiCapable,
text: Binding<String>,
isValid: Binding<Bool> = Binding<Bool>.constant(true)
) -> some View {
modifier(
PlainTextFieldStyle(
placeholder: placeholder,
keyboardType: keyboardType,
text: text,
isValid: isValid
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct SecurePrimaryTextField: View {
var onCommit: (() -> Void) = {}

var body: some View {
ZStack(alignment: .trailing) {
HStack(alignment: .center, spacing: Spacing.minimal) {
ZStack {
SecureField("", text: $text, onCommit: {
onCommit()
Expand All @@ -39,7 +39,7 @@ struct SecurePrimaryTextField: View {
.focused($focusedField, equals: .plain)
.opacity(isSecured ? 0 : 1)
}
.primaryTextFieldStyle(placeholder, text: $text, isValid: $isValid)
.plainTextFieldStyle(placeholder, text: $text, isValid: $isValid)
.onChange(of: text) { _ in
isValid = true
}
Expand All @@ -50,9 +50,10 @@ struct SecurePrimaryTextField: View {
}
) {
Image(isSecured ? .showPassword : .hidePassword)
.padding(.trailing, Spacing.medium)
.foregroundColor(.textAndIconsTertiary)
}
}
.padding(.horizontal, Spacing.medium)
.containerBackground(CornerRadius.small, state: isValid ? .standard : .error)
}
}
Loading