Skip to content

Commit

Permalink
Remove "clarity detector"
Browse files Browse the repository at this point in the history
  • Loading branch information
bhollis committed Dec 18, 2024
1 parent b39a834 commit ff82863
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 35 deletions.
1 change: 0 additions & 1 deletion config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@
"AutoRefresh": "DIM will automatically reload as long as you are still playing.",
"BulkTag": "Bulk tag items",
"BungieNetAlert": "Bungie Alert",
"Clarity": "The Clarity extension is no longer supported by its developers and can cause problems with DIM, such as excessive system utilization. Please uninstall it.",
"Clear": "Clear search filter",
"TagAs": "Tag as '{{tag}}'",
"CompareMatching": "Compare Items",
Expand Down
33 changes: 0 additions & 33 deletions src/app/shell/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import SearchFilter from '../search/SearchFilter';
import WhatsNewLink from '../whats-new/WhatsNewLink';
import AppInstallBanner from './AppInstallBanner';
import styles from './Header.m.scss';
import HeaderWarningBanner from './HeaderWarningBanner';
import MenuBadge from './MenuBadge';
import PostmasterWarningBanner from './PostmasterWarningBanner';
import RefreshButton from './RefreshButton';
Expand Down Expand Up @@ -287,7 +286,6 @@ export default function Header() {
useSetCSSVarToHeight(headerRef, '--header-height');

const headerLinksRef = useRef<HTMLDivElement>(null);
const clarityDetected = useClarityDetector(headerLinksRef);

const streamDeckEnabled = $featureFlags.elgatoStreamDeck
? // eslint-disable-next-line react-hooks/rules-of-hooks
Expand Down Expand Up @@ -403,11 +401,6 @@ export default function Header() {
{isPhonePortrait && installable && <AppInstallBanner onClick={installDim} />}
<PostmasterWarningBanner />
{$featureFlags.warnNoSync && <DimApiWarningBanner />}
{clarityDetected && (
<HeaderWarningBanner>
<span>{t('Header.Clarity')}</span>
</HeaderWarningBanner>
)}
{promptIosPwa && (
<Sheet header={<h1>{t('Header.InstallDIM')}</h1>} onClose={() => setPromptIosPwa(false)}>
<p className={styles.pwaPrompt}>{t('Header.IosPwaPrompt')}</p>
Expand All @@ -417,29 +410,3 @@ export default function Header() {
</PressTipRoot.Provider>
);
}

/**
* The Clarity extension is discontinued and causes memory/CPU issues in DIM.
* This detects the extension by watching for the menu item it inserts, and
* returns whether Clarity is installed.
*/
function useClarityDetector(ref: React.RefObject<HTMLElement>) {
const [clarityDetected, setClarityDetected] = useState(false);
useEffect(() => {
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (
mutation.type === 'childList' &&
Array.from(mutation.addedNodes ?? []).some(
(n) => n instanceof HTMLElement && n.classList.contains('Clarity_menu_button'),
)
) {
setClarityDetected(true);
}
}
});
observer.observe(ref.current!, { subtree: true, childList: true });
return () => observer.disconnect();
}, [ref]);
return clarityDetected;
}
1 change: 0 additions & 1 deletion src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@
"AutoRefresh": "DIM will automatically reload as long as you are still playing.",
"BulkTag": "Bulk tag items",
"BungieNetAlert": "Bungie Alert",
"Clarity": "The Clarity extension is no longer supported by its developers and can cause problems with DIM, such as excessive system utilization. Please uninstall it.",
"Clear": "Clear search filter",
"CompareMatching": "Compare Items",
"DeleteSearch": "Delete Search",
Expand Down

0 comments on commit ff82863

Please sign in to comment.