internal PackageBuilder(AdjustConfig adjustConfig,
                         DeviceInfo deviceInfo,
                         ActivityState activityState,
                         SessionParameters sessionParameters,
                         DateTime createdAt)
     : this(adjustConfig, deviceInfo, activityState, createdAt)
 {
     // no need to copy because all access is made synchronously
     //  in Activity Handler inside internal functions.
     //  only exceptions are ´Enable´ and ´AskingAttribution´
     //  and they are not read here
     //_ActivityState = activityState;
     _sessionParameters = sessionParameters;
 }
示例#2
0
        private Dictionary <string, string> GetAttributableParameters(SessionParameters sessionParameters)
        {
            Dictionary <string, string> parameters = GetDefaultParameters();

            AddTimeSpan(parameters, "last_interval", _activityStateCopy.LastInterval);
            AddString(parameters, "default_tracker", _config.DefaultTracker);

            if (sessionParameters != null)
            {
                AddDictionaryJson(parameters, "callback_params", sessionParameters.CallbackParameters);
                AddDictionaryJson(parameters, "partner_params", sessionParameters.PartnerParameters);
            }

            return(parameters);
        }
示例#3
0
        internal SessionParameters Clone()
        {
            var copy = new SessionParameters();

            if (CallbackParameters != null)
            {
                copy.CallbackParameters = new Dictionary <string, string>(CallbackParameters);
            }

            if (PartnerParameters != null)
            {
                copy.PartnerParameters = new Dictionary <string, string>(PartnerParameters);
            }
            return(copy);
        }
示例#4
0
        public static SessionParameters FromDictionary(Dictionary <string, object> sessionParamsObjectMap)
        {
            var sessionParams = new SessionParameters();

            object callbackParamsJson;

            if (sessionParamsObjectMap.TryGetValue(CALLBACK_PARAMETERS, out callbackParamsJson))
            {
                sessionParams.CallbackParameters =
                    JsonConvert.DeserializeObject <Dictionary <string, string> >(callbackParamsJson.ToString());
            }

            object partnerParamsJson;

            if (sessionParamsObjectMap.TryGetValue(PARTNER_PARAMETERS, out partnerParamsJson))
            {
                sessionParams.PartnerParameters =
                    JsonConvert.DeserializeObject <Dictionary <string, string> >(partnerParamsJson.ToString());
            }

            return(sessionParams);
        }
示例#5
0
        public void UpdatePackages(SessionParameters sessionParameters)
        {
            var sessionParametersCopy = sessionParameters.Clone();

            _actionQueue.Enqueue(() => UpdatePackagesI(sessionParametersCopy));
        }