[SHOPTIME-3325] 앱 삭제 후 재설치 시 과거 데이터 유지됨
수정 내용: db8로 앱 첫실행 유무 flag 추가.
This commit is contained in:
@@ -15,6 +15,7 @@ import Spotlight from "@enact/spotlight";
|
|||||||
|
|
||||||
import appinfo from "../../webos-meta/appinfo.json";
|
import appinfo from "../../webos-meta/appinfo.json";
|
||||||
import { types } from "../actions/actionTypes";
|
import { types } from "../actions/actionTypes";
|
||||||
|
import { checkAppFirstLaunch } from "../actions/appDataActions";
|
||||||
import {
|
import {
|
||||||
changeAppStatus,
|
changeAppStatus,
|
||||||
deleteOldDb8Datas,
|
deleteOldDb8Datas,
|
||||||
@@ -132,6 +133,10 @@ function AppBase(props) {
|
|||||||
const oldDb8Deleted = useSelector(
|
const oldDb8Deleted = useSelector(
|
||||||
(state) => state.localSettings.oldDb8Deleted
|
(state) => state.localSettings.oldDb8Deleted
|
||||||
);
|
);
|
||||||
|
const isFirstLaunch = useSelector((state) => state.appData.isFirstLaunch);
|
||||||
|
const isFirstLaunchChecked = useSelector(
|
||||||
|
(state) => state.appData.isFirstLaunchChecked
|
||||||
|
);
|
||||||
|
|
||||||
const deviceCountryCode = httpHeader?.["X-Device-Country"] || "";
|
const deviceCountryCode = httpHeader?.["X-Device-Country"] || "";
|
||||||
|
|
||||||
@@ -150,10 +155,10 @@ function AppBase(props) {
|
|||||||
}, [logEnable]);
|
}, [logEnable]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!oldDb8Deleted) {
|
if (!oldDb8Deleted && !isFirstLaunch && isFirstLaunchChecked) {
|
||||||
dispatch(deleteOldDb8Datas());
|
dispatch(deleteOldDb8Datas());
|
||||||
}
|
}
|
||||||
}, [oldDb8Deleted]);
|
}, [oldDb8Deleted, isFirstLaunch, isFirstLaunchChecked]);
|
||||||
|
|
||||||
const hideCursor = useRef(
|
const hideCursor = useRef(
|
||||||
new Job((func) => {
|
new Job((func) => {
|
||||||
@@ -267,6 +272,8 @@ function AppBase(props) {
|
|||||||
window.PalmSystem.activate();
|
window.PalmSystem.activate();
|
||||||
window.lunaTest = (service, method, subscribe, parameters) =>
|
window.lunaTest = (service, method, subscribe, parameters) =>
|
||||||
lunaTest(service, method, subscribe, parameters);
|
lunaTest(service, method, subscribe, parameters);
|
||||||
|
|
||||||
|
dispatch(checkAppFirstLaunch());
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(getDeviceId());
|
dispatch(getDeviceId());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { URLS } from "../api/apiConfig";
|
import { URLS } from "../api/apiConfig";
|
||||||
import { TAxios } from "../api/TAxios";
|
import { TAxios } from "../api/TAxios";
|
||||||
|
import * as lunaSend from "../lunaSend";
|
||||||
import { types } from "./actionTypes";
|
import { types } from "./actionTypes";
|
||||||
|
|
||||||
export const addMainIndex = (index) => ({
|
export const addMainIndex = (index) => ({
|
||||||
@@ -65,3 +66,24 @@ export const sendSms = (params) => (dispatch, getState) => {
|
|||||||
export const clearSMS = () => ({
|
export const clearSMS = () => ({
|
||||||
type: types.CLEAR_SMS,
|
type: types.CLEAR_SMS,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const checkAppFirstLaunch = () => (dispatch) => {
|
||||||
|
lunaSend.checkFirstLaunch({
|
||||||
|
onSuccess: (res) => {
|
||||||
|
const isFirstLaunch = res.results.length === 0;
|
||||||
|
dispatch({
|
||||||
|
type: types.CHECK_FIRST_LAUNCH,
|
||||||
|
payload: isFirstLaunch,
|
||||||
|
isFirstLaunchChecked: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isFirstLaunch) {
|
||||||
|
lunaSend.setFirstLaunch({
|
||||||
|
onSuccess: () => {
|
||||||
|
dispatch({ type: types.SET_FIRST_LAUNCH });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -319,3 +319,55 @@ export const deleteOldDb8 = (kind, { onSuccess, onFailure, onComplete }) => {
|
|||||||
onComplete,
|
onComplete,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const checkFirstLaunch = ({ onSuccess, onFailure, onComplete }) => {
|
||||||
|
if (typeof window === "object" && !window.PalmSystem) {
|
||||||
|
console.log("LUNA SEND checkFirstLaunch");
|
||||||
|
onSuccess({ results: [] });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new LS2Request().send({
|
||||||
|
service: "luna://com.webos.service.db",
|
||||||
|
method: "find",
|
||||||
|
parameters: {
|
||||||
|
query: {
|
||||||
|
from: "com.shoptime.app.settings:1",
|
||||||
|
where: [
|
||||||
|
{
|
||||||
|
prop: "usedApp",
|
||||||
|
op: "=",
|
||||||
|
val: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onSuccess,
|
||||||
|
onFailure,
|
||||||
|
onComplete,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setFirstLaunch = ({ onSuccess, onFailure, onComplete }) => {
|
||||||
|
if (typeof window === "object" && !window.PalmSystem) {
|
||||||
|
console.log("LUNA SEND setFirstLaunch");
|
||||||
|
onSuccess();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new LS2Request().send({
|
||||||
|
service: "luna://com.webos.service.db",
|
||||||
|
method: "put",
|
||||||
|
parameters: {
|
||||||
|
objects: [
|
||||||
|
{
|
||||||
|
_kind: "com.shoptime.app.settings:1",
|
||||||
|
usedApp: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
onSuccess,
|
||||||
|
onFailure,
|
||||||
|
onComplete,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { types } from "../actions/actionTypes";
|
|||||||
const initialState = {
|
const initialState = {
|
||||||
mainIndex: null,
|
mainIndex: null,
|
||||||
sendSms: {},
|
sendSms: {},
|
||||||
|
isFirstLaunch: null,
|
||||||
|
isFirstLaunchChecked: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const appDataReducer = (state = initialState, action) => {
|
export const appDataReducer = (state = initialState, action) => {
|
||||||
@@ -22,6 +24,17 @@ export const appDataReducer = (state = initialState, action) => {
|
|||||||
...state,
|
...state,
|
||||||
sendSms: { retCode: undefined },
|
sendSms: { retCode: undefined },
|
||||||
};
|
};
|
||||||
|
case types.CHECK_FIRST_LAUNCH:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
isFirstLaunch: action.payload,
|
||||||
|
isFirstLaunchChecked: action.isFirstLaunchChecked,
|
||||||
|
};
|
||||||
|
case types.SET_FIRST_LAUNCH:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
isFirstLaunch: false,
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user