private IEnumerator WaitNetworkCoroutine()
    {
        if (!viewId.Equals("HomeView") && !viewId.Equals("PrivacyPolicyView") && !CmpLocalizationMapper.IsCurrentCampaignPmInitialized())
        {
            while (!CmpLocalizationMapper.IsCurrentCampaignPmInitialized())
            {
                yield return(new WaitForEndOfFrame());
            }
        }
        while (!CmpLocalizationMapper.IsInitialized)
        {
            yield return(new WaitForEndOfFrame());
        }

        if (!CmpLocalizationMapper.IsConsented || CmpLocalizationMapper.IsPmReadyForResurface)
        {
            SetBgColor();
            MapLocalization();
            MapPostponedLocalization();
            FillPostponedData();
            if (scrollController is CmpHomeScrollController home &&
                CmpLocalizationMapper.shortCategories != null &&
                CmpLocalizationMapper.shortCategories.Count > 0)
            {
                home.FillShortCategories(CmpLocalizationMapper.shortCategories);
            }
        }
        else
        {
            CmpPopupDestroyer.DestroyAllPopups();
        }
    }
Exemplo n.º 2
0
 public void OnSaveAndExitClick()
 {
     if (CmpCampaignPopupQueue.CurrentCampaignToShow() == 2 && dnsClicked)
     {
         OnRejectAllClick();
     }
     else
     {
         CmpLocalizationMapper.Consent(1);
     }
 }
Exemplo n.º 3
0
 private static void InstantiateHomePrefab(GameObject cmpHomePrefab, Canvas canvas)
 {
     if (cmpHomePrefab == null || canvas == null)
     {
         Debug.LogError("To use CMP UI on non-mobile platforms you have to provide CmpHomePrefab and Canvas!");
     }
     else
     {
         CmpLocalizationMapper.SetCanvas(cmpHomePrefab, canvas);
         mainThreadBroadcastEventsExecutor.InstantiateHomeView(cmpHomePrefab, canvas);
     }
 }
 private void MapPostponedLocalization()
 {
     foreach (var elementId in postponedElementId)
     {
         CmpUiElementModel initializer = CmpLocalizationMapper.GetCmpUiElement(viewId, elementId);
         if (initializer != null)
         {
             postponedElements[elementId] = initializer;
         }
         else
         {
             Debug.LogError(">>>DAFUQ >:C " + elementId);
         }
     }
 }
Exemplo n.º 5
0
        public static void LoadPrivacyManager(GameObject cmpHomePrefab,
                                              Canvas canvas,
                                              CAMPAIGN_TYPE campaignType,
                                              string privacyManagerId,
                                              string propertyId)
        {
#if !UNITY_ANDROID || (!UNITY_IOS && UNITY_EDITOR_OSX)
            CmpLocalizationMapper.propertyId       = propertyId;
            CmpLocalizationMapper.privacyManagerId = privacyManagerId;
            CreateBroadcastExecutorGO();
            if (campaignType == CAMPAIGN_TYPE.GDPR)
            {
                CmpCampaignPopupQueue.EnqueueCampaignId(0);
            }
            else
            {
                CmpCampaignPopupQueue.EnqueueCampaignId(2);
            }
            CmpLocalizationMapper.Message();
            InstantiateHomePrefab(cmpHomePrefab, canvas);
#endif
        }
 private void MapLocalization()
 {
     foreach (var ui in uiElements)
     {
         if (CmpCampaignPopupQueue.CurrentCampaignToShow() == 2)
         {
             var controller = ui.gameObject.GetComponent <CmpNativeButtonUiController>();
             if (controller != null && controller.ID.Equals("RejectAllButton"))
             {
                 controller.SetId("DoNotSellButton");
             }
         }
         CmpUiElementModel initializer = CmpLocalizationMapper.GetCmpUiElement(viewId, ui.ID);
         if (initializer != null)
         {
             if (initializer is CmpTextModel txt)
             {
                 string str = txt.Text;
                 if (str.Contains("<p>"))
                 {
                     str = str.Replace("<p>", "");
                 }
                 if (str.Contains("</p>"))
                 {
                     str = str.Replace("</p>", "");
                 }
                 txt.SetText(str);
             }
             ui.SetLocalization(initializer);
         }
         else
         {
             Debug.LogError(">>>DAFUQ >:C " + ui.ID);
         }
     }
 }
