Skip to content

Commit

Permalink
Block upvoting on logged out iOS app
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDaub committed Feb 4, 2025
1 parent 7602e31 commit 9dcc3fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/web/src/Vote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<svg
Expand Down Expand Up @@ -124,6 +124,11 @@ const Vote = (props) => {
signer &&
eligible(allowlist, delegations, await signer.getAddress());

if (!isEligible && isIOSApp()) {
toast.error("Login to upvote");
return;
}

if (!isEligible) {
window.location.pathname = "/gateway";
return;
Expand Down
4 changes: 4 additions & 0 deletions src/web/src/session.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9dcc3fe

Please sign in to comment.