Exemplo n.º 1
0
 public static void LifecycleStart(Dictionary <string, string> additionalContextData)
 {
     if (additionalContextData == null)
     {
         Debug.Log("Unable to perform LifecycleStart, context data is null");
         return;
     }
                 #if UNITY_ANDROID && !UNITY_EDITOR
     AndroidJavaObject contextData = ACPHelpers.GetStringHashMapFromDictionary(additionalContextData);
     if (contextData == null)
     {
         Debug.Log("Unable to perform LifecycleStart, invalid context data");
         return;
     }
     mobileCore.CallStatic("lifecycleStart", contextData);
                 #elif UNITY_IPHONE && !UNITY_EDITOR
     string jsonContextData = ACPHelpers.JsonStringFromStringDictionary(additionalContextData);
     if (jsonContextData == null)
     {
         Debug.Log("Unable to perform LifecycleStart, invalid context data");
         return;
     }
     acp_LifecycleStart(jsonContextData);
                 #endif
 }
Exemplo n.º 2
0
 public static void DispatchResponseEvent(ACPExtensionEvent responseEvent, ACPExtensionEvent requestEvent, AdobeExtensionErrorCallback errorCallback)
 {
     if (responseEvent == null || requestEvent == null)
     {
         Debug.Log("Unable to perform DispatchResponseEvent, responseEvent or requestEvent is null");
         return;
     }
                 #if UNITY_ANDROID && !UNITY_EDITOR
     AndroidJavaObject responseEventObject = ACPHelpers.GetAdobeEventFromACPExtensionEvent(responseEvent);
     AndroidJavaObject requestEventObject  = ACPHelpers.GetAdobeEventFromACPExtensionEvent(requestEvent);
     mobileCore.CallStatic <Boolean>("dispatchResponseEvent", responseEventObject, requestEventObject, new ExtensionErrorCallback(errorCallback));
                 #elif UNITY_IPHONE && !UNITY_EDITOR
     if (responseEvent.eventName == null || responseEvent.eventType == null || responseEvent.eventSource == null || requestEvent.eventName == null || requestEvent.eventType == null || requestEvent.eventSource == null)
     {
         Debug.Log("Unable to perform DispatchResponseEvent, input params are null");
         return;
     }
     string responseJsonDataEvent = ACPHelpers.JsonStringFromDictionary(responseEvent.eventData);
     string requestJsonDataEvent  = ACPHelpers.JsonStringFromDictionary(requestEvent.eventData);
     if (responseJsonDataEvent == null || requestJsonDataEvent == null)
     {
         Debug.Log("Unable to perform DispatchResponseEvent, responseEventData or requestEventData is invalid");
         return;
     }
     acp_DispatchResponseEvent(responseEvent.eventName, responseEvent.eventType, responseEvent.eventSource, responseJsonDataEvent,
                               requestEvent.eventName, requestEvent.eventType, requestEvent.eventSource, requestJsonDataEvent, errorCallback);
                 #endif
 }
Exemplo n.º 3
0
 public static void DispatchEventWithResponseCallback(ACPExtensionEvent acpExtensionEvent, AdobeEventCallback responseCallback, AdobeExtensionErrorCallback errorCallback)
 {
     if (acpExtensionEvent == null)
     {
         Debug.Log("Unable to perform DispatchEventWithResponseCallback, acpExtensionEvent is null");
         return;
     }
                 #if UNITY_ANDROID && !UNITY_EDITOR
     AndroidJavaObject eventObj = ACPHelpers.GetAdobeEventFromACPExtensionEvent(acpExtensionEvent);
     mobileCore.CallStatic <Boolean>("dispatchEventWithResponseCallback", eventObj, new EventCallback(responseCallback), new ExtensionErrorCallback(errorCallback));
                 #elif UNITY_IPHONE && !UNITY_EDITOR
     if (acpExtensionEvent.eventName == null || acpExtensionEvent.eventType == null || acpExtensionEvent.eventSource == null)
     {
         Debug.Log("Unable to perform DispatchEventWithResponseCallback, input params are null");
         return;
     }
     string jsonDataEvent = ACPHelpers.JsonStringFromDictionary(acpExtensionEvent.eventData);
     if (jsonDataEvent == null)
     {
         Debug.Log("Unable to perform DispatchEventWithResponseCallback, invalid event data");
         return;
     }
     acp_DispatchEventWithResponseCallback(acpExtensionEvent.eventName, acpExtensionEvent.eventType, acpExtensionEvent.eventSource, jsonDataEvent, responseCallback, errorCallback);
                 #endif
 }
