Refinements
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.ApplicationModel.UserActivities;
|
||||
using Windows.Storage;
|
||||
|
||||
namespace FoxTube
|
||||
@@ -15,7 +17,7 @@ namespace FoxTube
|
||||
{
|
||||
public static List<HistoryItem> Items { get; set; } = new List<HistoryItem>();
|
||||
|
||||
public static void Update(HistoryItem item)
|
||||
public static async void Update(HistoryItem item, Video video)
|
||||
{
|
||||
if (!SecretsVault.IsAuthorized)
|
||||
return;
|
||||
@@ -26,6 +28,23 @@ namespace FoxTube
|
||||
if (Items.Count > 200)
|
||||
Items.RemoveRange(200, Items.Count - 200);
|
||||
Save();
|
||||
|
||||
UserActivitySession _currentActivity = null;
|
||||
// Get the default UserActivityChannel and query it for our UserActivity. If the activity doesn't exist, one is created.
|
||||
UserActivityChannel channel = UserActivityChannel.GetDefault();
|
||||
UserActivity userActivity = await channel.GetOrCreateUserActivityAsync(item.Id);
|
||||
|
||||
// Populate required properties
|
||||
userActivity.VisualElements.DisplayText = video.Snippet.Title;
|
||||
userActivity.VisualElements.Description = video.Snippet.ChannelTitle;
|
||||
userActivity.ActivationUri = new Uri("my-app://page2?action=edit");
|
||||
|
||||
//Save
|
||||
await userActivity.SaveAsync(); //save the new metadata
|
||||
|
||||
// Dispose of any current UserActivitySession, and create a new one.
|
||||
_currentActivity?.Dispose();
|
||||
_currentActivity = userActivity.CreateSession();
|
||||
}
|
||||
|
||||
public static void Delete(HistoryItem item)
|
||||
|
||||
Reference in New Issue
Block a user