Ejemplo n.º 1
0
    private static void OnConsentSuccessCallback(string json)
    {
        var consent = JsonSerializer.Deserialize <PostConsentResponse>(json);

        SaveContext.SaveLocalState(consent.localState);
        CmpPopupDestroyer.DestroyAllPopups();
        switch (CmpCampaignPopupQueue.CurrentCampaignToShow())
        {
        case 0:
            gdprUserConsent = consent.userConsent;
            SaveContext.SaveGdprUserConsent(gdprUserConsent);
            gdprUserConsent.uuid = consent.uuid;
            isGdprConsented      = true;
            CmpCampaignPopupQueue.DequeueCampaignId();
            break;

        case 2:
            ccpaUserConsent = consent.userConsent;
            SaveContext.SaveCcpaUserConsent(ccpaUserConsent);
            ccpaUserConsent.uuid = consent.uuid;
            isCcpaConsented      = true;
            CmpCampaignPopupQueue.DequeueCampaignId();
            break;
        }
        if (CmpCampaignPopupQueue.IsCampaignAvailable)
        {
            InstantiateOnCanvas(homePrefab);
        }
        else
        {
            CmpPopupDestroyer.DestroyAllHelperGO();
        }
    }
Ejemplo n.º 2
0
 private static void OnExceptionCallback(Exception ex)
 {
     UnityEngine.Debug.LogError("All popups will be destroyed!!!");
     CmpPopupDestroyer.DestroyAllPopups();
     cmpException = ex;
     CmpCampaignPopupQueue.DequeueCampaignId();
     if (CmpCampaignPopupQueue.IsCampaignAvailable)
     {
         InstantiateOnCanvas(homePrefab);
     }
 }
Ejemplo n.º 3
0
    private static void OnGetMessagesSuccessCallback(string json)
    {
        GetMessageResponse messages = NativeUiJsonDeserializer.DeserializeGetMessages(json);

        SaveContext.SaveCampaigns(messages.campaigns);
        SaveContext.SaveLocalState(messages.localState);
        SaveContext.SavePropertyId(messages.propertyId);
        var gdprCamp = messages.GetGdprCampaign();
        var ccpaCamp = messages.GetCcpaCampaign();

        if (gdprCamp != null)
        {
            if (gdprCamp?.message == null || gdprCamp.ui == null || gdprCamp.ui.Count == 0)
            {
                if (gdprCamp.userConsent == null)
                {
                    UnityEngine.Debug.LogError("UserConsent is NULL");
                }
                else
                {
                    gdprUserConsent = new PostConsentUserConsent()
                    {
                        TCData = gdprCamp.userConsent.TCData,
                        grants = gdprCamp.userConsent.grants,
                        // specialFeatures = gdprCamp.userConsent.,
                        // legIntCategories = gdprCamp.userConsent.,
                        // acceptedVendors = gdprCamp.userConsent.,
                        // acceptedCategories = gdprCamp.userConsent.,
                        euconsent      = gdprCamp.userConsent.euconsent,
                        addtlConsent   = gdprCamp.userConsent.addtlConsent,
                        dateCreated    = gdprCamp.userConsent.dateCreated,
                        consentedToAll = gdprCamp.userConsent.consentedToAll.GetValueOrDefault(false)
                    };
                    SaveContext.SaveGdprUserConsent(gdprUserConsent);
                    CmpCampaignPopupQueue.DequeueCampaignId();
                    isGdprConsented = true;
                }
            }
            else
            {
                GdprMessage gdpr = gdprCamp?.message;
                shortCategories = gdpr?.categories;
                popupBgColors   = gdprCamp?.popupBgColors;
                gdprElements    = gdprCamp?.ui;
            }
        }
        if (ccpaCamp != null)
        {
            if (ccpaCamp.userConsent != null && (!ccpaCamp.userConsent.newUser || ccpaCamp.userConsent.rejectedAll || ccpaCamp.userConsent.status.Equals("consentedAll")))
            {
                ccpaUserConsent = new PostConsentUserConsent()
                {
                    uspstring          = ccpaCamp.userConsent.uspstring,
                    status             = ccpaCamp.userConsent.status,
                    rejectedVendors    = ccpaCamp.userConsent.rejectedVendors.ToArray(),
                    rejectedCategories = ccpaCamp.userConsent.rejectedCategories.ToArray(),
                    signedLspa         = ccpaCamp.userConsent.signedLspa,
                    rejectedAll        = ccpaCamp.userConsent.rejectedAll,
                };
                SaveContext.SaveCcpaUserConsent(ccpaUserConsent);
                CmpCampaignPopupQueue.DequeueCampaignId();
                isCcpaConsented = true;
            }
            else if (ccpaCamp?.message != null || ccpaCamp.ui != null || ccpaCamp.ui.Count != 0)
            {
                BaseMessage ccpa = ccpaCamp?.message;
                popupBgColors = ccpaCamp.popupBgColors;
                ccpaElements  = ccpaCamp.ui;
                // shortCategories ??
            }
            else if (ccpaCamp.userConsent == null)
            {
                UnityEngine.Debug.LogError("UserConsent is NULL");
            }
        }
        isInitialized = true;
        if (!CmpCampaignPopupQueue.IsCampaignAvailable)
        {
            CmpPopupDestroyer.DestroyAllHelperGO();
        }
    }