Skip to content

Commit

Permalink
fixup! アカウント画面変更とPWAに追加ボタンを実装
Browse files Browse the repository at this point in the history
  • Loading branch information
MurakawaTakuya committed Jan 9, 2025
1 parent aecef76 commit 4d09a1a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Components/PWAButton/PWAButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export const PWAButton = ({
const isStandalone = window.matchMedia(
"(display-mode: standalone)"
).matches;
const isIosStandalone = (window.navigator as any).standalone === true;
setIsAlreadyInstalled(isStandalone || isIosStandalone);
const isIosStandalone =
"standalone" in window.navigator &&
(window.navigator as unknown as { standalone: boolean }).standalone;
setIsAlreadyInstalled(isStandalone || Boolean(isIosStandalone));
};

checkIfInstalled();
Expand Down
8 changes: 7 additions & 1 deletion src/app/account/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import Stack from "@mui/material/Stack";
import { styled } from "@mui/material/styles";
import { useEffect, useState } from "react";

declare global {
interface Navigator {
standalone?: boolean;
}
}

const Card = styled(MuiCard)(({ theme }) => ({
display: "flex",
flexDirection: "column",
Expand Down Expand Up @@ -41,7 +47,7 @@ export default function Account() {
};
setIsIOS(checkIOS());
}, []);

window.navigator.standalone === true;
// PWAか判定
useEffect(() => {
const checkPWA = () => {
Expand Down

0 comments on commit 4d09a1a

Please sign in to comment.