Tidied up the warnings

This commit is contained in:
Jamie.Rees 2016-12-08 14:32:08 +00:00
parent ad796a47bd
commit 88b1472f88
5 changed files with 19 additions and 14 deletions

View file

@ -167,6 +167,8 @@ namespace PlexRequests.Helpers.Analytics
} }
#endif #endif
} }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
private async Task SendRequestAsync(string postDataString) private async Task SendRequestAsync(string postDataString)
{ {
var request = (HttpWebRequest)WebRequest.Create(AnalyticsUri); var request = (HttpWebRequest)WebRequest.Create(AnalyticsUri);
@ -195,6 +197,7 @@ namespace PlexRequests.Helpers.Analytics
} }
#endif #endif
} }
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
private Dictionary<string, string> BuildRequestData(HitType type, string username, string category, string action, string clientId, string label, int? value, string exceptionDescription, int? fatal) private Dictionary<string, string> BuildRequestData(HitType type, string username, string category, string action, string clientId, string label, int? value, string exceptionDescription, int? fatal)
{ {

View file

@ -41,11 +41,9 @@ namespace PlexRequests.Store.Repository
public PlexUserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config,cache) public PlexUserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config,cache)
{ {
DbConfig = config; DbConfig = config;
Cache = cache;
} }
private ISqliteConfiguration DbConfig { get; } private ISqliteConfiguration DbConfig { get; }
private ICacheProvider Cache { get; }
private IDbConnection Db => DbConfig.DbConnection(); private IDbConnection Db => DbConfig.DbConnection();
public PlexUsers GetUser(string userGuid) public PlexUsers GetUser(string userGuid)
@ -69,7 +67,9 @@ namespace PlexRequests.Store.Repository
return await Db.QueryFirstOrDefaultAsync<PlexUsers>(sql, new {UserGuid = userguid}); return await Db.QueryFirstOrDefaultAsync<PlexUsers>(sql, new {UserGuid = userguid});
} }
#region abstract implimentation #region abstract implementation
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
[Obsolete] [Obsolete]
public override PlexUsers Get(string id) public override PlexUsers Get(string id)
{ {
@ -94,6 +94,7 @@ namespace PlexRequests.Store.Repository
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
#endregion #endregion
} }

View file

@ -40,11 +40,9 @@ namespace PlexRequests.Store.Repository
public UserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config,cache) public UserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config,cache)
{ {
DbConfig = config; DbConfig = config;
Cache = cache;
} }
private ISqliteConfiguration DbConfig { get; } private ISqliteConfiguration DbConfig { get; }
private ICacheProvider Cache { get; }
private IDbConnection Db => DbConfig.DbConnection(); private IDbConnection Db => DbConfig.DbConnection();
public UsersModel GetUser(string userGuid) public UsersModel GetUser(string userGuid)
@ -68,7 +66,9 @@ namespace PlexRequests.Store.Repository
return await Db.QueryFirstOrDefaultAsync<UsersModel>(sql, new {UserGuid = userguid}); return await Db.QueryFirstOrDefaultAsync<UsersModel>(sql, new {UserGuid = userguid});
} }
#region abstract implimentation #region abstract implementation
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
[Obsolete] [Obsolete]
public override UsersModel Get(string id) public override UsersModel Get(string id)
{ {
@ -93,6 +93,7 @@ namespace PlexRequests.Store.Repository
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
#endregion #endregion
} }

View file

@ -227,7 +227,7 @@ namespace PlexRequests.UI.Modules
Post["/clearlogs", true] = async (x, ct) => await ClearLogs(); Post["/clearlogs", true] = async (x, ct) => await ClearLogs();
Get["/notificationsettings", true] = async (x, ct) => await NotificationSettings(); Get["/notificationsettings", true] = async (x, ct) => await NotificationSettings();
Post["/notificationsettings", true] = async (x, ct) => await SaveNotificationSettings(); Post["/notificationsettings"] = x => SaveNotificationSettings();
Post["/recentlyAddedTest"] = x => RecentlyAddedTest(); Post["/recentlyAddedTest"] = x => RecentlyAddedTest();
} }
@ -287,7 +287,7 @@ namespace PlexRequests.UI.Modules
{ {
Analytics.TrackEventAsync(Category.Admin, Action.Save, "CollectAnalyticData turned off", Username, CookieHelper.GetAnalyticClientId(Cookies)); Analytics.TrackEventAsync(Category.Admin, Action.Save, "CollectAnalyticData turned off", Username, CookieHelper.GetAnalyticClientId(Cookies));
} }
var result = PrService.SaveSettings(model); var result = await PrService.SaveSettingsAsync(model);
Analytics.TrackEventAsync(Category.Admin, Action.Save, "PlexRequestSettings", Username, CookieHelper.GetAnalyticClientId(Cookies)); Analytics.TrackEventAsync(Category.Admin, Action.Save, "PlexRequestSettings", Username, CookieHelper.GetAnalyticClientId(Cookies));
return Response.AsJson(result return Response.AsJson(result
@ -520,7 +520,7 @@ namespace PlexRequests.UI.Modules
{ {
NotificationService.Subscribe(new EmailMessageNotification(EmailService)); NotificationService.Subscribe(new EmailMessageNotification(EmailService));
settings.Enabled = true; settings.Enabled = true;
NotificationService.Publish(notificationModel, settings); await NotificationService.Publish(notificationModel, settings);
Log.Info("Sent email notification test"); Log.Info("Sent email notification test");
} }
catch (Exception) catch (Exception)
@ -620,7 +620,7 @@ namespace PlexRequests.UI.Modules
{ {
NotificationService.Subscribe(new PushbulletNotification(PushbulletApi, PushbulletService)); NotificationService.Subscribe(new PushbulletNotification(PushbulletApi, PushbulletService));
settings.Enabled = true; settings.Enabled = true;
NotificationService.Publish(notificationModel, settings); await NotificationService.Publish(notificationModel, settings);
Log.Info("Sent pushbullet notification test"); Log.Info("Sent pushbullet notification test");
} }
catch (Exception) catch (Exception)
@ -686,7 +686,7 @@ namespace PlexRequests.UI.Modules
{ {
NotificationService.Subscribe(new PushoverNotification(PushoverApi, PushoverService)); NotificationService.Subscribe(new PushoverNotification(PushoverApi, PushoverService));
settings.Enabled = true; settings.Enabled = true;
NotificationService.Publish(notificationModel, settings); await NotificationService.Publish(notificationModel, settings);
Log.Info("Sent pushover notification test"); Log.Info("Sent pushover notification test");
} }
catch (Exception) catch (Exception)
@ -1040,7 +1040,7 @@ namespace PlexRequests.UI.Modules
return View["NotificationSettings", s]; return View["NotificationSettings", s];
} }
private async Task<Negotiator> SaveNotificationSettings() private Negotiator SaveNotificationSettings()
{ {
var model = this.Bind<NotificationSettingsV2>(); var model = this.Bind<NotificationSettingsV2>();
return View["NotificationSettings", model]; return View["NotificationSettings", model];

View file

@ -47,12 +47,12 @@ namespace PlexRequests.UI.Modules
{ {
Analytics = a; Analytics = a;
Get["/", true] = async(x,c) => await SetCulture(); Get["/"] = x => SetCulture();
} }
private IAnalytics Analytics { get; } private IAnalytics Analytics { get; }
public async Task<RedirectResponse> SetCulture() private RedirectResponse SetCulture()
{ {
var culture = (string)Request.Query["l"]; var culture = (string)Request.Query["l"];
var returnUrl = (string)Request.Query["u"]; var returnUrl = (string)Request.Query["u"];