diff --git a/Pixiview/Illust/IllustCollectionPage.cs b/Pixiview/Illust/IllustCollectionPage.cs index ac8332c..e262ffd 100644 --- a/Pixiview/Illust/IllustCollectionPage.cs +++ b/Pixiview/Illust/IllustCollectionPage.cs @@ -66,6 +66,7 @@ namespace Pixiview.Illust protected virtual bool IsFavoriteVisible => true; protected virtual bool IsAutoReload => true; + protected virtual bool IsRedirectLogin => false; protected virtual ActivityIndicator LoadingIndicator => null; protected virtual double IndicatorMarginTop => 16; @@ -76,7 +77,6 @@ namespace Pixiview.Illust private T illustData; private ParallelTask task; - private bool isTrying; public IllustCollectionPage() { @@ -531,16 +531,30 @@ namespace Pixiview.Illust { MainThread.BeginInvokeOnMainThread(async () => { - if (isTrying) + if (!IsRedirectLogin) { + string extra; + if (lastError != null) + { + if (lastError.Length > 40) + { + extra = $"\n{lastError.Substring(0, 40)}..."; + } + else + { + extra = $"\n{lastError}"; + } + } + else + { + extra = string.Empty; + } _ = DisplayAlert(ResourceHelper.Title, - ResourceHelper.FailedResponse + "\n" + lastError?.Substring(0, 40), + ResourceHelper.FailedResponse + extra, ResourceHelper.Ok); - isTrying = false; } else { - //isTrying = true; var result = await DisplayAlert( ResourceHelper.Title, ResourceHelper.ConfirmLogin, @@ -560,7 +574,6 @@ namespace Pixiview.Illust IsBottomLoading = false; return; } - isTrying = false; if (force && IsFavoriteVisible) { var now = DateTime.Now; diff --git a/Pixiview/Illust/MainPage.xaml.cs b/Pixiview/Illust/MainPage.xaml.cs index 880150a..fcf7565 100644 --- a/Pixiview/Illust/MainPage.xaml.cs +++ b/Pixiview/Illust/MainPage.xaml.cs @@ -35,6 +35,7 @@ namespace Pixiview.Illust #endif } + protected override bool IsRedirectLogin => true; protected override ActivityIndicator LoadingIndicator => activityLoading; protected override double IndicatorMarginTop => 66; diff --git a/Pixiview/Illust/RankingPage.xaml.cs b/Pixiview/Illust/RankingPage.xaml.cs index 9dad8eb..31a6736 100644 --- a/Pixiview/Illust/RankingPage.xaml.cs +++ b/Pixiview/Illust/RankingPage.xaml.cs @@ -112,7 +112,7 @@ namespace Pixiview.Illust queryDate = Preferences.Get(Configs.QueryDateKey, null); currentPage = 1; datePicker.MinimumDate = new DateTime(2007, 9, 13); - MaximumDate = DateTime.Today; + MaximumDate = DateTime.Today.AddDays(-1); } protected override ActivityIndicator LoadingIndicator => activityLoading; @@ -184,11 +184,12 @@ namespace Pixiview.Illust now = default; } date = ResourceHelper.GetResource(data.mode, date); + MainThread.BeginInvokeOnMainThread(() => Title = date); - var prev = data.prev_date; - if (int.TryParse(prev, out _)) + var prev_date = data.prev_date; + if (int.TryParse(prev_date, out _)) { - previousDate = prev; + previousDate = prev_date; previousEnabled = true; } else @@ -196,29 +197,24 @@ namespace Pixiview.Illust previousDate = null; previousEnabled = false; } - var next_ = data.next_date; - if (int.TryParse(next_, out _)) + var next_date = data.next_date; + if (int.TryParse(next_date, out _)) { - nextDate = next_; + nextDate = next_date; nextEnabled = true; } else { nextDate = null; nextEnabled = false; - if (now != default) + if (now != default && force) { MaximumDate = now; } } - dateEnabled = true; - MainThread.BeginInvokeOnMainThread(() => - { - ToolbarCommand.ChangeCanExecute(); - Title = date; - }); - } + dateEnabled = true; + MainThread.BeginInvokeOnMainThread(ToolbarCommand.ChangeCanExecute); return data; }