Exemplo n.º 4
0
        public static void SyncIdentifiers(Dictionary <string, string> ids, ACPAuthenticationState authenticationState)
        {
            if (ids == null)
            {
                Debug.Log("Unable to perform SyncIdentifiers, ids are null");
                return;
            }

                        #if UNITY_ANDROID && !UNITY_EDITOR
            using (var authStateClass = new AndroidJavaClass("com.adobe.marketing.mobile.VisitorID$AuthenticationState"))
            {
                var authStateObj        = authStateClass.GetStatic <AndroidJavaObject>(authenticationState.ToString());
                AndroidJavaObject idMap = ACPHelpers.GetStringHashMapFromDictionary(ids);
                identity.CallStatic("syncIdentifiers", idMap, authStateObj);
            }
                        #elif UNITY_IPHONE && !UNITY_EDITOR
            string idsDict = ACPHelpers.JsonStringFromStringDictionary(ids);
            if (idsDict == null)
            {
                Debug.Log("Unable to perform SyncIdentifiers, ids are invalid");
                return;
            }
            acp_SyncIdentifiersWithAuthState(idsDict, (int)authenticationState);
                        #endif
        }
Exemplo n.º 5
0
        void call(AndroidJavaObject eventObj)
        {
            string                      eventName        = eventObj.Call <string>("getName");
            string                      eventType        = eventObj.Call <string>("getType");
            string                      eventSource      = eventObj.Call <string>("getSource");
            AndroidJavaObject           eventDataHashmap = eventObj.Call <AndroidJavaObject>("getEventData");
            Dictionary <string, object> eventData        = ACPHelpers.GetDictionaryFromHashMap(eventDataHashmap);

            redirectedDelegate(eventName, eventType, eventSource, ACPHelpers.JsonStringFromDictionary(eventData));
        }
Exemplo n.º 6
0
 public static void TrackAction(string name, Dictionary <string, string> contextDataDict)
 {
     if (name == null || contextDataDict == null)
     {
         Debug.Log("Unable to perform track action, invalid input");
         return;
     }
                 #if UNITY_ANDROID && !UNITY_EDITOR
     AndroidJavaObject contextData = ACPHelpers.GetStringHashMapFromDictionary(contextDataDict);
     mobileCore.CallStatic("trackAction", name, contextData);
                 #elif UNITY_IPHONE && !UNITY_EDITOR
     string cData = ACPHelpers.JsonStringFromStringDictionary(contextDataDict);
     if (cData == null)
     {
         Debug.Log("Unable to perform track action, contextDataDict is invalid");
         return;
     }
     acp_TrackAction(name, cData);
                 #endif
 }
Exemplo n.º 7
0
 public static void UpdateConfiguration(Dictionary <string, object> config)
 {
     if (config == null)
     {
         Debug.Log("Unable to perform UpdateConfiguration, invalid config");
         return;
     }
                 #if UNITY_ANDROID && !UNITY_EDITOR
     var map = ACPHelpers.GetHashMapFromDictionary(config);
     mobileCore.CallStatic("updateConfiguration", map);
                 #elif UNITY_IPHONE && !UNITY_EDITOR
     string cData = ACPHelpers.JsonStringFromDictionary(config);
     if (cData == null)
     {
         Debug.Log("Unable to perform UpdateConfiguration, invalid config");
         return;
     }
     acp_UpdateConfiguration(ACPHelpers.JsonStringFromDictionary(config));
                 #endif
 }
Exemplo n.º 8
0
        void call(AndroidJavaObject visitorIds)
        {
            if (visitorIds == null)
            {
                redirectedDelegate("");
                return;
            }

            int           length     = visitorIds.Call <int>("size");
            List <string> visIdsList = new List <string>();

            for (int i = 0; i < length; i++)
            {
                AndroidJavaObject           visitorId     = visitorIds.Call <AndroidJavaObject>("get", i);
                Dictionary <string, string> vistiorIdDict = ACPIdentity.dictFromVisitorIdentifier(visitorId);
                visIdsList.Add(ACPHelpers.JsonStringFromStringDictionary(vistiorIdDict));
            }
            string result = string.Join(",", visIdsList.ToArray());

            redirectedDelegate(result);
        }
Exemplo n.º 9
0
        public static void SyncIdentifiers(Dictionary <string, string> ids)
        {
            if (ids == null)
            {
                Debug.Log("Unable to perform SyncIdentifiers, ids are null");
                return;
            }

                        #if UNITY_ANDROID && !UNITY_EDITOR
            AndroidJavaObject idMap = ACPHelpers.GetStringHashMapFromDictionary(ids);
            identity.CallStatic("syncIdentifiers", idMap);
                        #elif UNITY_IPHONE && !UNITY_EDITOR
            string idsDict = ACPHelpers.JsonStringFromStringDictionary(ids);
            if (idsDict == null)
            {
                Debug.Log("Unable to perform SyncIdentifiers, ids are invalid");
                return;
            }
            acp_SyncIdentifiers(idsDict);
                        #endif
        }