mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 01:02:57 -07:00
Added some useful analytical infomation around the wizard.
This commit is contained in:
parent
632ce75fa0
commit
42706a3068
3 changed files with 14 additions and 2 deletions
|
@ -40,6 +40,7 @@ namespace PlexRequests.Helpers.Analytics
|
||||||
TvShow,
|
TvShow,
|
||||||
Album,
|
Album,
|
||||||
Request,
|
Request,
|
||||||
Language
|
Language,
|
||||||
|
Finish
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,6 +28,7 @@ namespace PlexRequests.Helpers.Analytics
|
||||||
{
|
{
|
||||||
public enum Category
|
public enum Category
|
||||||
{
|
{
|
||||||
|
Wizard,
|
||||||
Startup,
|
Startup,
|
||||||
Search,
|
Search,
|
||||||
Requests,
|
Requests,
|
||||||
|
|
|
@ -38,24 +38,31 @@ using Nancy.Validation;
|
||||||
using PlexRequests.Api.Interfaces;
|
using PlexRequests.Api.Interfaces;
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Helpers;
|
||||||
|
using PlexRequests.Helpers.Analytics;
|
||||||
using PlexRequests.UI.Helpers;
|
using PlexRequests.UI.Helpers;
|
||||||
using PlexRequests.UI.Models;
|
using PlexRequests.UI.Models;
|
||||||
|
|
||||||
|
using Action = PlexRequests.Helpers.Analytics.Action;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Modules
|
namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class UserWizardModule : BaseModule
|
public class UserWizardModule : BaseModule
|
||||||
{
|
{
|
||||||
public UserWizardModule(ISettingsService<PlexRequestSettings> pr, ISettingsService<PlexSettings> plex, IPlexApi plexApi,
|
public UserWizardModule(ISettingsService<PlexRequestSettings> pr, ISettingsService<PlexSettings> plex, IPlexApi plexApi,
|
||||||
ISettingsService<AuthenticationSettings> auth, ICustomUserMapper m) : base("wizard", pr)
|
ISettingsService<AuthenticationSettings> auth, ICustomUserMapper m, IAnalytics a) : base("wizard", pr)
|
||||||
{
|
{
|
||||||
PlexSettings = plex;
|
PlexSettings = plex;
|
||||||
PlexApi = plexApi;
|
PlexApi = plexApi;
|
||||||
PlexRequestSettings = pr;
|
PlexRequestSettings = pr;
|
||||||
Auth = auth;
|
Auth = auth;
|
||||||
Mapper = m;
|
Mapper = m;
|
||||||
|
Analytics = a;
|
||||||
|
|
||||||
Get["/", true] = async (x, ct) =>
|
Get["/", true] = async (x, ct) =>
|
||||||
{
|
{
|
||||||
|
a.TrackEventAsync(Category.Wizard, Action.Start, "Started the wizard", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||||
|
|
||||||
var settings = await PlexRequestSettings.GetSettingsAsync();
|
var settings = await PlexRequestSettings.GetSettingsAsync();
|
||||||
if (settings.Wizard)
|
if (settings.Wizard)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +82,7 @@ namespace PlexRequests.UI.Modules
|
||||||
private ISettingsService<PlexRequestSettings> PlexRequestSettings { get; }
|
private ISettingsService<PlexRequestSettings> PlexRequestSettings { get; }
|
||||||
private ISettingsService<AuthenticationSettings> Auth { get; }
|
private ISettingsService<AuthenticationSettings> Auth { get; }
|
||||||
private ICustomUserMapper Mapper { get; }
|
private ICustomUserMapper Mapper { get; }
|
||||||
|
private IAnalytics Analytics { get; }
|
||||||
|
|
||||||
|
|
||||||
private Response PlexAuth()
|
private Response PlexAuth()
|
||||||
|
@ -153,6 +161,7 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
var username = (string)Request.Form.Username;
|
var username = (string)Request.Form.Username;
|
||||||
var userId = Mapper.CreateAdmin(username, Request.Form.Password);
|
var userId = Mapper.CreateAdmin(username, Request.Form.Password);
|
||||||
|
Analytics.TrackEventAsync(Category.Wizard, Action.Finish, "Finished the wizard", username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||||
Session[SessionKeys.UsernameKey] = username;
|
Session[SessionKeys.UsernameKey] = username;
|
||||||
|
|
||||||
// Destroy the Plex Auth Token
|
// Destroy the Plex Auth Token
|
||||||
|
@ -163,6 +172,7 @@ namespace PlexRequests.UI.Modules
|
||||||
settings.Wizard = true;
|
settings.Wizard = true;
|
||||||
await PlexRequestSettings.SaveSettingsAsync(settings);
|
await PlexRequestSettings.SaveSettingsAsync(settings);
|
||||||
|
|
||||||
|
|
||||||
return this.LoginAndRedirect((Guid)userId, fallbackRedirectUrl: "/search");
|
return this.LoginAndRedirect((Guid)userId, fallbackRedirectUrl: "/search");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue