log disabled
This commit is contained in:
@@ -53,6 +53,25 @@ import { handleDeepLink } from './deepLinkHandler';
|
||||
|
||||
let foreGroundChangeTimer = null;
|
||||
|
||||
// 기존 콘솔 메서드를 백업
|
||||
const originalConsole = {
|
||||
log: console.log,
|
||||
error: console.error,
|
||||
warn: console.warn,
|
||||
info: console.info,
|
||||
};
|
||||
const enableConsole = () => {
|
||||
console.log = originalConsole.log;
|
||||
console.error = originalConsole.error;
|
||||
console.warn = originalConsole.warn;
|
||||
console.info = originalConsole.info;
|
||||
};
|
||||
const disableConsole = () => {
|
||||
console.log = function() {};
|
||||
// console.error = function() {};
|
||||
console.warn = function() {};
|
||||
console.info = function() {};
|
||||
};
|
||||
function AppBase(props) {
|
||||
const dispatch = useDispatch();
|
||||
const panels = useSelector((state) => state.panels.panels);
|
||||
@@ -64,6 +83,16 @@ function AppBase(props) {
|
||||
|
||||
const termsData = useSelector((state) => state.home.termsData);
|
||||
const introTermsAgreeRef = usePrevious(introTermsAgree);
|
||||
const logEnable = useSelector((state) => state.localSettings.logEnable);
|
||||
|
||||
useEffect(()=>{
|
||||
if(logEnable){
|
||||
enableConsole();
|
||||
}else{
|
||||
disableConsole();
|
||||
}
|
||||
},[logEnable]);
|
||||
|
||||
const hideCursor = useRef(
|
||||
new Job((func) => {
|
||||
func();
|
||||
@@ -208,6 +237,7 @@ function AppBase(props) {
|
||||
if (typeof window === "object" && !window.PalmSystem) {
|
||||
document.addEventListener("keydown", keyDownEvent);
|
||||
document.addEventListener("mousemove", mouseMoveEvent);
|
||||
document.addEventListener("wheel", mouseMoveEvent);
|
||||
}
|
||||
return () => {
|
||||
document.removeEventListener("visibilitychange", visibilityChanged);
|
||||
@@ -215,6 +245,7 @@ function AppBase(props) {
|
||||
if (typeof window === "object" && !window.PalmSystem) {
|
||||
document.removeEventListener("keydown", keyDownEvent);
|
||||
document.removeEventListener("mousemove", mouseMoveEvent);
|
||||
document.removeEventListener("wheel", mouseMoveEvent);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -8,6 +8,7 @@ const initialLocalSettings = {
|
||||
accessToken: null,
|
||||
refreshToken: null,
|
||||
phoneNumbers: {},
|
||||
logEnable: (typeof window === "object" && !window.PalmSystem)
|
||||
};
|
||||
|
||||
const updateInitialLocalSettings = () => {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import React, { useCallback, useMemo } from "react";
|
||||
import classNames from "classnames";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
||||
import RadioItem from '@enact/sandstone/RadioItem';
|
||||
import SwitchItem from '@enact/sandstone/SwitchItem';
|
||||
import css from "./DebugPanel.module.less";
|
||||
import TPanel from "../../components/TPanel/TPanel";
|
||||
import THeader from "../../components/THeader/THeader";
|
||||
@@ -24,6 +26,14 @@ export default function DebugPanel() {
|
||||
return v;
|
||||
}, [appStatus, httpHeader]);
|
||||
|
||||
const switches = useMemo(() => {
|
||||
let v = [];
|
||||
v.push({title: 'Log Enable', value: localSettings.logEnable, func:({selected}) => {
|
||||
dispatch(changeLocalSettings({ logEnable: selected }));
|
||||
}});
|
||||
return v;
|
||||
}, [dispatch, localSettings]);
|
||||
|
||||
const onChangeServer = useCallback((type) => () => {
|
||||
if(type === localSettings.serverType){
|
||||
return;
|
||||
@@ -78,6 +88,16 @@ export default function DebugPanel() {
|
||||
<RadioItem className={css.switch} disabled={disabledRic} selected={localSettings.ricCodeSetting === 'ruc'} onClick={onChangeServerRic('ruc')}>ruc</RadioItem>
|
||||
</div>
|
||||
</Container>
|
||||
{switches.map((item, index) => {
|
||||
return(
|
||||
<div className={css.titleArea} key={"switch"+index}>
|
||||
<div className={css.switchs}>
|
||||
<span className={classNames(css.switchTitle, item.important && css.important)}>{item.title}</span>
|
||||
<SwitchItem selected={item.value} onToggle={item.func} className={css.switch}>{item.value ? 'On' : 'Off'}</SwitchItem>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</Container>
|
||||
</TScroller>
|
||||
</TPanel>;
|
||||
|
||||
Reference in New Issue
Block a user