Example #1
0
 public static void GetMessages(int accountId,
                                string propertyHref,
                                SingleCampaignPostGetMessagesRequest gdpr,
                                SingleCampaignPostGetMessagesRequest ccpa,
                                int environment,
                                int millisTimeout)
 {
     CmpLocalizationMapper.environment = environment;
     NetworkClient.Instance.GetMessages(accountId,
                                        propertyHref,
                                        new CampaignsPostGetMessagesRequest(gdpr, ccpa),
                                        OnGetMessagesSuccessCallback,
                                        OnExceptionCallback,
                                        environment,
                                        millisTimeout);
 }
 public CampaignsPostGetMessagesRequest(SingleCampaignPostGetMessagesRequest gdpr, SingleCampaignPostGetMessagesRequest ccpa)
 {
     this.gdpr = gdpr;
     this.ccpa = ccpa;
 }
Example #3
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
        }