This patch simplifies the onboarding flow based on Jeroen's suggestions. Setup view: - Removes extra nostr information - Only shows two buttons, create account and sign in. Create Account view: - When a user uploads a photo it is now displayed - Name is now required - Public key is now hidden - Create account model has been updated to match metadata Save Keys view: - Removes the requirement to copy the nsec - Simplified explanation - Only shows two buttons, save and not now Testing —— iPhone 15 Pro Max (17.0) Light Mode: https://v.nostr.build/3P75x.mp4 iPhone SE (3rd generation) (16.4) Dark Mode: https://v.nostr.build/wGBQL.mp4 —— Changelog-Fixed: Create Account model now uses correct metadata Changelog-Changed: Onboarding design
40 lines
958 B
Swift
40 lines
958 B
Swift
//
|
|
// CreateAccountModel.swift
|
|
// damus
|
|
//
|
|
// Created by William Casarin on 2022-05-20.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
|
|
class CreateAccountModel: ObservableObject {
|
|
@Published var display_name: String = ""
|
|
@Published var name: String = ""
|
|
@Published var about: String = ""
|
|
@Published var pubkey: Pubkey = .empty
|
|
@Published var privkey: Privkey = .empty
|
|
@Published var profile_image: URL? = nil
|
|
|
|
var rendered_name: String {
|
|
if display_name.isEmpty {
|
|
return name
|
|
}
|
|
return display_name
|
|
}
|
|
|
|
var keypair: Keypair {
|
|
return Keypair(pubkey: self.pubkey, privkey: self.privkey)
|
|
}
|
|
|
|
init(display_name: String = "", name: String = "", about: String = "") {
|
|
let keypair = generate_new_keypair()
|
|
self.pubkey = keypair.pubkey
|
|
self.privkey = keypair.privkey
|
|
|
|
self.display_name = display_name
|
|
self.name = name
|
|
self.about = about
|
|
}
|
|
}
|