#219: Fixed
This commit is contained in:
+5
-4
@@ -260,20 +260,21 @@ namespace FoxTube
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
private async void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
//await new MessageDialog("suspending").ShowAsync();
|
||||
|
||||
//Saving history
|
||||
await FileIO.WriteTextAsync(
|
||||
/*await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("history.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(SecretsVault.UserHistory));
|
||||
//Saving WL playlist
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(SecretsVault.WatchLater));
|
||||
JsonConvert.SerializeObject(SecretsVault.WatchLater));*/
|
||||
//Saving downloads
|
||||
Methods.MainPage.Agent.QuitPrompt();
|
||||
ToastNotificationManager.CreateToastNotifier().Show(Background.Notification.GetInternalToast(null, "All data saved", "", null, null));
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,29 +52,19 @@ namespace FoxTube.Controls
|
||||
items.Remove(item);
|
||||
}
|
||||
|
||||
public void QuitPrompt()
|
||||
public async void QuitPrompt()
|
||||
{
|
||||
if(items.Exists(x => x.InProgress))
|
||||
{
|
||||
MessageDialog dialog = new MessageDialog($"Waiting pending downloads ({items.FindAll(x => x.InProgress).Count})...");
|
||||
foreach (DownloadItem i in items.FindAll(x => x.InProgress))
|
||||
i.Cancel();
|
||||
items.RemoveAll(x => x.InProgress);
|
||||
|
||||
dialog.Commands.Add(new UICommand("Force quit", async (command) =>
|
||||
{
|
||||
foreach (DownloadItem i in items.FindAll(x => x.InProgress))
|
||||
i.Cancel();
|
||||
items.RemoveAll(x => x.InProgress);
|
||||
List<DownloadItemContainer> containers = new List<DownloadItemContainer>();
|
||||
foreach (DownloadItem i in items)
|
||||
containers.Add(i.Container);
|
||||
|
||||
List<DownloadItemContainer> containers = new List<DownloadItemContainer>();
|
||||
foreach (DownloadItem i in items)
|
||||
containers.Add(i.Container);
|
||||
|
||||
await FileIO.WriteTextAsync(
|
||||
await roaming.CreateFileAsync("downloads.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(containers));
|
||||
}));
|
||||
|
||||
prompt = dialog.ShowAsync();
|
||||
}
|
||||
await FileIO.WriteTextAsync(
|
||||
await roaming.CreateFileAsync("downloads.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(containers));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ using Windows.UI.Popups;
|
||||
|
||||
namespace FoxTube
|
||||
{
|
||||
public class HistoryItem
|
||||
/*public class HistoryItem
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public double LeftOn { get; set; }
|
||||
@@ -32,7 +32,7 @@ namespace FoxTube
|
||||
Id = id;
|
||||
LeftOn = 0;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static class SecretsVault
|
||||
{
|
||||
@@ -57,8 +57,8 @@ namespace FoxTube
|
||||
public static bool IsAuthorized { get; private set; } = false;
|
||||
|
||||
public static Channel UserChannel { get; private set; }
|
||||
public static List<string> WatchLater { get; private set; } = new List<string>();
|
||||
public static List<HistoryItem> UserHistory { get; private set; } = new List<HistoryItem>();
|
||||
/*public static List<string> WatchLater { get; private set; } = new List<string>();
|
||||
public static List<HistoryItem> UserHistory { get; private set; } = new List<HistoryItem>();*/
|
||||
public static List<Subscription> Subscriptions { get; private set; } = new List<Subscription>();
|
||||
|
||||
public static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer()
|
||||
@@ -77,14 +77,14 @@ namespace FoxTube
|
||||
}
|
||||
}
|
||||
|
||||
public static void HistoryAdd(string id, TimeSpan elapsed, TimeSpan total)
|
||||
/*public static void HistoryAdd(string id, TimeSpan elapsed, TimeSpan total)
|
||||
{
|
||||
UserHistory.Remove(UserHistory.Find(x => x.Id == id));
|
||||
UserHistory.Add(new HistoryItem(id, elapsed, total));
|
||||
|
||||
if (UserHistory.Count > 100)
|
||||
UserHistory.RemoveAt(UserHistory.Count - 1);
|
||||
}
|
||||
}*/
|
||||
|
||||
public static async Task<bool> ChangeSubscriptionState(string id)
|
||||
{
|
||||
@@ -208,7 +208,7 @@ namespace FoxTube
|
||||
UserChannel = (await request.ExecuteAsync()).Items[0];
|
||||
AccountId = UserChannel.Id;
|
||||
|
||||
try
|
||||
/*try
|
||||
{
|
||||
await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json");
|
||||
UserHistory = JsonConvert.DeserializeObject<List<HistoryItem>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json")));
|
||||
@@ -231,7 +231,7 @@ namespace FoxTube
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(new List<string>()));
|
||||
WatchLater = new List<string>();
|
||||
}
|
||||
}*/
|
||||
|
||||
/*PlaylistItemsResource.ListRequest playlistRequest = Service.PlaylistItems.List("snippet");
|
||||
playlistRequest.PlaylistId = UserChannel.ContentDetails.RelatedPlaylists.WatchHistory;
|
||||
|
||||
@@ -30,9 +30,7 @@ namespace FoxTube.Controls
|
||||
|
||||
public async void Initialize(string id, string playlist = null)
|
||||
{
|
||||
YouTubeService ytService = SecretsVault.NoAuthService;
|
||||
|
||||
VideosResource.ListRequest request = ytService.Videos.List("snippet,contentDetails,statistics,liveStreamingDetails");
|
||||
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,contentDetails,statistics,liveStreamingDetails");
|
||||
request.Id = id;
|
||||
VideoListResponse response = await request.ExecuteAsync();
|
||||
|
||||
@@ -71,7 +69,7 @@ namespace FoxTube.Controls
|
||||
embed = false;
|
||||
}
|
||||
|
||||
var request1 = ytService.Channels.List("snippet");
|
||||
var request1 = SecretsVault.Service.Channels.List("snippet");
|
||||
request1.Id = item.Snippet.ChannelId;
|
||||
ChannelListResponse response1 = await request1.ExecuteAsync();
|
||||
|
||||
@@ -82,11 +80,11 @@ namespace FoxTube.Controls
|
||||
}
|
||||
catch { }
|
||||
|
||||
if(SecretsVault.UserHistory.Exists(x => x.Id == videoId))
|
||||
/*if(SecretsVault.UserHistory.Exists(x => x.Id == videoId))
|
||||
{
|
||||
watched.Visibility = Visibility.Visible;
|
||||
leftOn.Value = SecretsVault.UserHistory.Find(x => x.Id == videoId).LeftOn;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public async void Button_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace FoxTube
|
||||
systemControls.ButtonPressed += SystemControls_Engaged;
|
||||
systemControls.IsEnabled = true;
|
||||
|
||||
SecretsVault.HistoryAdd(videoId, elapsed, total);
|
||||
//SecretsVault.HistoryAdd(videoId, elapsed, total);
|
||||
|
||||
t.Start();
|
||||
|
||||
@@ -615,7 +615,7 @@ namespace FoxTube
|
||||
break;
|
||||
}
|
||||
|
||||
SecretsVault.HistoryAdd(videoId, elapsed, total);
|
||||
//SecretsVault.HistoryAdd(videoId, elapsed, total);
|
||||
}
|
||||
|
||||
private async void miniView_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<local:VideoGrid/>
|
||||
</ScrollViewer>
|
||||
<CommandBar Grid.Row="1" DefaultLabelPosition="Right">
|
||||
<AppBarButton LabelPosition="Default" Icon="Help" Label="Missing some stuff?" Name="help" Click="help_Click"/>
|
||||
<AppBarButton Icon="Refresh" Label="Refresh" Name="refresh" Click="Refresh_Click"/>
|
||||
<AppBarButton Label="Open in browser" Icon="Globe" Name="toBrowser" Click="toBrowser_Click"/>
|
||||
</CommandBar>
|
||||
<foxtube:LoadingPage Visibility="Collapsed" Grid.RowSpan="2"/>
|
||||
|
||||
@@ -34,10 +34,7 @@ namespace FoxTube.Pages
|
||||
public void Initialize()
|
||||
{
|
||||
loading.Refresh();
|
||||
|
||||
list.Clear();
|
||||
SecretsVault.UserHistory.ForEach(i => list.Add(new VideoCard(i.Id)));
|
||||
|
||||
|
||||
loading.Close();
|
||||
}
|
||||
|
||||
@@ -46,9 +43,9 @@ namespace FoxTube.Pages
|
||||
await Launcher.LaunchUriAsync(new Uri("youtube.com/feed/history"));
|
||||
}
|
||||
|
||||
private void help_Click(object sender, RoutedEventArgs e)
|
||||
private void Refresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Methods.MainPage.GoToDeveloper("local-history");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<controls:AdaptiveGridView ItemsSource="{x:Bind list}" DesiredWidth="250" Margin="5,0,0,0">
|
||||
<controls:AdaptiveGridView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Padding="5">
|
||||
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Padding="5" Tag="{Binding Path=Snippet.ResourceId.ChannelId}" Click="Button_Click">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="55"/>
|
||||
|
||||
@@ -28,5 +28,10 @@ namespace FoxTube.Pages
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Methods.MainPage.GoToChannel(((Button)sender).Tag.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
<local:VideoPlayer/>
|
||||
<PivotItem Header="Description" Name="descriptionPanel">
|
||||
<StackPanel Margin="0,10">
|
||||
<Button Visibility="Collapsed">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<FontIcon Glyph="" Margin="0,0,10,0"/>
|
||||
<TextBlock Text="Continue watching from HH:MM:SS"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<TextBlock IsTextSelectionEnabled="True" Name="title" Text="[Video title]" FontSize="25" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Start"/>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
Reference in New Issue
Block a user