void OnErrorCallback(string jsonError) { CmpDebugUtil.LogError("OnErrorCallback IOS_CALLBACK_RECEIVED: " + jsonError); Exception ex = new Exception(jsonError); ConsentMessenger.Broadcast <IOnConsentError>(ex); }
private void InvokeLoadMessageWithAuthID(string authID) { CmpDebugUtil.Log("loadMessage(authId: String) STARTING..."); try { consentLib.Call("loadMessage", authID); } catch (Exception ex) { CmpDebugUtil.LogError(ex.Message); } finally { CmpDebugUtil.Log("loadMessage(authId: String) DONE"); } }
private void InvokeLoadPrivacyManager(string pmId, AndroidJavaObject tab, AndroidJavaObject campaignType, CAMPAIGN_TYPE campaignTypeForLog) { CmpDebugUtil.Log("InvokeLoadPrivacyManager() STARTING..."); try { consentLib.Call("loadPrivacyManager", pmId, tab, campaignType); CmpDebugUtil.Log($"loadPrivacyManager() with {campaignTypeForLog} is OK..."); } catch (Exception ex) { CmpDebugUtil.LogError(ex.Message); } finally { CmpDebugUtil.Log($"InvokeLoadPrivacyManager() with {campaignTypeForLog} DONE"); } }
private void InvokeLoadMessage() { CmpDebugUtil.Log("InvokeLoadMessage() STARTING..."); try { consentLib.Call("loadMessage"); CmpDebugUtil.Log($"loadMessage() is OK..."); } catch (Exception ex) { CmpDebugUtil.LogError(ex.Message); } finally { CmpDebugUtil.Log($"InvokeLoadMessage() DONE"); } }
public void LoadPrivacyManager(CAMPAIGN_TYPE campaignType, string pmId, PRIVACY_MANAGER_TAB tab) { #if UNITY_ANDROID if (Application.platform == RuntimePlatform.Android) { try { AndroidJavaObject type = constructor.ConstructCampaignType(campaignType); AndroidJavaObject privacyManagerTab = constructor.ConstructPrivacyManagerTab(tab); RunOnUiThread(delegate { InvokeLoadPrivacyManager(pmId, privacyManagerTab, type, campaignType); }); } catch (Exception e) { CmpDebugUtil.LogError(e.Message); } } #endif }
internal AndroidJavaObject ConstructCampaignType(CAMPAIGN_TYPE campaignType) { AndroidJavaObject type = null; switch (campaignType) { case CAMPAIGN_TYPE.GDPR: type = new AndroidJavaObject("com.sourcepoint.cmplibrary.exception.CampaignType", CAMPAIGN_TYPE_STRING_KEY.GDPR, (int)CAMPAIGN_TYPE_ANDROID.GDPR); //GDPR has ordinal 0 in Java enum! break; case CAMPAIGN_TYPE.CCPA: type = new AndroidJavaObject("com.sourcepoint.cmplibrary.exception.CampaignType", CAMPAIGN_TYPE_STRING_KEY.CCPA, (int)CAMPAIGN_TYPE_ANDROID.CCPA); //CCPA has ordinal 1 in Java enum! break; default: CmpDebugUtil.LogError("CampaignType is NULL. How did you get there?"); break; } CmpDebugUtil.Log($"CampaignType {campaignType} is OK"); return(type); }
public void InitializeLib(List <SpCampaign> spCampaigns, int accountId, string propertyName, MESSAGE_LANGUAGE language, CAMPAIGN_ENV campaignsEnvironment, long messageTimeoutMilliSeconds = 3000) { #if UNITY_ANDROID if (Application.platform == RuntimePlatform.Android) { try { AndroidJavaObject msgLang = constructor.ConstructMessageLanguage(language); AndroidJavaObject[] campaigns = new AndroidJavaObject[spCampaigns.Count]; foreach (SpCampaign sp in spCampaigns) { AndroidJavaObject typeAJO = constructor.ConstructCampaignType(sp.CampaignType); AndroidJavaObject[] paramsArray = new AndroidJavaObject[sp.TargetingParams.Count]; foreach (TargetingParam tp in sp.TargetingParams) { AndroidJavaObject param = constructor.ConstructTargetingParam(tp.Key, tp.Value); paramsArray[sp.TargetingParams.IndexOf(tp)] = param; } AndroidJavaObject paramsList = CmpJavaToUnityUtils.ConvertArrayToList(paramsArray); AndroidJavaObject campaign = constructor.ConstructCampaign(typeAJO, paramsList, sp.CampaignType); campaigns[spCampaigns.IndexOf(sp)] = campaign; } AndroidJavaObject spConfig = constructor.ConstructSpConfig(accountId: accountId, propertyName: propertyName, messageTimeout: messageTimeoutMilliSeconds, language: msgLang, campaignsEnvironment: campaignsEnvironment, spCampaigns: campaigns); consentLib = constructor.ConsrtuctLib(spConfig: spConfig, activity: this.activity, spClient: this.spClient); } catch (Exception e) { CmpDebugUtil.LogError(e.Message); } } #endif }
public void LoadMessage(string authId = null) { #if UNITY_ANDROID if (Application.platform == RuntimePlatform.Android) { try { if (string.IsNullOrEmpty(authId)) { RunOnUiThread(delegate { InvokeLoadMessage(); }); } else { RunOnUiThread(delegate { InvokeLoadMessageWithAuthID(authId); }); } } catch (Exception e) { CmpDebugUtil.LogError(e.Message); } } #endif }