Exemplo n.º 7
0
 public void OnRejectAllClick()
 {
     CmpLocalizationMapper.Consent(13);
 }
Exemplo n.º 8
0
 public void OnAcceptAllClick()
 {
     CmpLocalizationMapper.Consent(11);
 }
 public void InstantiatePartnersDetails()
 {
     CmpLocalizationMapper.InstantiateOnCanvas(partnersDetails);
 }
 public void InstantiateVendorsDetails()
 {
     CmpLocalizationMapper.InstantiateOnCanvas(vendorsDetails);
 }
 public void InstantiatePrivacyPolicy()
 {
     CmpLocalizationMapper.InstantiateOnCanvas(privacyPolicy);
 }
 public void InstantiateManagePartners()
 {
     CmpLocalizationMapper.PrivacyManagerView(managePartners);
 }
 public void InstantiateManagePreferences()
 {
     CmpLocalizationMapper.PrivacyManagerView(managePreferences);
 }
Exemplo n.º 14
0
        public static void Initialize(List <SpCampaign> spCampaigns,
                                      int accountId,
                                      string propertyName,
                                      MESSAGE_LANGUAGE language,
                                      CAMPAIGN_ENV campaignsEnvironment,
                                      long messageTimeoutInSeconds = 3)
        {
            if (!IsSpCampaignsValid(spCampaigns))
            {
                return;
            }
            CreateBroadcastExecutorGO();
#if UNITY_ANDROID && !UNITY_EDITOR
            if (Application.platform == RuntimePlatform.Android)
            {
                //excluding ios14 campaign if any
                RemoveIos14SpCampaign(ref spCampaigns);
                if (!IsSpCampaignsValid(spCampaigns))
                {
                    return;
                }
                ConsentWrapperAndroid.Instance.InitializeLib(spCampaigns: spCampaigns,
                                                             accountId: accountId,
                                                             propertyName: propertyName,
                                                             language: language,
                                                             campaignsEnvironment: campaignsEnvironment,
                                                             messageTimeoutMilliSeconds: messageTimeoutInSeconds * 1000);
            }
#elif UNITY_IOS && !UNITY_EDITOR_OSX
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                ConsentWrapperIOS.Instance.InitializeLib(spCampaigns: spCampaigns,
                                                         accountId: accountId,
                                                         propertyName: propertyName,
                                                         language: language,
                                                         campaignsEnvironment: campaignsEnvironment,
                                                         messageTimeoutInSeconds: messageTimeoutInSeconds);
            }
#else
            CmpLocalizationMapper.language = CSharp2JavaStringEnumMapper.GetMessageLanguageKey(language);
            SingleCampaignPostGetMessagesRequest gdprTargetingParams = null;
            SpCampaign gdpr = spCampaigns.Find(x => x.CampaignType == CAMPAIGN_TYPE.GDPR);
            if (gdpr != null)
            {
                CmpCampaignPopupQueue.EnqueueCampaignId(0);
                Dictionary <string, string> tarParams = new Dictionary <string, string>();
                foreach (var param in gdpr.TargetingParams)
                {
                    tarParams[param.Key] = param.Value;
                }
                gdprTargetingParams = new SingleCampaignPostGetMessagesRequest(tarParams);
            }
            SingleCampaignPostGetMessagesRequest ccpaTargetingParams = null;
            SpCampaign ccpa = spCampaigns.Find(x => x.CampaignType == CAMPAIGN_TYPE.CCPA);
            if (ccpa != null)
            {
                CmpCampaignPopupQueue.EnqueueCampaignId(2);
                Dictionary <string, string> tarParams = new Dictionary <string, string>();
                foreach (var param in ccpa.TargetingParams)
                {
                    tarParams[param.Key] = param.Value;
                }
                ccpaTargetingParams = new SingleCampaignPostGetMessagesRequest(tarParams);
            }
            CmpLocalizationMapper.GetMessages(accountId: accountId,
                                              propertyHref: propertyName,
                                              gdpr: gdprTargetingParams,
                                              ccpa: ccpaTargetingParams,
                                              environment: (int)campaignsEnvironment,
                                              millisTimeout: Convert.ToInt32(messageTimeoutInSeconds * 1000));
#endif
        }