From 9dcc3fea4e10965ced52b8af5698e7099988ebc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 4 Feb 2025 09:33:29 +0100 Subject: [PATCH] Block upvoting on logged out iOS app --- src/web/src/Vote.jsx | 7 ++++++- src/web/src/session.mjs | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/web/src/Vote.jsx b/src/web/src/Vote.jsx index 2bd118ce..6431b8ff 100644 --- a/src/web/src/Vote.jsx +++ b/src/web/src/Vote.jsx @@ -10,7 +10,7 @@ import * as API from "./API.mjs"; import { useSigner, useProvider, client, chains } from "./client.mjs"; import NFTModal from "./NFTModal.jsx"; import theme from "./theme.jsx"; -import { getLocalAccount } from "./session.mjs"; +import { getLocalAccount, isIOSApp } from "./session.mjs"; export const iconSVG = ( { signer && eligible(allowlist, delegations, await signer.getAddress()); + if (!isEligible && isIOSApp()) { + toast.error("Login to upvote"); + return; + } + if (!isEligible) { window.location.pathname = "/gateway"; return; diff --git a/src/web/src/session.mjs b/src/web/src/session.mjs index 744a05fb..c6009131 100644 --- a/src/web/src/session.mjs +++ b/src/web/src/session.mjs @@ -59,6 +59,10 @@ export function isIOS() { return iOS; } +export function isIOSApp() { + return document.documentElement.classList.contains("kiwi-ios-app"); +} + export function isFirefox() { const ua = navigator.userAgent; return !!ua.match(/Firefox/i);