1
0
mirror of git://jb55.com/damus synced 2024-09-16 02:03:45 +00:00

perf: fix weird lag when switching timelines

This commit is contained in:
William Casarin 2023-09-10 16:11:39 -07:00
parent 36acdf420e
commit 5b901656f3
2 changed files with 9 additions and 9 deletions

View File

@ -30,8 +30,8 @@ struct FullKeypair: Equatable {
struct Keypair {
let pubkey: Pubkey
let privkey: Privkey?
let pubkey_bech32: String
let privkey_bech32: String?
//let pubkey_bech32: String
//let privkey_bech32: String?
static var empty: Keypair {
Keypair(pubkey: .empty, privkey: nil)
@ -52,8 +52,8 @@ struct Keypair {
init(pubkey: Pubkey, privkey: Privkey?) {
self.pubkey = pubkey
self.privkey = privkey
self.pubkey_bech32 = pubkey.npub
self.privkey_bech32 = privkey?.nsec
//self.pubkey_bech32 = pubkey.npub
//self.privkey_bech32 = privkey?.nsec
}
}

View File

@ -20,7 +20,7 @@ struct KeySettingsView: View {
@Environment(\.dismiss) var dismiss
init(keypair: Keypair) {
_privkey = State(initialValue: keypair.privkey_bech32 ?? "")
_privkey = State(initialValue: keypair.privkey?.nsec ?? "")
self.keypair = keypair
}
@ -40,7 +40,7 @@ struct KeySettingsView: View {
func CopyButton(is_pk: Bool) -> some View {
return Button(action: {
let copyKey = {
UIPasteboard.general.string = is_pk ? self.keypair.pubkey_bech32 : self.privkey
UIPasteboard.general.string = is_pk ? self.keypair.pubkey.npub : self.privkey
self.privkey_copied = !is_pk
self.pubkey_copied = is_pk
@ -74,14 +74,14 @@ struct KeySettingsView: View {
Form {
Section(NSLocalizedString("Public Account ID", comment: "Section title for the user's public account ID.")) {
HStack {
Text(keypair.pubkey_bech32)
Text(keypair.pubkey.npub)
CopyButton(is_pk: true)
}
.clipShape(RoundedRectangle(cornerRadius: 5))
}
if let sec = keypair.privkey_bech32 {
if let sec = keypair.privkey?.nsec {
Section(NSLocalizedString("Secret Account Login Key", comment: "Section title for user's secret account login key.")) {
HStack {
if show_privkey == false || !has_authenticated_locally {