diff --git a/Emerald.App/Emerald.App.Package/Package.WinUI.wapproj b/Emerald.App/Emerald.App.Package/Package.WinUI.wapproj index 7e80b9ea..acbf8918 100644 --- a/Emerald.App/Emerald.App.Package/Package.WinUI.wapproj +++ b/Emerald.App/Emerald.App.Package/Package.WinUI.wapproj @@ -55,7 +55,7 @@ True ..\Emerald.App\Emerald.App.csproj False - BA30AECD14618A89C2822FC6912530F0B59E436D + 9CBDFA6FDB25BE48AA09759C40DFAB769CF9740A SHA256 True True @@ -63,6 +63,7 @@ D:\Projects\Emerald\Emerald.App\Emerald.App.Package\AppPackages\ 0 False + Package.WinUI_TemporaryKey.pfx Auto diff --git a/Emerald.App/Emerald.App/Helpers/Extentions.cs b/Emerald.App/Emerald.App/Helpers/Extentions.cs index 4016a7ae..42278a2d 100644 --- a/Emerald.App/Emerald.App/Helpers/Extentions.cs +++ b/Emerald.App/Emerald.App/Helpers/Extentions.cs @@ -160,14 +160,14 @@ public static bool IsNullEmptyOrWhiteSpace(this string str) => public static Models.Account ToAccount(this CmlLib.Core.Auth.MSession session, bool plusCount = true) { - bool isOffline = session.UUID == "user_uuid"; + bool isOffline = session.AccessToken == "access_token"; return new Models.Account(session.Username, isOffline ? null : session.AccessToken, isOffline ? null : session.UUID, plusCount ? MainWindow.HomePage.AccountsPage.AllCount++ : 0, false, session.ClientToken); } public static CmlLib.Core.Auth.MSession ToMSession(this Models.Account account) { bool isOffline = account.UUID == null; - return new CmlLib.Core.Auth.MSession(account.UserName, isOffline ? "access_token" : account.AccessToken, isOffline ? Guid.NewGuid().ToString() : account.UUID ?? "2749420bc7a54b05ab622b34e61b8a79", account.ClientToken); + return new CmlLib.Core.Auth.MSession(account.UserName, isOffline ? "access_token" : account.AccessToken, isOffline ? Guid.NewGuid().ToString().Replace("-", "") : account.UUID) { ClientToken = account.ClientToken }; } } } diff --git a/Emerald.App/Emerald.App/Helpers/Settings/JSON.cs b/Emerald.App/Emerald.App/Helpers/Settings/JSON.cs index 6a80e1fb..19f0dc87 100644 --- a/Emerald.App/Emerald.App/Helpers/Settings/JSON.cs +++ b/Emerald.App/Emerald.App/Helpers/Settings/JSON.cs @@ -163,11 +163,19 @@ public class App : JSON public Discord Discord { get; set; } = new(); public NewsFilter NewsFilter { get; set; } = new(); public Store Store { get; set; } = new(); + public Updates Updates { get; set; } = new(); public bool AutoClose { get; set; } public bool HideOnLaunch { get; set; } public bool WindowsHello { get; set; } } + public class Updates : JSON + { + + public bool CheckAtStartup { get; set; } = true; + public bool AutoDownload { get; set; } + public bool IncludePreReleases { get; set; } + } public partial class StoreFilter : JSON { [ObservableProperty] diff --git a/Emerald.App/Emerald.App/Helpers/Updater/Updater.cs b/Emerald.App/Emerald.App/Helpers/Updater/Updater.cs index 42be4e21..e62f920c 100644 --- a/Emerald.App/Emerald.App/Helpers/Updater/Updater.cs +++ b/Emerald.App/Emerald.App/Helpers/Updater/Updater.cs @@ -23,6 +23,7 @@ using Windows.Management.Deployment; using Windows.Storage; using static PInvoke.Kernel32; +using SS = Emerald.WinUI.Helpers.Settings.SettingsSystem; namespace Emerald.WinUI.Helpers.Updater { @@ -31,14 +32,14 @@ public class Updater public Architecture Architecture => RuntimeInformation.ProcessArchitecture; private GitHubClient Client; - public bool IsPrereleaseEnabled { get; set; } = false; + public bool IsPrereleaseEnabled => SS.Settings.App.Updates.IncludePreReleases; public Updater() { } bool IsInitialized = false; public async System.Threading.Tasks.Task Initialize() { - var cId = await FileIO.ReadTextAsync(await StorageFile.GetFileFromPathAsync($"{Windows.ApplicationModel.Package.Current.InstalledPath}\\MsalClientID.txt")); + var cId = await FileIO.ReadTextAsync(await StorageFile.GetFileFromPathAsync($"{Windows.ApplicationModel.Package.Current.InstalledPath}\\GithubClientID.txt")); Client = new GitHubClient(new Octokit.ProductHeaderValue(cId)); IsInitialized = true; diff --git a/Emerald.App/Emerald.App/MainWindow.xaml.cs b/Emerald.App/Emerald.App/MainWindow.xaml.cs index 830dfd5c..7d2efe89 100644 --- a/Emerald.App/Emerald.App/MainWindow.xaml.cs +++ b/Emerald.App/Emerald.App/MainWindow.xaml.cs @@ -1,6 +1,7 @@ using Emerald.Core; using Emerald.Core.Tasks; using Emerald.WinUI.Helpers; +using Emerald.WinUI.Helpers.Settings.JSON; using Emerald.WinUI.Helpers.Updater; using Emerald.WinUI.Models; using Emerald.WinUI.UserControls; @@ -207,7 +208,9 @@ void TintColor() { UpdateUI(); }; - App.Current.Updater.CheckForUpdates(); + + if (SS.Settings.App.Updates.CheckAtStartup) + App.Current.Updater.CheckForUpdates(); (Content as FrameworkElement).Loaded -= Initialize; } private static void UpdateUI() diff --git a/Emerald.App/Emerald.App/Models/Account.cs b/Emerald.App/Emerald.App/Models/Account.cs index 0c16244c..9c09afdb 100644 --- a/Emerald.App/Emerald.App/Models/Account.cs +++ b/Emerald.App/Emerald.App/Models/Account.cs @@ -22,28 +22,27 @@ public partial class Account : Model public bool Last { get; set; } // For app UI - public string TypeIconGlyph { get => Type == AccountType.Offline ? "\xF384" : "\xEC05"; } + public string TypeIconGlyph { get => IsOffline ? "\xF384" : "\xEC05"; } - public string ProfilePicture { get => Type != AccountType.Offline ? "https://minotar.net/avatar/" + UUID : "https://minotar.net/avatar/MHF_Steve"; } + public string ProfilePicture { get => !IsOffline ? "https://minotar.net/avatar/" + UUID : "https://minotar.net/avatar/MHF_Steve"; } - public string BodyPicture { get => Type != AccountType.Offline ? "https://minotar.net/body/" + UUID : "https://minotar.net/body/MHF_Steve"; } + public string BodyPicture { get => !IsOffline ? "https://minotar.net/body/" + UUID : "https://minotar.net/body/MHF_Steve"; } - public string Skin { get => Type != AccountType.Offline ? "https://minotar.net/skin/" + UUID : "https://minotar.net/skin/MHF_Steve"; } + public string Skin { get => !IsOffline ? "https://minotar.net/skin/" + UUID : "https://minotar.net/skin/MHF_Steve"; } - public AccountType Type { get => UUID == null ? AccountType.Offline : AccountType.Microsoft; } + public AccountType Type { get => IsOffline ? AccountType.Offline : AccountType.Microsoft; } [ObservableProperty] private bool _CheckBoxLoaded; public string TypeString - => IsFake ? Localized.MicrosoftOrOffline.Localize() : (IsOffline ? Localized.OfflineAccount.Localize() : Localized.MicrosoftAccount.Localize()); + => IsOffline ? Localized.OfflineAccount.Localize() : Localized.MicrosoftAccount.Localize(); [ObservableProperty] private bool _IsChecked; - public bool IsOffline => UUID == null; + public bool IsOffline => string.IsNullOrWhiteSpace(AccessToken); - public bool IsFake => UUID == "fake" || AccessToken == "fake"; public Account(string username, string accesstoken, string uuid, int count, bool last, string clientToken = null) { diff --git a/Emerald.App/Emerald.App/Strings/en-US/Resources.resw b/Emerald.App/Emerald.App/Strings/en-US/Resources.resw index 8ecec14a..2c910bf2 100644 --- a/Emerald.App/Emerald.App/Strings/en-US/Resources.resw +++ b/Emerald.App/Emerald.App/Strings/en-US/Resources.resw @@ -736,4 +736,22 @@ Update now + + Automatically download updates if available + + + Check for updates when app starts + + + Check Now + + + Include pre-releases + + + Updates + + + Automatically update, include prerelease etc.. + \ No newline at end of file diff --git a/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml b/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml index 4a762886..87c8a9b1 100644 --- a/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml +++ b/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml @@ -8,7 +8,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Emerald.WinUI.UserControls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Spacing="6"> \ No newline at end of file diff --git a/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml.cs b/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml.cs index c80590f2..8933a8c1 100644 --- a/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml.cs +++ b/Emerald.App/Emerald.App/UserControls/ExpanderItem.xaml.cs @@ -18,6 +18,18 @@ public ExpanderItem() + public string Description + { + get { return (string)GetValue(DescriptionProperty); } + set { SetValue(DescriptionProperty, value); } + } + + // Using a DependencyProperty as the backing store for Description. This enables animation, styling, binding, etc... + public static readonly DependencyProperty DescriptionProperty = + DependencyProperty.Register("Description", typeof(string), typeof(ExpanderItem), new PropertyMetadata(null)); + + + public string Title { get { return (string)GetValue(TitleProperty); } diff --git a/Emerald.App/Emerald.App/Views/Settings/AboutPage.xaml b/Emerald.App/Emerald.App/Views/Settings/AboutPage.xaml index 2263acb8..2dcf8261 100644 --- a/Emerald.App/Emerald.App/Views/Settings/AboutPage.xaml +++ b/Emerald.App/Emerald.App/Views/Settings/AboutPage.xaml @@ -123,6 +123,28 @@ + + + + +