/*
 * @Author: mojunshou 1637302775@qq.com
 * @Date: 2025-03-19 18:02:51
 * @LastEditors: mojunshou 1637302775@qq.com
 * @LastEditTime: 2025-04-08 17:09:27
 * @Description: 隐私挽留弹窗
 */
import { game } from 'cc';
import { _decorator, Component, Node } 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 { AndroidEvent } from '../config/AndroidEvent';
import { UIID } from '../config/GameUIConfig';
import { CocosHandler } from '../manager/CocosHandler';
const { ccclass, property } = _decorator;

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

    private async btn_agree() {
        console.log("同意");
        //调用安卓给权限
        if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
            let result = await CocosHandler.inst.savePrivacyStatus(true);
            if (result.code == 0) {
                CocosHandler.inst.ad_interstitial_start();
                oops.gui.remove(UIID.Retention);
            } else {
                oops.gui.toast("保存失败")
            }
        }
    }

    private btn_disagree() {
        console.log("不同意");
        game.end();
    }
}


