import { useEffect } from 'react';
import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
import bridge from '@arcblock/bridge';

// 在 wallet webview 环境中, 隐藏 wallet topbar
// eslint-disable-next-line import/prefer-default-export
export const useWalletHiddenTopbar = () => {
  const browser = useBrowser();
  useEffect(() => {
    if (browser.wallet || browser.arcSphere) {
      bridge.call('arcHideTopBar', '{}');
    }
  }, [browser]);
};
