Add paste button to login

Changelog-Added: Add paste button to login
Closes: #927
This commit is contained in:
Suhail Saqan
2023-04-14 20:45:43 -07:00
committed by William Casarin
parent ed058afc3b
commit f1a7c0eded

View File

@@ -159,6 +159,8 @@ struct LoginView: View {
.padding() .padding()
} }
Spacer()
if let p = parsed { if let p = parsed {
DamusWhiteButton(NSLocalizedString("Login", comment: "Button to log into account.")) { DamusWhiteButton(NSLocalizedString("Login", comment: "Button to log into account.")) {
if !process_login(p, is_pubkey: self.is_pubkey) { if !process_login(p, is_pubkey: self.is_pubkey) {
@@ -268,11 +270,13 @@ struct KeyInput: View {
} }
var body: some View { var body: some View {
ZStack(alignment: .leading) {
TextField("", text: key) TextField("", text: key)
.placeholder(when: key.wrappedValue.isEmpty) { .placeholder(when: key.wrappedValue.isEmpty) {
Text(title).foregroundColor(.white.opacity(0.6)) Text(title).foregroundColor(.white.opacity(0.6))
} }
.padding() .padding()
.padding(.leading, 20)
.background { .background {
RoundedRectangle(cornerRadius: 4.0).opacity(0.2) RoundedRectangle(cornerRadius: 4.0).opacity(0.2)
} }
@@ -280,6 +284,15 @@ struct KeyInput: View {
.foregroundColor(.white) .foregroundColor(.white)
.font(.body.monospaced()) .font(.body.monospaced())
.textContentType(.password) .textContentType(.password)
Label("", systemImage: "doc.on.clipboard")
.padding(.leading, 10)
.onTapGesture {
if let pastedkey = UIPasteboard.general.string {
self.key.wrappedValue = pastedkey
}
}
}
} }
} }