fully suport alby nostr-wallet-connect

This commit is contained in:
Ren Amamiya
2023-09-10 16:25:35 +07:00
parent a33c9d3517
commit 5bf816eba2
20 changed files with 425 additions and 364 deletions

View File

@@ -61,7 +61,7 @@ export function CreateStep2Screen() {
setLoading(true);
if (data.password.length > 3) {
const dir = await appConfigDir();
const stronghold = await Stronghold.load(`${dir}/lume.stronghold`, data.password);
const stronghold = await Stronghold.load(`${dir}lume.stronghold`, data.password);
if (!db.secureDB) db.secureDB = stronghold;

View File

@@ -61,7 +61,7 @@ export function ImportStep2Screen() {
setLoading(true);
if (data.password.length > 3) {
const dir = await appConfigDir();
const stronghold = await Stronghold.load(`${dir}/lume.stronghold`, data.password);
const stronghold = await Stronghold.load(`${dir}lume.stronghold`, data.password);
if (!db.secureDB) db.secureDB = stronghold;

View File

@@ -33,6 +33,7 @@ const resolver: Resolver<FormValues> = async (values) => {
export function UnlockScreen() {
const navigate = useNavigate();
const setPrivkey = useStronghold((state) => state.setPrivkey);
const setWalletConnectURL = useStronghold((state) => state.setWalletConnectURL);
const [showPassword, setShowPassword] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
@@ -55,8 +56,13 @@ export function UnlockScreen() {
if (!db.secureDB) db.secureDB = stronghold;
const privkey = await db.secureLoad(db.account.pubkey);
const uri = await db.secureLoad('walletConnectURL', 'alby');
setPrivkey(privkey);
console.log('found privkey: ', privkey);
console.log('found wallet conenct url: ', uri);
if (privkey) setPrivkey(privkey);
if (uri) setWalletConnectURL(uri);
// redirect to home
navigate('/', { replace: true });
} catch (e) {

View File

@@ -22,10 +22,9 @@ export function SplashScreen() {
const prefetch = async () => {
try {
const user = await fetchUserData();
const data = await prefetchEvents();
const [user, events] = await Promise.all([fetchUserData(), prefetchEvents()]);
if (user.status === 'ok' && data.status === 'ok') {
if (user.status === 'ok' && events.status === 'ok') {
// update last login = current time
await db.updateLastLogin();
// close splash screen and open main app screen

View File

@@ -289,7 +289,7 @@ export function EditProfileModal() {
<button
type="submit"
disabled={!isValid}
className="inline-flex h-11 w-full transform items-center justify-center gap-1 rounded-md bg-fuchsia-500 font-medium text-white hover:bg-fuchsia-600 focus:outline-none active:translate-y-1 disabled:pointer-events-none disabled:opacity-50"
className="inline-flex h-11 w-full transform items-center justify-center gap-1 rounded-lg bg-fuchsia-500 font-medium text-white hover:bg-fuchsia-600 focus:outline-none active:translate-y-1 disabled:pointer-events-none disabled:opacity-50"
>
{loading ? (
<LoaderIcon className="h-4 w-4 animate-spin text-black dark:text-white" />