Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 0d64307

Browse files
committed
Re-enable nwc subscriptions
1 parent 1fff601 commit 0d64307

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

public/i18n/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@
383383
"resets_every": "Resets every",
384384
"resubscribe_date": "Resubscribe on",
385385
"disable_connection": "Disable",
386-
"disabled": "This subscription is disabled. Currently you can't re-enable subscriptions, but we're working to fix that. Check back soon!",
387-
"disable_connection_confirm": "Are you sure you want to disable your subscription? Currently subscriptions can't be re-enabled, we're working to fix that."
386+
"enable_connection": "Enable",
387+
"disable_connection_confirm": "Are you sure you want to disable your subscription?"
388388
},
389389
"emergency_kit": {
390390
"title": "Emergency Kit",

src/routes/settings/Connections.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { NWCEditor } from "~/components/NWCEditor";
3535
import { useI18n } from "~/i18n/context";
3636
import { useMegaStore } from "~/state/megaStore";
3737
import { createDeepSignal, openLinkProgrammatically } from "~/utils";
38+
import { enable_nwc_profile } from "~/workers/walletWorker";
3839

3940
function Spending(props: { spent: number; remaining: number }) {
4041
const i18n = useI18n();
@@ -95,6 +96,15 @@ function NwcDetails(props: {
9596
}
9697
}
9798

99+
async function enableProfile() {
100+
try {
101+
await sw.enable_nwc_profile(props.profile.index);
102+
props.refetch();
103+
} catch (e) {
104+
console.error(e);
105+
}
106+
}
107+
98108
async function openInNostrClient() {
99109
const uri = props.profile.nwc_uri;
100110
await openLinkProgrammatically(uri, {
@@ -153,9 +163,13 @@ function NwcDetails(props: {
153163
<Show
154164
when={props.profile.enabled}
155165
fallback={
156-
<InfoBox accent="red">
157-
{i18n.t("settings.connections.disabled")}
158-
</InfoBox>
166+
<Button
167+
layout="small"
168+
intent="green"
169+
onClick={enableProfile}
170+
>
171+
{i18n.t("settings.connections.enable_connection")}
172+
</Button>
159173
}
160174
>
161175
<Button layout="small" intent="green" onClick={props.onEdit}>

src/workers/walletWorker.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,15 @@ export async function delete_nwc_profile(index: number): Promise<void> {
923923
await wallet!.delete_nwc_profile(index);
924924
}
925925

926+
/**
927+
* Re-enables a disabled nwc profile
928+
* @param {number} index
929+
* @returns {Promise<void>}
930+
*/
931+
export async function enable_nwc_profile(index: number): Promise<void> {
932+
await wallet!.enable_nwc_profile(index);
933+
}
934+
926935
/**
927936
* Get nostr wallet connect profiles
928937
* @returns {(NwcProfile)[]}

0 commit comments

Comments
 (0)