/*
 * @Author: mojunshou 1637302775@qq.com
 * @Date: 2025-03-19 18:02:51
 * @LastEditors: mojunshou 1637302775@qq.com
 * @LastEditTime: 2025-04-27 09:53:39
 * @Description: 隐私挽留弹窗
 */
import { _decorator, game } from 'cc';
import { oops } from 'db://oops-framework/core/Oops';
import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
import { AD_TYPE } from '../config/GameDefine';
import { UIID } from '../config/GameUIConfig';
import { ADHandler } from '../manager/ADHandler';
import { LoginHandler } from '../manager/LoginHandler';
import { DCHandler } from '../manager/DCHandler';
import { ServerHandler } from '../manager/ServerHandler';
const { ccclass, property } = _decorator;

@ccclass('RetentionView')
export class RetentionView extends GameComponent {
    start() {
        this.setButton();
    }

    private async btn_agree() {
        DCHandler.inst.reportData(3000002);
        //调用安卓给权限
        if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
            LoginHandler.inst.savePrivacyStatus(true);
            this.scheduleOnce(() => {
                ADHandler.inst.showAd(AD_TYPE.Start);
                // ServerHandler.inst.getAccountInfo();
                oops.gui.remove(UIID.Retention);
            }, 0.2)

        }
    }

    private btn_disagree() {
        DCHandler.inst.reportData(3000003);
        game.end();
    }
}


