Browse Source

hide private key by default

Signed-off-by: Nitesh Balusu <niteshbalusu@icloud.com>
post-button-style
Nitesh Balusu 2 years ago
committed by William Casarin
parent
commit
5885859a48
  1. 26
      damus/Views/ConfigView.swift

26
damus/Views/ConfigView.swift

@ -5,8 +5,8 @@
// Created by William Casarin on 2022-06-09. // Created by William Casarin on 2022-06-09.
// //
import SwiftUI
import AVFoundation import AVFoundation
import SwiftUI
struct ConfigView: View { struct ConfigView: View {
let state: DamusState let state: DamusState
@ -14,6 +14,7 @@ struct ConfigView: View {
@State var show_add_relay: Bool = false @State var show_add_relay: Bool = false
@State var confirm_logout: Bool = false @State var confirm_logout: Bool = false
@State var new_relay: String = "" @State var new_relay: String = ""
@State var isHidden: Bool = true
var body: some View { var body: some View {
ZStack(alignment: .leading) { ZStack(alignment: .leading) {
@ -25,7 +26,6 @@ struct ConfigView: View {
RelayView(state: state, ev: ev, relay: relay) RelayView(state: state, ev: ev, relay: relay)
} }
} }
} }
} }
@ -40,12 +40,22 @@ struct ConfigView: View {
if let sec = state.keypair.privkey_bech32 { if let sec = state.keypair.privkey_bech32 {
Section("Secret Account Login Key") { Section("Secret Account Login Key") {
Text(sec) if isHidden == false {
.textSelection(.enabled) Text(sec)
.onTapGesture { .textSelection(.enabled)
UIPasteboard.general.string = sec .onTapGesture {
AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate)) UIPasteboard.general.string = sec
} AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate))
}
}
if isHidden == true {
Text("*******")
}
Button("Show/Hide Key") {
isHidden.toggle()
}
} }
} }

Loading…
Cancel
Save