commit c86c3f39da6b7e19a8a884ddd80181f5b0162b23
parent 1e00836fccfcedffeb061b63eb17a384f4890d48
Author: triesap <137732411+triesap@users.noreply.github.com>
Date: Sat, 31 Aug 2024 09:59:55 +0000
Update `/settings` reset device util, add error log, minor edits
Diffstat:
5 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj
@@ -348,7 +348,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 17;
+ CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = AR84X5Z9HU;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Radroots;
@@ -370,7 +370,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 17;
+ CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = AR84X5Z9HU;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Radroots;
diff --git a/src/routes/(app)/nostr/notes/+page.svelte b/src/routes/(app)/nostr/notes/+page.svelte
@@ -8,16 +8,14 @@
import { ndk, trellis as Trellis } from "@radroots/svelte-lib";
import { writable } from "svelte/store";
- let ndk_sub = $derived(
- $ndk.subscribe(
- {
- kinds: [NDKKind.Text],
- authors: [$app_nostr_key],
- },
- {
- closeOnEose: false,
- },
- ),
+ let ndk_sub = $ndk.subscribe(
+ {
+ kinds: [NDKKind.Text],
+ authors: [$app_nostr_key],
+ },
+ {
+ closeOnEose: false,
+ },
);
const events_list = writable<NDKEvent[]>([]);
diff --git a/src/routes/(app)/nostr/profile/+page.svelte b/src/routes/(app)/nostr/profile/+page.svelte
@@ -3,6 +3,7 @@
import LayoutTrellis from "$lib/components/layout-trellis.svelte";
import LayoutView from "$lib/components/layout-view.svelte";
import Nav from "$lib/components/nav.svelte";
+ import { app_nostr_key } from "$lib/stores";
import { restart } from "$lib/utils";
import {
NDKEvent,
@@ -21,7 +22,7 @@
const ndk_filter: NDKFilter = {
kinds: [NDKKind.Metadata],
- // authors: [$app_nostr_key],
+ authors: [$app_nostr_key],
};
const ndk_opts: NDKSubscriptionOptions = {
closeOnEose: false,
diff --git a/src/routes/(app)/settings/+page.svelte b/src/routes/(app)/settings/+page.svelte
@@ -5,6 +5,7 @@
import Nav from "$lib/components/nav.svelte";
import { _cf } from "$lib/conf";
import { app_tabs_visible, app_thc } from "$lib/stores";
+ import { restart } from "$lib/utils";
import {
toggle_color_mode,
trellis as Trellis,
@@ -99,6 +100,7 @@
const public_key = await cl.preferences.get(
_cf.pref_key_active,
);
+ console.log(`public_key `, public_key);
const secret_key = await cl.keystore.get(
`nostr:key:${public_key}`,
);
@@ -140,18 +142,23 @@
`Hi! This will delete your saved keys.`,
);
if (confirm) {
- const public_key =
+ const nostr_public_key =
await cl.preferences.get(
_cf.pref_key_active,
);
- await cl.keystore.remove(
- `nostr:key:${public_key}`,
- );
- await cl.preferences.remove(
- _cf.pref_key_active,
- );
- await cl.window.splash_show();
- location.reload();
+ if (nostr_public_key) {
+ await cl.keystore.remove(
+ `nostr:key:${nostr_public_key}`,
+ );
+ await cl.preferences.remove(
+ _cf.pref_key_active,
+ );
+ await restart();
+ } else {
+ await cl.dialog.alert(
+ `There is no public key preference saved.`,
+ );
+ }
}
},
},
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
@@ -86,7 +86,9 @@
console.log(`(ndk_user) connected`);
}
}
- } catch(e) {};
+ } catch(e) {
+ console.log(`(app_nostr_key) error `, e);
+ };
})
app_config.subscribe(async (app_config) => {
@@ -94,8 +96,9 @@
if (!app_config) return;
app_sqlite.set(!!(await cl.db.connect(PUBLIC_DATABASE_NAME)));
const active_nostr_pk = await cl.preferences.get(_cf.pref_key_active);
- console.log(`active npub `, cl.nostr.lib.npub(active_nostr_pk))
+ console.log(`active_nostr_pk `, active_nostr_pk)
const active_nostr_sk = await cl.keystore.get(`nostr:key:${active_nostr_pk}`);
+ console.log(`active_nostr_sk `, active_nostr_sk)
if(typeof active_nostr_sk === `string` && active_nostr_sk && active_nostr_pk) app_nostr_key.set(active_nostr_pk);
else {
await cl.preferences.remove(_cf.pref_key_active);