Exemple #1
0
        public static void SetTestOptions(Pcl.IntegrationTesting.AdjustTestOptions testOptions)
        {
            if (testOptions.Teardown.HasValue && testOptions.Teardown.Value)
            {
                if (AdjustInstance != null)
                {
                    AdjustInstance.Teardown();
                }

                _isApplicationActive = false;
                DeviceUtil           = null;
                AdjustInstance       = null;
                AdjustFactory.Teardown();

                // check whether to delete state
                if (testOptions.DeleteState.HasValue && testOptions.DeleteState.Value)
                {
                    ClearAllPersistedObjects();
                    ClearAllPeristedValues();
                }
            }

            if (AdjustInstance == null)
            {
                AdjustInstance = new AdjustInstance();
            }

            AdjustInstance.SetTestOptions(testOptions);
        }
Exemple #2
0
        public static bool GetDeeplinkCacheValues(IDeviceUtil deviceUtil, out Uri deeplinkUri, out DateTime clickTime)
        {
            deeplinkUri = null;
            clickTime   = new DateTime();

            string deeplinkUriStr;

            deviceUtil.TryTakeSimpleValue(DEEPLINK_URL, out deeplinkUriStr);
            string deeplinkUrlClickTimeStr;

            deviceUtil.TryTakeSimpleValue(DEEPLINK_CLICK_TIME, out deeplinkUrlClickTimeStr);

            if (deeplinkUriStr == null || deeplinkUrlClickTimeStr == null)
            {
                return(false);
            }

            long deeplinkUrlClickTimeTicks;

            if (!long.TryParse(deeplinkUrlClickTimeStr, out deeplinkUrlClickTimeTicks))
            {
                return(false);
            }

            deeplinkUri = new Uri(deeplinkUriStr);
            clickTime   = new DateTime(deeplinkUrlClickTimeTicks);

            return(true);
        }
Exemple #3
0
 public void Init(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused)
 {
     _activityHandler = activityHandler;
     _deviceUtil      = deviceUtil;
     _isPaused        = startPaused;
     _basePath        = activityHandler.BasePath;
 }
        private void InitI(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused)
        {
            ReadPackageQueueI();

            _internalWaitHandle = new ManualResetEvent(true); // door starts open (signaled)

            _requestHandler = AdjustFactory.GetRequestHandler(SendNextPackage, CloseFirstPackage);
        }
Exemple #5
0
        public static IActivityHandler GetActivityHandler(AdjustConfig adjustConfig, IDeviceUtil deviceUtil)
        {
            if (_iActivityHandler == null)
            {
                return(ActivityHandler.GetInstance(adjustConfig, deviceUtil));
            }

            _iActivityHandler.Init(adjustConfig, deviceUtil);
            return(_iActivityHandler);
        }
Exemple #6
0
        public static bool IsMarkedGdprForgotten(IDeviceUtil deviceUtil)
        {
            string isGdprForgottenStr;

            if (deviceUtil.TryTakeSimpleValue(GDPR_USER_FORGOTTEN, out isGdprForgottenStr))
            {
                return(!string.IsNullOrEmpty(isGdprForgottenStr) && isGdprForgottenStr == "true");
            }
            return(false);
        }
Exemple #7
0
        public void GdprForgetMe(IDeviceUtil deviceUtil)
        {
            Util.MarkGdprForgotten(deviceUtil);

            if (CheckActivityHandler("GDPR forget me"))
            {
                if (_activityHandler.IsEnabled())
                {
                    _activityHandler.SetGdprForgetMe();
                }
            }
        }
Exemple #8
0
        public void SetPushToken(string pushToken, IDeviceUtil deviceUtil)
        {
            deviceUtil.PersistSimpleValue(ADJUST_PUSH_TOKEN, pushToken);

            if (CheckActivityHandler())
            {
                if (_activityHandler.IsEnabled())
                {
                    _activityHandler.SetPushToken(pushToken);
                }
            }
        }
Exemple #9
0
        public void ApplicationLaunching(AdjustConfig adjustConfig, IDeviceUtil deviceUtil)
        {
            adjustConfig.PreLaunchActions = _preLaunchActions;
            adjustConfig.StartEnabled     = _startEnabled;
            adjustConfig.StartOffline     = _startOffline;

            AdjustConfig.String2Sha256Func = deviceUtil.HashStringUsingSha256;
            AdjustConfig.String2Sha512Func = deviceUtil.HashStringUsingSha512;
            AdjustConfig.String2Md5Func    = deviceUtil.HashStringUsingShaMd5;

            _activityHandler = ActivityHandler.GetInstance(adjustConfig, deviceUtil);
        }
Exemple #10
0
        public void AppWillOpenUrl(Uri uri, IDeviceUtil deviceUtil)
        {
            var clickTime = DateTime.Now;

            if (!CheckActivityHandler())
            {
                deviceUtil.PersistSimpleValue(DEEPLINK_URL, uri.AbsoluteUri);
                deviceUtil.PersistSimpleValue(DEEPLINK_CLICK_TIME, clickTime.Ticks.ToString());
                return;
            }

            _activityHandler.OpenUrl(uri, clickTime);
        }
Exemple #11
0
        public static IPackageHandler GetPackageHandler(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused)
        {
            if (_iPackageHandler == null)
            {
                return(new PackageHandler(activityHandler, deviceUtil, startPaused));
            }

            _iPackageHandler.Init(activityHandler, deviceUtil, startPaused);
            return(_iPackageHandler);
        }
Exemple #12
0
 public static void ClearDeeplinkCache(IDeviceUtil deviceUtil)
 {
     deviceUtil.ClearSimpleValue(DEEPLINK_URL);
     deviceUtil.ClearSimpleValue(DEEPLINK_CLICK_TIME);
 }
Exemple #13
0
 public static void ClearGdprForgotten(IDeviceUtil deviceUtil)
 {
     deviceUtil.ClearSimpleValue(GDPR_USER_FORGOTTEN);
 }
Exemple #14
0
 public static void MarkGdprForgotten(IDeviceUtil deviceUtil)
 {
     deviceUtil.PersistSimpleValue(GDPR_USER_FORGOTTEN, "true");
 }
        public PackageHandler(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused)
        {
            Init(activityHandler, deviceUtil, startPaused);

            _actionQueue.Enqueue(() => InitI(activityHandler, deviceUtil, startPaused));
        }