示例#1
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
        }
示例#2
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
        }