[SHOPTIME-3324] 약관 철회 후 재동의 시 과거 데이터 유지되는 현상
[SHOPTIME-3325] 앱 삭제 후 재설치 시 과거 데이터 유지됨 lunaSend db8 추가 (테스트 필요)
This commit is contained in:
@@ -17,6 +17,7 @@ import appinfo from "../../webos-meta/appinfo.json";
|
||||
import { types } from "../actions/actionTypes";
|
||||
import {
|
||||
changeAppStatus,
|
||||
checkFirstLaunch,
|
||||
deleteOldDb8Datas,
|
||||
getDeviceId,
|
||||
getHttpHeaderForServiceRequest,
|
||||
@@ -309,6 +310,8 @@ function AppBase(props) {
|
||||
})
|
||||
);
|
||||
}
|
||||
dispatch(checkFirstLaunch());
|
||||
|
||||
dispatch(
|
||||
getHomeTerms({
|
||||
mbrNo: loginUserData.userNumber,
|
||||
|
||||
@@ -4,6 +4,7 @@ import appinfo from "../../webos-meta/appinfo.json";
|
||||
import appinfo35 from "../../webos-meta/appinfo35.json";
|
||||
import appinfo79 from "../../webos-meta/appinfo79.json";
|
||||
import * as lunaSend from "../lunaSend";
|
||||
import { initialLocalSettings } from "../reducers/localSettingsReducer";
|
||||
import * as Config from "../utils/Config";
|
||||
import { types } from "./actionTypes";
|
||||
|
||||
@@ -508,3 +509,39 @@ export const deleteOldDb8Datas = () => (dispatch) => {
|
||||
}
|
||||
dispatch(changeLocalSettings({ oldDb8Deleted: true }));
|
||||
};
|
||||
|
||||
export const checkFirstLaunch = () => (dispatch) => {
|
||||
lunaSend.checkFirstLaunch({
|
||||
onSuccess: (res) => {
|
||||
if (!res.returnValue) {
|
||||
console.error("Failed to check first launch status");
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.results.length === 0) {
|
||||
console.log("First launch detected - initializing localStorage");
|
||||
|
||||
if (typeof window === "object") {
|
||||
dispatch(changeLocalSettings(initialLocalSettings));
|
||||
}
|
||||
|
||||
lunaSend.saveFirstLaunchInfo({
|
||||
onSuccess: (saveRes) => {
|
||||
console.log("First launch info saved to DB8:", saveRes);
|
||||
dispatch(changeAppStatus({ isFirstLaunch: true }));
|
||||
},
|
||||
onFailure: (err) => {
|
||||
console.error("Failed to save first launch info:", err);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log("Not first launch - keeping existing settings");
|
||||
|
||||
dispatch(changeAppStatus({ isFirstLaunch: false }));
|
||||
}
|
||||
},
|
||||
onFailure: (err) => {
|
||||
console.error("Failed to check first launch:", err);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -319,3 +319,50 @@ export const deleteOldDb8 = (kind, { onSuccess, onFailure, onComplete }) => {
|
||||
onComplete,
|
||||
});
|
||||
};
|
||||
|
||||
export const checkFirstLaunch = ({ onSuccess, onFailure, onComplete }) => {
|
||||
if (typeof window === "object" && !window.PalmSystem) {
|
||||
console.log("LUNA SEND checkFirstLaunch");
|
||||
return;
|
||||
}
|
||||
|
||||
return new LS2Request().send({
|
||||
service: "luna://com.webos.service.db",
|
||||
method: "find",
|
||||
parameters: {
|
||||
query: {
|
||||
from: `${appinfo.id}:1`,
|
||||
where: [{ prop: "type", op: "=", val: "app_init" }],
|
||||
},
|
||||
},
|
||||
onSuccess,
|
||||
onFailure,
|
||||
onComplete,
|
||||
});
|
||||
};
|
||||
|
||||
export const saveFirstLaunchInfo = ({ onSuccess, onFailure, onComplete }) => {
|
||||
if (typeof window === "object" && !window.PalmSystem) {
|
||||
console.log("LUNA SEND saveFirstLaunchInfo");
|
||||
onSuccess({ returnValue: true });
|
||||
return;
|
||||
}
|
||||
|
||||
return new LS2Request().send({
|
||||
service: "luna://com.webos.service.db",
|
||||
method: "put",
|
||||
parameters: {
|
||||
object: [
|
||||
{
|
||||
_kind: `${appinfo.id}:1`,
|
||||
type: "app_init",
|
||||
initialized: true,
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
],
|
||||
},
|
||||
onSuccess,
|
||||
onFailure,
|
||||
onComplete,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user