diff --git a/src/assets/icons/black-close.svg b/src/assets/icons/black-close.svg new file mode 100644 index 0000000..e73453e --- /dev/null +++ b/src/assets/icons/black-close.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/IOSbanner.tsx b/src/components/IOSbanner.tsx new file mode 100644 index 0000000..7a5c54e --- /dev/null +++ b/src/components/IOSbanner.tsx @@ -0,0 +1,50 @@ +import { Show } from "solid-js"; + +import close from "~/assets/icons/black-close.svg"; +import { ButtonLink } from "~/components"; +import { useMegaStore } from "~/state/megaStore"; + +export function IOSbanner() { + const [state, actions] = useMegaStore(); + + function closeBanner() { + actions.setTestFlightPromptDismissed(); + } + + return ( + <> + + + + + + + + iOS TESTFLIGHT FOR MUTINY + + USERS + + + + + Join + + + + {" "} + + + + > + ); +} diff --git a/src/components/index.ts b/src/components/index.ts index aac89aa..0323d92 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -45,3 +45,4 @@ export * from "./SyncContactsForm"; export * from "./GiftLink"; export * from "./MutinyPlusCta"; export * from "./ToggleHodl"; +export * from "./IOSbanner"; diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index a8b6bb5..371347b 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -462,6 +462,7 @@ export default { satisfaction: "Smug satisfaction", gifting: "Gifting", multi_device: "Multi-device access", + ios_beta_access: "iOS beta access", more: "... and more to come", cta_description: "Enjoy early access to new features and premium functionality.", diff --git a/src/routes/Main.tsx b/src/routes/Main.tsx index 7ad9051..16b4647 100644 --- a/src/routes/Main.tsx +++ b/src/routes/Main.tsx @@ -10,6 +10,7 @@ import { CombinedActivity, DecryptDialog, DefaultMain, + IOSbanner, LoadingIndicator, LoadingShimmer, Logo, @@ -23,11 +24,14 @@ import { import { useI18n } from "~/i18n/context"; import { FeedbackLink } from "~/routes/Feedback"; import { useMegaStore } from "~/state/megaStore"; +import { iosNotNative } from "~/utils/platform"; export function Main() { const i18n = useI18n(); const [state, _actions] = useMegaStore(); + const safari = iosNotNative(); + return ( @@ -71,6 +75,9 @@ export function Main() { + + + diff --git a/src/routes/settings/Plus.tsx b/src/routes/settings/Plus.tsx index e8bfaa5..3978f5b 100644 --- a/src/routes/settings/Plus.tsx +++ b/src/routes/settings/Plus.tsx @@ -14,6 +14,7 @@ import { Button, ConfirmDialog, DefaultMain, + ExternalLink, FancyCard, InfoBox, LargeHeader, @@ -37,6 +38,16 @@ function Perks(props: { alreadySubbed?: boolean }) { {i18n.t("settings.plus.satisfaction")} {i18n.t("settings.plus.gifting")} + + + + {i18n.t("settings.plus.ios_beta_access")} + + + {i18n.t("redshift.title")}{" "} {i18n.t("common.coming_soon")} diff --git a/src/state/megaStore.tsx b/src/state/megaStore.tsx index c63cc18..39d8dc0 100644 --- a/src/state/megaStore.tsx +++ b/src/state/megaStore.tsx @@ -67,6 +67,7 @@ export type MegaStore = [ npub?: string; preferredInvoiceType: "unified" | "lightning" | "onchain"; betaWarned: boolean; + testflightPromptDismissed: boolean; should_zap_hodl: boolean; }, { @@ -89,6 +90,7 @@ export type MegaStore = [ onSuccess: (value: ParsedParams) => void ): void; setBetaWarned(): void; + setTestFlightPromptDismissed(): void; toggleHodl(): void; } ]; @@ -126,7 +128,9 @@ export const Provider: ParentComponent = (props) => { npub: localStorage.getItem("npub") || undefined, preferredInvoiceType: "unified" as "unified" | "lightning" | "onchain", betaWarned: localStorage.getItem("betaWarned") === "true", - should_zap_hodl: localStorage.getItem("should_zap_hodl") === "true" + should_zap_hodl: localStorage.getItem("should_zap_hodl") === "true", + testflightPromptDismissed: + localStorage.getItem("testflightPromptDismissed") === "true" }); const actions = { @@ -365,6 +369,10 @@ export const Provider: ParentComponent = (props) => { localStorage.setItem("betaWarned", "true"); setState({ betaWarned: true }); }, + setTestFlightPromptDismissed() { + localStorage.setItem("testflightPromptDismissed", "true"); + setState({ testflightPromptDismissed: true }); + }, toggleHodl() { const should_zap_hodl = !state.should_zap_hodl; localStorage.setItem("should_zap_hodl", should_zap_hodl.toString()); diff --git a/src/utils/platform.ts b/src/utils/platform.ts new file mode 100644 index 0000000..171103b --- /dev/null +++ b/src/utils/platform.ts @@ -0,0 +1,21 @@ +// https://stackoverflow.com/questions/9038625/detect-if-device-is-ios + +import { Capacitor } from "@capacitor/core"; + +export function iosNotNative() { + if (Capacitor.isNativePlatform() || Capacitor.getPlatform() === "ios") { + return false; + } + return ( + [ + "iPad Simulator", + "iPhone Simulator", + "iPod Simulator", + "iPad", + "iPhone", + "iPod" + ].includes(navigator.platform) || + // iPad on iOS 13 detection + (navigator.userAgent.includes("Mac") && "ontouchend" in document) + ); +}