Exemplo n.º 1
0
        internal async Task <CountlyResponse> RecordEventAsync(CountlyEventModel @event, bool useNumberInSameSession = false)
        {
            if (_countlyConfigModel.EnableConsoleLogging)
            {
                Debug.Log("[Countly] RecordEventAsync : " + @event.ToString());
            }

            if (_countlyConfigModel.EnableTestMode)
            {
                return(new CountlyResponse
                {
                    IsSuccess = true
                });
            }

            if (_countlyConfigModel.EnableFirstAppLaunchSegment)
            {
                AddFirstAppSegment(@event);
            }

            if (@event.Key.Equals(CountlyEventModel.ViewEvent))
            {
                _viewEventRepo.Enqueue(@event);
            }
            else
            {
                _nonViewEventRepo.Enqueue(@event);
            }

            if (useNumberInSameSession)
            {
                _eventNumberInSameSessionHelper.IncreaseNumberInSameSession(@event);
            }

            if (_viewEventRepo.Count >= _countlyConfigModel.EventViewSendThreshold)
            {
                await ReportAllRecordedViewEventsAsync();
            }

            if (_nonViewEventRepo.Count >= _countlyConfigModel.EventNonViewSendThreshold)
            {
                await ReportAllRecordedNonViewEventsAsync();
            }

            return(new CountlyResponse
            {
                IsSuccess = true
            });
        }
Exemplo n.º 2
0
        public async Task <CountlyResponse> RecordEventAsync(CountlyEventModel @event, bool useNumberInSameSession = false)
        {
            if (_countlyConfigModel.EnableFirstAppLaunchSegment && FirstLaunchAppHelper.IsFirstLaunchApp)
            {
                AddFirstAppSegment(@event);
            }


            if (@event.Key.Equals(CountlyEventModel.ViewEvent))
            {
                _viewEventRepo.Enqueue(@event);
            }
            else
            {
                _nonViewEventRepo.Enqueue(@event);
            }

            if (useNumberInSameSession)
            {
                _eventNumberInSameSessionHelper.IncreaseNumberInSameSession(@event);
            }

            if (_viewEventRepo.Count >= _countlyConfigModel.EventViewSendThreshold)
            {
                await ReportAllRecordedViewEventsAsync();
            }

            if (_nonViewEventRepo.Count >= _countlyConfigModel.EventNonViewSendThreshold)
            {
                await ReportAllRecordedNonViewEventsAsync();
            }

            return(new CountlyResponse
            {
                IsSuccess = true
            });
        }