Ejemplo n.º 1
0
    public async ValueTask StartAsync()
    {
        var afMetadata = await _afMetadataRepo.GetSingleOneAsync() ?? new AfMetadata();

        if (afMetadata.WhatsNewVersion != Consts.CurrentVersion)
        {
            var whatsNew = _staticUrlOptions.Value.WhatsNew;
            if (!string.IsNullOrEmpty(whatsNew))
            {
                await _applicationInsights.TrackEvent(Events.AfWhatsNewShown);

                await _newNotification.NewReleaseAsync(new NewReleaseInput
                {
                    Version     = Consts.CurrentVersion,
                    WhatsNewUrl = whatsNew
                });

                _logger.LogInformation("Whats new shown");
            }

            afMetadata.WhatsNewVersion = Consts.CurrentVersion;
            await _afMetadataRepo.UpsertAsync(afMetadata);
        }
        else
        {
            _logger.LogDebug("Whats new was shown before");
        }
    }
    public async ValueTask <UserOptions> GetOptionsAsync()
    {
        var re = await _userOptionsRepo.GetSingleOneAsync();

        var isNew = false;

        if (re == null)
        {
            isNew = true;
            re    = new UserOptions();
            _logger.LogInformation("There is no data found from repo, try to create a new one");
        }

        re = ApplyDefaultValue(re);
        if (isNew)
        {
            await SaveAsync(re);
        }

        return(re);
    }
Ejemplo n.º 3
0
    public async ValueTask StartAsync()
    {
        var afMetadata = await _afMetadataRepo.GetSingleOneAsync() ?? new AfMetadata();

        if (!afMetadata.WelcomeShown)
        {
            var welcomeUrl = _staticUrlOptions.Value.Welcome;
            if (!string.IsNullOrEmpty(welcomeUrl))
            {
                await _applicationInsights.TrackEvent(Events.AfWelcomeShown);

                await _newNotification.WelcomeAsync();

                _logger.LogInformation("Welcome shown");
            }

            afMetadata.WelcomeShown = true;
            await _afMetadataRepo.UpsertAsync(afMetadata);
        }
        else
        {
            _logger.LogDebug("Welcome was shown before");
        }
    }