示例#1
0
        public void RegisterImpression(bool isPositive)
        {
            impressionSubject.OnNext(isPositive);
            analyticsService.UserFinishedRatingViewFirstStep.Track(isPositive);

            var outcome = isPositive
                ? RatingViewOutcome.PositiveImpression
                : RatingViewOutcome.NegativeImpression;

            onboardingStorage.SetRatingViewOutcome(outcome, timeService.CurrentDateTime);
        }
示例#2
0
        private void presentRatingViewIfNeeded(bool shouldBevisible)
        {
            if (!shouldBevisible)
            {
                return;
            }

            var wasShownMoreThanOnce = onboardingStorage.NumberOfTimesRatingViewWasShown() > 1;

            if (wasShownMoreThanOnce)
            {
                return;
            }

            var lastOutcome = onboardingStorage.RatingViewOutcome();

            if (lastOutcome != null)
            {
                var thereIsInteractionFormLastTime = lastOutcome != RatingViewOutcome.NoInteraction;
                if (thereIsInteractionFormLastTime)
                {
                    return;
                }
            }

            var lastOutcomeTime = onboardingStorage.RatingViewOutcomeTime();

            if (lastOutcomeTime != null)
            {
                var oneDayHasNotPassedSinceLastTime = lastOutcomeTime + TimeSpan.FromHours(24) > TimeService.CurrentDateTime;
                if (oneDayHasNotPassedSinceLastTime && !wasShownMoreThanOnce)
                {
                    return;
                }
            }

            navigationService.ChangePresentation(ToggleRatingViewVisibilityHint.Show());
            analyticsService.RatingViewWasShown.Track();
            onboardingStorage.SetDidShowRatingView();
            onboardingStorage.SetRatingViewOutcome(RatingViewOutcome.NoInteraction, TimeService.CurrentDateTime);
            TimeService.RunAfterDelay(TimeSpan.FromMinutes(ratingViewTimeout), () =>
            {
                shouldHideRatingViewIfStillVisible = true;
                navigationService.ChangePresentation(ToggleRatingViewVisibilityHint.Hide());
            });
        }
示例#3
0
        private void presentRatingViewIfNeeded(bool shouldBevisible)
        {
            if (!shouldBevisible)
            {
                return;
            }

            if (onboardingStorage.RatingViewOutcome().HasValue)
            {
                return;
            }

            navigationService.ChangePresentation(new ToggleRatingViewVisibilityHint());
            analyticsService.RatingViewWasShown.Track();
            onboardingStorage.SetRatingViewOutcome(RatingViewOutcome.NoInteraction, timeService.CurrentDateTime);
            timeService.RunAfterDelay(ratingViewTimeout, () =>
            {
                navigationService.ChangePresentation(new ToggleRatingViewVisibilityHint());
            });
        }
示例#4
0
        public void RegisterImpression(bool isPositive)
        {
            impressionSubject.OnNext(isPositive);
            analyticsService.UserFinishedRatingViewFirstStep.Track(isPositive);

            if (isPositive)
            {
                analyticsService.RatingViewFirstStepLike.Track();
                onboardingStorage.SetRatingViewOutcome(RatingViewOutcome.PositiveImpression, timeService.CurrentDateTime);
            }
            else
            {
                analyticsService.RatingViewFirstStepDislike.Track();
                onboardingStorage.SetRatingViewOutcome(RatingViewOutcome.NegativeImpression, timeService.CurrentDateTime);
            }
        }
示例#5
0
 private void trackStepOutcome(RatingViewOutcome outcome, IAnalyticsEvent specificEvent)
 {
     onboardingStorage.SetRatingViewOutcome(outcome, timeService.CurrentDateTime);
     specificEvent.Track();
 }