Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul authored and TonyGiorgio committed Oct 3, 2023
1 parent 85448fb commit 7a962c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/routes/settings/Gift.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";
import { eify } from "~/utils";
import { baseUrlAccountingForNative } from "~/utils/baseUrl";
import { createDeepSignal } from "~/utils/deepSignal";

type CreateGiftForm = {
Expand All @@ -57,10 +58,7 @@ export function SingleGift(props: {

const network = state.mutiny_wallet?.get_network();

const baseUrl =
network === "bitcoin"
? "https://app.mutinywallet.com"
: "https://signet-app.mutinywallet.com";
const baseUrl = baseUrlAccountingForNative(network);

const sharableUrl = () => baseUrl.concat(props.profile.url_suffix || "");
const amount = () => props.profile.budget_amount?.toString() || "0";
Expand Down Expand Up @@ -204,7 +202,7 @@ export default function GiftPage() {
return Number(getValue(giftForm, "amount")) < 50000;
};

const selfHosted = state.mutiny_wallet?.get_network() === "signet";
const selfHosted = state.settings?.selfhosted === "true";
const canGift = state.mutiny_plus || selfHosted;

return (
Expand Down
12 changes: 12 additions & 0 deletions src/utils/baseUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Capacitor } from "@capacitor/core";

// On mobile the origin URL is localhost, so we hardcode the base URL
export function baseUrlAccountingForNative(network?: string) {
if (Capacitor.isNativePlatform()) {
return network === "bitcoin"
? "https://app.mutinywallet.com"
: "https://signet-app.mutinywallet.com";
} else {
return window.location.origin;
}
}

0 comments on commit 7a962c5

Please sign in to comment.