AddPackage() публичный Метод

public AddPackage ( ActivityPackage activityPackage ) : void
activityPackage ActivityPackage
Результат void
Пример #1
0
        private void TrackEventInternal(AdjustEvent adjustEvent)
        {
            if (!IsEnabled())
            {
                return;
            }
            if (!CheckEvent(adjustEvent))
            {
                return;
            }

            var now = DateTime.Now;

            ActivityState.EventCount++;
            UpdateActivityState(now);

            var             packageBuilder = new PackageBuilder(AdjustConfig, DeviceInfo, ActivityState, now);
            ActivityPackage eventPackage   = packageBuilder.BuildEventPackage(adjustEvent);

            PackageHandler.AddPackage(eventPackage);

            if (AdjustConfig.EventBufferingEnabled)
            {
                Logger.Info("Buffered event {0}", eventPackage.Suffix);
            }
            else
            {
                PackageHandler.SendFirstPackage();
            }

            WriteActivityStateInternal();
        }
Пример #2
0
        private void OpenUrlInternal(Uri uri)
        {
            if (uri == null)
            {
                return;
            }

            var sUri = Uri.UnescapeDataString(uri.ToString());

            var windowsPhone80Protocol = "/Protocol?";

            if (sUri.StartsWith(windowsPhone80Protocol))
            {
                sUri = sUri.Substring(windowsPhone80Protocol.Length);
            }

            var queryStringIdx = sUri.IndexOf("?");

            // check if '?' exists and it's not the last char
            if (queryStringIdx == -1 || queryStringIdx + 1 == sUri.Length)
            {
                return;
            }

            var queryString = sUri.Substring(queryStringIdx + 1);

            // remove any possible fragments
            var fragmentIdx = queryString.LastIndexOf("#");

            if (fragmentIdx != -1)
            {
                queryString = queryString.Substring(0, fragmentIdx);
            }

            var  queryPairs      = queryString.Split('&');
            var  extraParameters = new Dictionary <string, string>(queryPairs.Length);
            var  attribution     = new AdjustAttribution();
            bool hasAdjustTags   = false;

            foreach (var pair in queryPairs)
            {
                if (ReadQueryString(pair, extraParameters, attribution))
                {
                    hasAdjustTags = true;
                }
            }

            if (!hasAdjustTags)
            {
                return;
            }

            var clickPackage = GetDeeplinkClickPackage(extraParameters, attribution);

            PackageHandler.AddPackage(clickPackage);
            PackageHandler.SendFirstPackage();
        }
Пример #3
0
        private void TransferSessionPackage()
        {
            // build Session Package
            var sessionBuilder = new PackageBuilder(AdjustConfig, DeviceInfo, ActivityState, DateTime.Now);
            var sessionPackage = sessionBuilder.BuildSessionPackage();

            // send Session Package
            PackageHandler.AddPackage(sessionPackage);
            PackageHandler.SendFirstPackage();
        }
Пример #4
0
        private void AddAndSendFirstPackageTest(PackageHandler packageHandler)
        {
            // add a package
            ActivityPackage activityPackage = CreateUnknowPackage("FirstPackage");

            // send the first package
            packageHandler.AddPackage(activityPackage);

            packageHandler.SendFirstPackage();
            DeviceUtil.Sleep(2000);

            AddPackageTests(1, "unknownFirstPackage");

            SendFirstTests(SendFirstState.SEND, "unknownFirstPackage");
        }