public void OnButtonClick() { if (scrollController is CmpCategoryDetailsScrollController catDetailsScroll) { var model = catDetailsScroll.GetModel(); model.accepted = true; switch (CmpCampaignPopupQueue.CurrentCampaignToShow()) { case 0: CmpPmSaveAndExitVariablesContext.AcceptCategory(model); break; case 2: CmpPmSaveAndExitVariablesContext.ExcludeCategory(model._id, true); break; } } else if (scrollController is CmpVendorDetailsScrollController vendDetailsScroll) { var model = vendDetailsScroll.GetModel(); model.accepted = true; switch (CmpCampaignPopupQueue.CurrentCampaignToShow()) { case 0: CmpPmSaveAndExitVariablesContext.AcceptVendor(model); break; case 2: CmpPmSaveAndExitVariablesContext.ExcludeVendor(model.vendorId, model.name); break; } } Destroy(scrollController.gameObject); }
private void Update() { if (CmpPmSaveAndExitVariablesContext.IsAcceptedCategoriesChanged) { FillCategoryView(); CmpPmSaveAndExitVariablesContext.SetAcceptedCategoriesChangedFalse(); } }
private void Update() { if (CmpPmSaveAndExitVariablesContext.IsAcceptedVendorsChanged) { FillVendorView(); CmpPmSaveAndExitVariablesContext.SetAcceptedVendorsChangedFalse(); } }
private void AddVendors(List <CmpVendorModel> vendors) { foreach (CmpVendorModel vendor in vendors) { bool isAccepted = CmpPmSaveAndExitVariablesContext.IsVendorAcceptedAnywhere(vendor.vendorId) || vendor.accepted; bool enableCustomTextLabel = vendor.vendorType != null && vendor.vendorType.Equals("CUSTOM"); CmpLongButtonUiController longController = AddCell(vendor.name, enableCustomTextLabel); longController.SetGroupState(isAccepted); CmpLongButtonController btn = longController.gameObject.AddComponent <CmpLongButtonController>(); btn.SetButtonRef(longController.GetButton()); btn.SetOnClickAction(delegate { InstantiateVendorDetailsPrefab(vendor); }); } }
private void AddCategories(List <CmpCategoryModel> categories) { if (categories.Count > 0) { AddDescriptionCell(cmpDescriptionCellPrefab, "PurposesHeader", "PurposesDefinition"); } foreach (CmpCategoryModel cat in categories) { var longController = AddCell(cat.name, cat.friendlyDescription); bool accepted = cat.accepted || CmpPmSaveAndExitVariablesContext.IsCategoryAcceptedAnywhere(cat._id); longController.SetGroupState(accepted); SetCellOnClickAction(longController, cat); } }
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; } }
public static void UpdateUserConsentUIState() { string key = userConsentKey; switch (CmpCampaignPopupQueue.CurrentCampaignToShow()) { case 0: key += gdprKey; break; case 2: key += ccpaKey; break; } var userConsent = saver.GetUserConsent(key); Dictionary <string, SpGetMessagesVendorGrant> grants = userConsent?.grants; if (key.Equals(userConsentKey + gdprKey) && grants == null) { return; } if (key.Equals(userConsentKey + ccpaKey)) { //CCPA var rejectedC = userConsent.rejectedCategories; var rejectedV = userConsent.rejectedVendors; if (rejectedC != null && CmpLocalizationMapper.CurrentCategories != null) { foreach (var categoryId in rejectedC) { //accepting category foreach (var cat in CmpLocalizationMapper.CurrentCategories) { if (cat._id.Equals(categoryId)) { cat.accepted = false; CmpPmSaveAndExitVariablesContext.AcceptCategoryFromPreviousSession(cat._id, false); break; } } //accepting vendor if at least 1 category is accepted // if (CmpLocalizationMapper.CurrentVendors != null) // { // foreach (var vendor in CmpLocalizationMapper.CurrentVendors) // { // vendor. // if (vendor.vendorId != null && vendor.vendorId.Equals(vendorId)) // { // // vendor.accepted = true; //TODO // // CmpPmSaveAndExitVariablesContext.AcceptVendor(vendor); // break; // } // } // } } } if (rejectedV != null && CmpLocalizationMapper.CurrentVendors != null) { foreach (var vendorId in rejectedV) { foreach (var vendor in CmpLocalizationMapper.CurrentVendors) { if (vendor.vendorId != null && vendor.vendorId.Equals(vendorId)) { vendor.accepted = false; CmpPmSaveAndExitVariablesContext.AcceptVendor(vendor, false); break; } } } } } else { //GDPR foreach (var kv in grants) { if (CmpLocalizationMapper.CurrentVendors != null && kv.Value.vendorGrant) { var vendorId = kv.Key; foreach (var vendor in CmpLocalizationMapper.CurrentVendors) { if (vendor.vendorId != null && vendor.vendorId.Equals(vendorId)) { vendor.accepted = true; CmpPmSaveAndExitVariablesContext.AcceptVendor(vendor); break; } } } foreach (var kvPups in kv.Value.purposeGrants) { if (CmpLocalizationMapper.CurrentCategories != null && kvPups.Value) { //accepting category var categoryId = kvPups.Key; foreach (var cat in CmpLocalizationMapper.CurrentCategories) { if (cat._id.Equals(categoryId)) { cat.accepted = true; CmpPmSaveAndExitVariablesContext.AcceptCategoryFromPreviousSession(cat._id); break; } } //accepting vendor if at least 1 category is accepted if (CmpLocalizationMapper.CurrentVendors != null) { var vendorId = kv.Key; foreach (var vendor in CmpLocalizationMapper.CurrentVendors) { if (vendor.vendorId != null && vendor.vendorId.Equals(vendorId)) { vendor.accepted = true; CmpPmSaveAndExitVariablesContext.AcceptVendor(vendor); break; } } } } } } } }