Skip to content

Commit

Permalink
Merge pull request #336 from arconnectio/development
Browse files Browse the repository at this point in the history
ArConnect BETA 1.11.2
  • Loading branch information
nicholaswma authored May 23, 2024
2 parents 121156b + cc2ad68 commit 9655e15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
18 changes: 10 additions & 8 deletions src/routes/popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { trackEvent, EventType, trackPage, PageType } from "~utils/analytics";
import styled from "styled-components";
import { useTokens } from "~tokens";
import { useAoTokens } from "~tokens/aoTokens/ao";
import { useBalance } from "~wallets/hooks";
import { useActiveWallet, useBalance } from "~wallets/hooks";
import BuyButton from "~components/popup/home/BuyButton";

export default function Home() {
Expand All @@ -26,7 +26,7 @@ export default function Home() {
key: "active_address",
instance: ExtensionStorage
});
const [, setShowAnnouncement] = useStorage<boolean>({
const [announcement, setShowAnnouncement] = useStorage<boolean>({
key: "show_announcement",
instance: ExtensionStorage
});
Expand All @@ -39,6 +39,9 @@ export default function Home() {
// ao Tokens
const [aoTokens] = useAoTokens();

// checking to see if it's a hardware wallet
const wallet = useActiveWallet();

// assets
const assets = useMemo(
() => tokens.filter((token) => token.type === "asset"),
Expand Down Expand Up @@ -90,7 +93,9 @@ export default function Home() {
}
};
checkExpiration();
}, []);

useEffect(() => {
// check whether to show announcement
(async () => {
// reset announcements if setting_notifications is uninitialized
Expand All @@ -99,17 +104,14 @@ export default function Home() {
setLoggedIn(true);
}

const announcement = await ExtensionStorage.get("show_announcement");
if (announcement === undefined) {
setShowAnnouncement(true);
}
if (announcement || announcement === "true") {
// WALLET.TYPE JUST FOR KEYSTONE POPUP
if (announcement && wallet?.type === "hardware") {
setOpen(true);
} else {
setOpen(false);
}
})();
}, []);
}, [wallet, announcement]);

return (
<HomeWrapper>
Expand Down
12 changes: 1 addition & 11 deletions src/utils/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,7 @@ export async function onInstalled(details: Runtime.OnInstalledDetailsType) {
browser.alarms.create("notifications", { periodInMinutes: 1 });

// reset notifications
const wallets = await getWallets();
const activeAddress = await getActiveAddress();
if (wallets && activeAddress) {
const activeWallet = wallets.find(
(wallet) => wallet.address === activeAddress
);

if (activeWallet && activeWallet.type === "hardware") {
await ExtensionStorage.set("show_announcement", true);
}
}
await ExtensionStorage.set("show_announcement", true);

// initialize tokens in wallet
await loadTokens();
Expand Down

0 comments on commit 9655e15

Please sign in to comment.