diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index b481f8487bf6..93955bc57fd5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -42,3 +42,6 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. Does this problem occur again after restarting the app? + +**Log file** +Please post the log file here so that we can understand your problem better. You can access it from Settings->About->Open log location. diff --git a/.github/ISSUE_TEMPLATE/critical-high-priority-bug-report.md b/.github/ISSUE_TEMPLATE/critical-high-priority-bug-report.md index 1335e9d82164..b0a0f248190d 100644 --- a/.github/ISSUE_TEMPLATE/critical-high-priority-bug-report.md +++ b/.github/ISSUE_TEMPLATE/critical-high-priority-bug-report.md @@ -43,3 +43,6 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. For instance, are you building from source or using a precompiled build/snapshot? + +**Log file** +Please post the log file here so that we can understand your problem better. You can access it from Settings->About->Open log location. diff --git a/Files.Package/Package.appxmanifest b/Files.Package/Package.appxmanifest index 97a2b957b178..6fc774a72818 100644 --- a/Files.Package/Package.appxmanifest +++ b/Files.Package/Package.appxmanifest @@ -66,4 +66,4 @@ - + \ No newline at end of file diff --git a/Files/App.xaml.cs b/Files/App.xaml.cs index 1346ba184142..a8c0a3298022 100644 --- a/Files/App.xaml.cs +++ b/Files/App.xaml.cs @@ -26,12 +26,19 @@ using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media.Animation; using Windows.UI.Xaml.Navigation; +using System.Threading.Tasks; +using Microsoft.Toolkit.Uwp.Notifications; +using Windows.UI.Notifications; +using System.Linq; +using Newtonsoft.Json; +using Files.Common; namespace Files { sealed partial class App : Application { private static IShellPage currentInstance; + private static bool ShowErrorNotification = false; public static IShellPage CurrentInstance { @@ -47,7 +54,6 @@ public static IShellPage CurrentInstance } } } - public static SettingsViewModel AppSettings { get; set; } public static InteractionViewModel InteractionViewModel { get; set; } public static JumpListManager JumpList { get; } = new JumpListManager(); @@ -241,6 +247,7 @@ private void CoreWindow_Activated(CoreWindow sender, WindowActivatedEventArgs ar if (args.WindowActivationState == CoreWindowActivationState.CodeActivated || args.WindowActivationState == CoreWindowActivationState.PointerActivated) { + ShowErrorNotification = true; ApplicationData.Current.LocalSettings.Values["INSTANCE_ACTIVE"] = Process.GetCurrentProcess().Id; } } @@ -403,16 +410,58 @@ private void OnSuspending(object sender, SuspendingEventArgs e) } // Occurs when an exception is not handled on the UI thread. - private static void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) - { - Logger.Error(e.Exception, e.Message); - } + private static void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) => AppUnhandledException(e.Exception); // Occurs when an exception is not handled on a background thread. // ie. A task is fired and forgotten Task.Run(() => {...}) - private static void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e) + private static void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e) => AppUnhandledException(e.Exception); + + private static void AppUnhandledException(Exception ex) { - Logger.Error(e.Exception, e.Exception.Message); + Logger.Error(ex, ex.Message); + if (ShowErrorNotification) + { + var toastContent = new ToastContent() + { + Visual = new ToastVisual() + { + BindingGeneric = new ToastBindingGeneric() + { + Children = + { + new AdaptiveText() + { + Text = ResourceController.GetTranslation("ExceptionNotificationHeader") + }, + new AdaptiveText() + { + Text = ResourceController.GetTranslation("ExceptionNotificationBody") + } + }, + AppLogoOverride = new ToastGenericAppLogo() + { + Source = "ms-appx:///Assets/error.png" + } + } + }, + Actions = new ToastActionsCustom() + { + Buttons = + { + new ToastButton(ResourceController.GetTranslation("ExceptionNotificationReportButton"), "report") + { + ActivationType = ToastActivationType.Foreground + } + } + } + }; + + // Create the toast notification + var toastNotif = new ToastNotification(toastContent.GetXml()); + + // And send the notification + ToastNotificationManager.CreateToastNotifier().Show(toastNotif); + } } public static async void CloseApp() @@ -429,4 +478,4 @@ public class WSLDistroItem : INavigationControlItem public NavigationControlItemType ItemType => NavigationControlItemType.LinuxDistro; public Uri Logo { get; set; } } -} \ No newline at end of file +} diff --git a/Files/Assets/error.png b/Files/Assets/error.png new file mode 100644 index 000000000000..669c194ec1d6 Binary files /dev/null and b/Files/Assets/error.png differ diff --git a/Files/Files.csproj b/Files/Files.csproj index 36c20743ecf7..f27db1cc5fa9 100644 --- a/Files/Files.csproj +++ b/Files/Files.csproj @@ -320,6 +320,7 @@ + @@ -600,6 +601,9 @@ 6.1.1 + + 6.1.1 + 6.1.1 diff --git a/Files/Filesystem/DriveItem.cs b/Files/Filesystem/DriveItem.cs index 7beaa8e6b712..453b16c423f7 100644 --- a/Files/Filesystem/DriveItem.cs +++ b/Files/Filesystem/DriveItem.cs @@ -49,20 +49,27 @@ public DriveItem(StorageFolder root, DriveType type) return await root.Properties.RetrievePropertiesAsync(new[] { "System.FreeSpace", "System.Capacity" }); }).Result; - try + if (properties.ContainsKey("System.Capacity") && properties.ContainsKey("System.FreeSpace")) { - MaxSpace = ByteSize.FromBytes((ulong)properties["System.Capacity"]); - FreeSpace = ByteSize.FromBytes((ulong)properties["System.FreeSpace"]); - - SpaceUsed = MaxSpace - FreeSpace; - SpaceText = string.Format( - ResourceController.GetTranslation("DriveFreeSpaceAndCapacity"), - FreeSpace.ToBinaryString().ConvertSizeAbbreviation(), - MaxSpace.ToBinaryString().ConvertSizeAbbreviation()); + try + { + MaxSpace = ByteSize.FromBytes((ulong)properties["System.Capacity"]); + FreeSpace = ByteSize.FromBytes((ulong)properties["System.FreeSpace"]); + + SpaceUsed = MaxSpace - FreeSpace; + SpaceText = string.Format( + ResourceController.GetTranslation("DriveFreeSpaceAndCapacity"), + FreeSpace.ToBinaryString().ConvertSizeAbbreviation(), + MaxSpace.ToBinaryString().ConvertSizeAbbreviation()); + } + catch (NullReferenceException) + { + SpaceText = ResourceController.GetTranslation("DriveCapacityUnknown"); + } } - catch (NullReferenceException) + else { - SpaceText = "Unknown"; + SpaceText = ResourceController.GetTranslation("DriveCapacityUnknown"); } } diff --git a/Files/MultilingualResources/Files.de-DE.xlf b/Files/MultilingualResources/Files.de-DE.xlf index 8abd95587b94..7e756984df64 100644 --- a/Files/MultilingualResources/Files.de-DE.xlf +++ b/Files/MultilingualResources/Files.de-DE.xlf @@ -1111,6 +1111,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1139,6 +1159,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.es-ES.xlf b/Files/MultilingualResources/Files.es-ES.xlf index 4651eaee9558..e82a27be9d01 100644 --- a/Files/MultilingualResources/Files.es-ES.xlf +++ b/Files/MultilingualResources/Files.es-ES.xlf @@ -1126,6 +1126,30 @@ Invalid item Invalid item + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.fr-FR.xlf b/Files/MultilingualResources/Files.fr-FR.xlf index 6498b3144c4d..c0e5cbf2fbd8 100644 --- a/Files/MultilingualResources/Files.fr-FR.xlf +++ b/Files/MultilingualResources/Files.fr-FR.xlf @@ -1104,6 +1104,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1132,6 +1152,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.he-IL.xlf b/Files/MultilingualResources/Files.he-IL.xlf index fe1048422fcb..d767c37f018a 100644 --- a/Files/MultilingualResources/Files.he-IL.xlf +++ b/Files/MultilingualResources/Files.he-IL.xlf @@ -1100,6 +1100,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors ‏‏תורמים @@ -1128,6 +1148,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.hi-IN.xlf b/Files/MultilingualResources/Files.hi-IN.xlf index 32cfdaad6bce..05b03f10c461 100644 --- a/Files/MultilingualResources/Files.hi-IN.xlf +++ b/Files/MultilingualResources/Files.hi-IN.xlf @@ -1101,6 +1101,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1129,6 +1149,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.it-IT.xlf b/Files/MultilingualResources/Files.it-IT.xlf index b1c7d2143b8e..76138fabfd12 100644 --- a/Files/MultilingualResources/Files.it-IT.xlf +++ b/Files/MultilingualResources/Files.it-IT.xlf @@ -1128,6 +1128,30 @@ Invalid item Elemento non valido + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.ja-JP.xlf b/Files/MultilingualResources/Files.ja-JP.xlf index 0b13580074bb..aea86781d50b 100644 --- a/Files/MultilingualResources/Files.ja-JP.xlf +++ b/Files/MultilingualResources/Files.ja-JP.xlf @@ -1104,6 +1104,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1132,6 +1152,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.nl-NL.xlf b/Files/MultilingualResources/Files.nl-NL.xlf index f89e05953873..c6d4a0254ba2 100644 --- a/Files/MultilingualResources/Files.nl-NL.xlf +++ b/Files/MultilingualResources/Files.nl-NL.xlf @@ -1102,6 +1102,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1130,6 +1150,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.or-IN.xlf b/Files/MultilingualResources/Files.or-IN.xlf index 11e24ac037b5..dc3156883ed9 100644 --- a/Files/MultilingualResources/Files.or-IN.xlf +++ b/Files/MultilingualResources/Files.or-IN.xlf @@ -1101,6 +1101,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1129,6 +1149,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.pl-PL.xlf b/Files/MultilingualResources/Files.pl-PL.xlf index 84edbba61406..46a9da3b57c0 100644 --- a/Files/MultilingualResources/Files.pl-PL.xlf +++ b/Files/MultilingualResources/Files.pl-PL.xlf @@ -1102,6 +1102,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1130,6 +1150,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.pt-BR.xlf b/Files/MultilingualResources/Files.pt-BR.xlf index 4e9164b0b002..fe03d6f83a90 100644 --- a/Files/MultilingualResources/Files.pt-BR.xlf +++ b/Files/MultilingualResources/Files.pt-BR.xlf @@ -1128,6 +1128,30 @@ Invalid item Invalid item + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.ru-RU.xlf b/Files/MultilingualResources/Files.ru-RU.xlf index f93a22a86dbc..20df8b3e5d49 100644 --- a/Files/MultilingualResources/Files.ru-RU.xlf +++ b/Files/MultilingualResources/Files.ru-RU.xlf @@ -1126,6 +1126,30 @@ Invalid item Invalid item + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.ta.xlf b/Files/MultilingualResources/Files.ta.xlf index 320743c1e5ef..5e1a5d355351 100644 --- a/Files/MultilingualResources/Files.ta.xlf +++ b/Files/MultilingualResources/Files.ta.xlf @@ -1103,6 +1103,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1131,6 +1151,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.tr-TR.xlf b/Files/MultilingualResources/Files.tr-TR.xlf index eee5dd4f6527..3aa9f78a43ec 100644 --- a/Files/MultilingualResources/Files.tr-TR.xlf +++ b/Files/MultilingualResources/Files.tr-TR.xlf @@ -1102,6 +1102,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1130,6 +1150,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.uk-UA.xlf b/Files/MultilingualResources/Files.uk-UA.xlf index 7632a174619a..81c3cf665cdd 100644 --- a/Files/MultilingualResources/Files.uk-UA.xlf +++ b/Files/MultilingualResources/Files.uk-UA.xlf @@ -1126,6 +1126,30 @@ Invalid item Invalid item + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/MultilingualResources/Files.zh-Hans.xlf b/Files/MultilingualResources/Files.zh-Hans.xlf index 7361763b416c..29432c34af2d 100644 --- a/Files/MultilingualResources/Files.zh-Hans.xlf +++ b/Files/MultilingualResources/Files.zh-Hans.xlf @@ -1101,6 +1101,26 @@ Show a horizontal tab strip on the title bar Show a horizontal tab strip on the title bar + + Unknown + Unknown + + + Open log location + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + Something went wrong! + + + Report this issue + Report this issue + Contributors Contributors @@ -1129,6 +1149,10 @@ Invalid item Invalid item + + Version: + Version: + There's nothing to share right now There's nothing to share right now diff --git a/Files/Strings/en-US/Resources.resw b/Files/Strings/en-US/Resources.resw index fb790a4881a0..05022c7ff875 100644 --- a/Files/Strings/en-US/Resources.resw +++ b/Files/Strings/en-US/Resources.resw @@ -936,6 +936,21 @@ Show a horizontal tab strip on the title bar + + Unknown + + + Open log location + + + Files ran into a problem that the developers didn't prepare for yet. + + + Something went wrong! + + + Report this issue + Contributors @@ -957,6 +972,9 @@ Invalid item + + Version: + There's nothing to share right now diff --git a/Files/View Models/SettingsViewModel.cs b/Files/View Models/SettingsViewModel.cs index f8a861ac60aa..3e29ea48afbe 100644 --- a/Files/View Models/SettingsViewModel.cs +++ b/Files/View Models/SettingsViewModel.cs @@ -19,6 +19,7 @@ using Windows.Storage; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; +using Windows.System; namespace Files.View_Models { @@ -69,6 +70,16 @@ public SettingsViewModel() } } + public static async void OpenLogLocation() + { + await Launcher.LaunchFolderAsync(ApplicationData.Current.LocalFolder); + } + + public static async void ReportIssueOnGitHub() + { + await Launcher.LaunchUriAsync(new Uri(@"https://github.com/files-community/files-uwp/issues/new/choose")); + } + public DefaultLanguageModel CurrentLanguage { get; set; } = new DefaultLanguageModel(ApplicationLanguages.PrimaryLanguageOverride); public ObservableCollection DefaultLanguages { get; } diff --git a/Files/Views/MainPage.xaml.cs b/Files/Views/MainPage.xaml.cs index a98f05de67f3..fa7ec34e15fe 100644 --- a/Files/Views/MainPage.xaml.cs +++ b/Files/Views/MainPage.xaml.cs @@ -380,4 +380,4 @@ private async void AddNewInstanceAccelerator_Invoked(KeyboardAccelerator sender, args.Handled = true; } } -} \ No newline at end of file +} diff --git a/Files/Views/SettingsPages/About.xaml.cs b/Files/Views/SettingsPages/About.xaml.cs index 8507c7e56529..942ee0102b6d 100644 --- a/Files/Views/SettingsPages/About.xaml.cs +++ b/Files/Views/SettingsPages/About.xaml.cs @@ -1,6 +1,5 @@ using System; using Windows.ApplicationModel; -using Windows.Storage; using Windows.System; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -13,19 +12,16 @@ public About() { InitializeComponent(); var version = Package.Current.Id.Version; - VersionNumber.Text = string.Format($"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"); - } - - private async void OpenLogLocationButton_Click(object sender, RoutedEventArgs e) - { - await Launcher.LaunchFolderAsync(ApplicationData.Current.LocalFolder); + VersionNumber.Text = string.Format($"{ResourceController.GetTranslation("SettingsAboutVersionTitle")} {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"); } + + private void OpenLogLocationButton_Click(object sender, RoutedEventArgs e) => View_Models.SettingsViewModel.OpenLogLocation(); private async void FeedbackListView_DoubleTapped(object sender, Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs e) { if (FeedbackListView.SelectedIndex == 0) { - await Launcher.LaunchUriAsync(new Uri(@"https://github.com/files-community/files-uwp/issues/new/choose")); + View_Models.SettingsViewModel.ReportIssueOnGitHub(); } else if (FeedbackListView.SelectedIndex == 1) {