2021-09-10 04:49:15 +08:00
|
|
|
import React from 'react';
|
2019-04-24 22:20:53 +08:00
|
|
|
import FullscreenButtonComponent from './component';
|
2022-02-15 22:42:02 +08:00
|
|
|
import { layoutSelect, layoutDispatch } from '/imports/ui/components/layout/context';
|
2021-11-20 03:26:04 +08:00
|
|
|
import FullscreenService from './service';
|
2019-04-24 22:20:53 +08:00
|
|
|
|
2021-07-06 22:17:00 +08:00
|
|
|
const FullscreenButtonContainer = (props) => <FullscreenButtonComponent {...props} />;
|
2019-04-24 22:20:53 +08:00
|
|
|
|
|
|
|
export default (props) => {
|
2021-11-20 03:26:04 +08:00
|
|
|
const handleToggleFullScreen = (ref) => FullscreenService.toggleFullScreen(ref);
|
|
|
|
const { isFullscreen } = props;
|
|
|
|
|
2021-07-06 22:17:00 +08:00
|
|
|
const isIphone = !!(navigator.userAgent.match(/iPhone/i));
|
2021-06-25 00:47:16 +08:00
|
|
|
|
2021-09-11 04:48:52 +08:00
|
|
|
const fullscreen = layoutSelect((i) => i.fullscreen);
|
2021-07-13 03:47:06 +08:00
|
|
|
const { element: currentElement, group: currentGroup } = fullscreen;
|
2021-09-11 04:48:52 +08:00
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2021-06-25 00:47:16 +08:00
|
|
|
|
2019-04-24 22:20:53 +08:00
|
|
|
return (
|
2021-07-06 22:17:00 +08:00
|
|
|
<FullscreenButtonContainer
|
|
|
|
{...props}
|
|
|
|
{...{
|
2021-11-20 03:26:04 +08:00
|
|
|
handleToggleFullScreen,
|
2021-07-06 22:17:00 +08:00
|
|
|
isIphone,
|
|
|
|
isFullscreen,
|
|
|
|
currentElement,
|
2021-07-13 03:47:06 +08:00
|
|
|
currentGroup,
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2021-07-06 22:17:00 +08:00
|
|
|
}}
|
|
|
|
/>
|
2019-04-24 22:20:53 +08:00
|
|
|
);
|
|
|
|
};
|