commit f1a7c0edede323ef8190d994084247a5e7729ce7
parent ed058afc3bdcf93ac32f0ffe4d5ca927e76a4ddb
Author: Suhail Saqan <suhail.saqan@gmail.com>
Date: Fri, 14 Apr 2023 20:45:43 -0700
Add paste button to login
Changelog-Added: Add paste button to login
Closes: #927
Diffstat:
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/damus/Views/LoginView.swift b/damus/Views/LoginView.swift
@@ -158,6 +158,8 @@ struct LoginView: View {
.foregroundColor(.white)
.padding()
}
+
+ Spacer()
if let p = parsed {
DamusWhiteButton(NSLocalizedString("Login", comment: "Button to log into account.")) {
@@ -268,18 +270,29 @@ struct KeyInput: View {
}
var body: some View {
- TextField("", text: key)
- .placeholder(when: key.wrappedValue.isEmpty) {
- Text(title).foregroundColor(.white.opacity(0.6))
- }
- .padding()
- .background {
- RoundedRectangle(cornerRadius: 4.0).opacity(0.2)
+ ZStack(alignment: .leading) {
+ TextField("", text: key)
+ .placeholder(when: key.wrappedValue.isEmpty) {
+ Text(title).foregroundColor(.white.opacity(0.6))
+ }
+ .padding()
+ .padding(.leading, 20)
+ .background {
+ RoundedRectangle(cornerRadius: 4.0).opacity(0.2)
+ }
+ .autocapitalization(.none)
+ .foregroundColor(.white)
+ .font(.body.monospaced())
+ .textContentType(.password)
+
+ Label("", systemImage: "doc.on.clipboard")
+ .padding(.leading, 10)
+ .onTapGesture {
+ if let pastedkey = UIPasteboard.general.string {
+ self.key.wrappedValue = pastedkey
+ }
}
- .autocapitalization(.none)
- .foregroundColor(.white)
- .font(.body.monospaced())
- .textContentType(.password)
+ }
}
}