Esempio n. 1
0
    public static void Consent(int actionCode)
    {
        lastActionCode = actionCode;
        switch (actionCode)
        {
        case 1:
            ConsentSaveAndExitVariables saveAndExitVariables = null;
            switch (CmpCampaignPopupQueue.CurrentCampaignToShow())
            {
            case 0:
                saveAndExitVariables = new ConsentGdprSaveAndExitVariables(
                    language: language,
                    privacyManagerId: privacyManagerId,
                    categories: CmpPmSaveAndExitVariablesContext.GetAcceptedCategories(),
                    vendors: CmpPmSaveAndExitVariablesContext.GetAcceptedVendors(),
                    specialFeatures: CmpPmSaveAndExitVariablesContext.GetSpecialFeatures());
                break;

            case 2:
                saveAndExitVariables = new ConsentCcpaSaveAndExitVariables(
                    language: language,
                    privacyManagerId: privacyManagerId,
                    rejectedCategories: CmpPmSaveAndExitVariablesContext.GetAcceptedCategories(),
                    rejectedVendors: CmpPmSaveAndExitVariablesContext.GetAcceptedVendors(),
                    specialFeatures: CmpPmSaveAndExitVariablesContext.GetSpecialFeatures());
                break;
            }
            NetworkClient.Instance.Consent(actionType: actionCode,
                                           environment: environment,
                                           language: language,
                                           privacyManagerId: privacyManagerId,
                                           onSuccessAction: OnConsentSuccessCallback,
                                           onErrorAction: OnExceptionCallback,
                                           pmSaveAndExitVariables: saveAndExitVariables);
            break;

        default:
            NetworkClient.Instance.Consent(actionType: actionCode,
                                           environment: environment,
                                           language: language,
                                           privacyManagerId: privacyManagerId,
                                           onSuccessAction: OnConsentSuccessCallback,
                                           onErrorAction: OnExceptionCallback);
            break;
        }
    }