Fixes. Preparing for submission
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Google.Apis.Services;
|
||||
using Google.Apis.YouTube.v3;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Microsoft.AppCenter.Analytics;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,7 +17,7 @@ namespace FoxTube.Background
|
||||
public sealed class BackgroundProcessor : IBackgroundTask
|
||||
{
|
||||
private DateTime lastCheck = DateTime.Now;
|
||||
private ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||
private readonly ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||
private YouTubeService Service => new YouTubeService(new BaseClientService.Initializer()
|
||||
{
|
||||
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
|
||||
@@ -29,6 +30,7 @@ namespace FoxTube.Background
|
||||
try
|
||||
{
|
||||
def = taskInstance.GetDeferral();
|
||||
taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled);
|
||||
|
||||
if (settings.Values["lastCheck"] == null)
|
||||
{
|
||||
@@ -45,7 +47,6 @@ namespace FoxTube.Background
|
||||
if (notificationsSettings[1])
|
||||
await CheckAccount();
|
||||
}
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
settings.Values["lastCheck"] = DateTime.Now.ToString();
|
||||
@@ -53,6 +54,15 @@ namespace FoxTube.Background
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
|
||||
{
|
||||
Analytics.TrackEvent("Background task caneled", new Dictionary<string, string>()
|
||||
{
|
||||
{ "Reason", reason.ToString() }
|
||||
});
|
||||
settings.Values["lastCheck"] = DateTime.Now.ToString();
|
||||
}
|
||||
|
||||
async Task CheckAccount()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -127,6 +127,9 @@
|
||||
<PackageReference Include="Google.Apis.YouTube.v3">
|
||||
<Version>1.29.2.1006</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AppCenter.Analytics">
|
||||
<Version>1.13.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>6.1.5</Version>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.Data.Xml.Dom;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Notifications;
|
||||
|
||||
Reference in New Issue
Block a user