Krzysztof Krysiński il y a 1 semaine
Parent
commit
5f79422b52

+ 5 - 3
src/PixiEditor/ViewModels/SubViewModels/UserViewModel.cs

@@ -83,7 +83,7 @@ internal class UserViewModel : SubViewModel<ViewModelMain>
 
     public string Username => IdentityProvider?.User?.Username;
 
-    public string? AvatarUrl => IdentityProvider.User?.AvatarUrl;
+    public string? AvatarUrl => IdentityProvider?.User?.AvatarUrl;
 
     public bool NonDefaultIdentityProvider => IdentityProvider is not PixiAuthIdentityProvider;
     public bool AnyUpdateAvailable => OwnedProducts.Any(x => x.UpdateAvailable);
@@ -99,14 +99,16 @@ internal class UserViewModel : SubViewModel<ViewModelMain>
 
     public UserViewModel(ViewModelMain owner) : base(owner)
     {
-        IdentityProvider = IPlatform.Current.IdentityProvider;
-        AdditionalContentProvider = IPlatform.Current.AdditionalContentProvider;
+        IdentityProvider = IPlatform.Current?.IdentityProvider;
+        AdditionalContentProvider = IPlatform.Current?.AdditionalContentProvider;
         RequestLoginCommand = new AsyncRelayCommand<string>(RequestLogin, CanRequestLogin);
         TryValidateSessionCommand = new AsyncRelayCommand(TryValidateSession);
         ResendActivationCommand = new AsyncRelayCommand<string>(ResendActivation, CanResendActivation);
         InstallContentCommand = new AsyncRelayCommand<string>(InstallContent, CanInstallContent);
         LogoutCommand = new AsyncRelayCommand(Logout);
 
+        if (IdentityProvider == null) return;
+
         IdentityProvider.OnError += OnError;
         IdentityProvider.OwnedProductsUpdated += IdentityProviderOnOwnedProductsUpdated;
         IdentityProvider.UsernameUpdated += IdentityProviderOnUsernameUpdated;

+ 6 - 6
tests/PixiEditor.Api.CGlueMSBuild.Tests/CApiGeneratorTests.cs

@@ -7,7 +7,7 @@ public class CApiGeneratorTests
     [Fact]
     public void TestThatLoadAssemblies()
     {
-        CApiGenerator apiGenerator = new CApiGenerator("", (message) => { });
+        CApiGenerator apiGenerator = new CApiGenerator("", "", "", (message) => { });
         AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly("TestAssets/CGlueTestLib.dll");
         var assemblies = apiGenerator.LoadAssemblies(assembly, "TestAssets");
 
@@ -17,7 +17,7 @@ public class CApiGeneratorTests
     [Fact]
     public void TestThatImportedMethodsAreExtractedCorrectly()
     {
-        CApiGenerator apiGenerator = new CApiGenerator("", (message) => { });
+        CApiGenerator apiGenerator = new CApiGenerator("", "", "", (message) => { });
         AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly("TestAssets/CGlueTestLib.dll");
         var assemblies = apiGenerator.LoadAssemblies(assembly, "TestAssets");
 
@@ -29,7 +29,7 @@ public class CApiGeneratorTests
     [Fact]
     public void TestThatGenerateImportsGeneratesCorrectImports()
     {
-        CApiGenerator apiGenerator = new CApiGenerator("", (message) => { });
+        CApiGenerator apiGenerator = new CApiGenerator("", "", "", (message) => { });
         AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly("TestAssets/CGlueTestLib.dll");
         var assemblies = apiGenerator.LoadAssemblies(assembly, "TestAssets");
 
@@ -45,7 +45,7 @@ public class CApiGeneratorTests
     [Fact]
     public void TestThatGenerateImportsForStringReturnTypeGeneratesConversionCorrectly()
     {
-        CApiGenerator apiGenerator = new CApiGenerator("", (message) => { });
+        CApiGenerator apiGenerator = new CApiGenerator("", "", "", (message) => { });
         AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly("TestAssets/CGlueTestLib.dll");
         var assemblies = apiGenerator.LoadAssemblies(assembly, "TestAssets");
 
@@ -65,7 +65,7 @@ public class CApiGeneratorTests
     [Fact]
     public void TestThatGenerateExportsGeneratesCorrectExports()
     {
-        CApiGenerator apiGenerator = new CApiGenerator("", (message) => { });
+        CApiGenerator apiGenerator = new CApiGenerator("", "", "", (message) => { });
         AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly("TestAssets/CGlueTestLib.dll");
         var assemblies = apiGenerator.LoadAssemblies(assembly, "TestAssets");
 
@@ -86,7 +86,7 @@ public class CApiGeneratorTests
     [Fact]
     public void TestThatAttachImportFunctionsGenerateProperly()
     {
-        CApiGenerator apiGenerator = new CApiGenerator("", (message) => { });
+        CApiGenerator apiGenerator = new CApiGenerator("", "", "", (message) => { });
         AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly("TestAssets/CGlueTestLib.dll");
         var assemblies = apiGenerator.LoadAssemblies(assembly, "TestAssets");
 

+ 6 - 6
tests/PixiEditor.Extensions.Sdk.Tests/NativeControlSerializationTest.cs

@@ -10,7 +10,7 @@ public class NativeControlSerializationTest
     [Fact]
     public void TestThatNoChildLayoutSerializesCorrectBytes()
     {
-        ControlDefinition layout = new ControlDefinition(0, "Layout");
+        ControlDefinition layout = new ControlDefinition(0, typeof(Layout));
         layout.AddProperty("Title");
 
         int uniqueId = 0;
@@ -46,8 +46,8 @@ public class NativeControlSerializationTest
     [Fact]
     public void TestThatChildLayoutSerializesCorrectBytes()
     {
-        ControlDefinition layout = new ControlDefinition(0, "Layout");
-        layout.AddChild(new ControlDefinition(1, "Center"));
+        ControlDefinition layout = new ControlDefinition(0, typeof(Layout));
+        layout.AddChild(new ControlDefinition(1, typeof(Center)));
 
         int uniqueId = 0;
         byte[] uniqueIdBytes = BitConverter.GetBytes(uniqueId);
@@ -115,9 +115,9 @@ public class NativeControlSerializationTest
     [Fact]
     public void TestThatChildNestedLayoutSerializesCorrectBytes()
     {
-        ControlDefinition layout = new ControlDefinition(0, "Layout");
-        ControlDefinition center = new ControlDefinition(1, "Center");
-        ControlDefinition text = new ControlDefinition(2, "Text");
+        ControlDefinition layout = new ControlDefinition(0, typeof(Layout));
+        ControlDefinition center = new ControlDefinition(1, typeof(Center));
+        ControlDefinition text = new ControlDefinition(2, typeof(Text));
         text.AddProperty("Hello world");
         center.AddChild(text);
         layout.AddChild(center);

+ 21 - 0
tests/PixiEditorTests.sln

@@ -125,6 +125,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drawie.Windowing.Glfw", "..
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PixiEditor.Windows", "..\src\PixiEditor.Windows\PixiEditor.Windows.csproj", "{2D1F681A-9C3F-4253-954E-E5A24285AD5D}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PixiEditor.IdentityProvider", "..\src\PixiEditor.IdentityProvider\PixiEditor.IdentityProvider.csproj", "{7992D29C-3740-489C-ACA6-EECA13850928}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PixiEditor.IdentityProvider.PixiAuth", "..\src\PixiEditor.IdentityProvider.PixiAuth\PixiEditor.IdentityProvider.PixiAuth.csproj", "{C663FF4B-3EBD-4CB8-9787-1A6B69EDDE5B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PixiEditor.PixiAuth", "..\src\PixiEditor.PixiAuth\PixiEditor.PixiAuth.csproj", "{BB110405-6FB2-45A1-A1DD-4A2DCA74723B}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -358,6 +364,18 @@ Global
 		{2D1F681A-9C3F-4253-954E-E5A24285AD5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{2D1F681A-9C3F-4253-954E-E5A24285AD5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{2D1F681A-9C3F-4253-954E-E5A24285AD5D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7992D29C-3740-489C-ACA6-EECA13850928}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7992D29C-3740-489C-ACA6-EECA13850928}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7992D29C-3740-489C-ACA6-EECA13850928}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7992D29C-3740-489C-ACA6-EECA13850928}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C663FF4B-3EBD-4CB8-9787-1A6B69EDDE5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C663FF4B-3EBD-4CB8-9787-1A6B69EDDE5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C663FF4B-3EBD-4CB8-9787-1A6B69EDDE5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C663FF4B-3EBD-4CB8-9787-1A6B69EDDE5B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BB110405-6FB2-45A1-A1DD-4A2DCA74723B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BB110405-6FB2-45A1-A1DD-4A2DCA74723B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BB110405-6FB2-45A1-A1DD-4A2DCA74723B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BB110405-6FB2-45A1-A1DD-4A2DCA74723B}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
 		{0EF3CAB9-7361-472C-8789-D17D4EA2DEBB} = {D914C08C-5F1A-4E13-AAA6-F25E8C9748E2}
@@ -418,5 +436,8 @@ Global
 		{37662F23-90F7-4B41-8E45-5D1B09A96803} = {E118E6FE-67E7-4472-A8D7-E7F470E66131}
 		{B13E1D5E-EF6B-4193-8BE6-4C85F8C1EE59} = {E118E6FE-67E7-4472-A8D7-E7F470E66131}
 		{2D1F681A-9C3F-4253-954E-E5A24285AD5D} = {E118E6FE-67E7-4472-A8D7-E7F470E66131}
+		{7992D29C-3740-489C-ACA6-EECA13850928} = {E118E6FE-67E7-4472-A8D7-E7F470E66131}
+		{C663FF4B-3EBD-4CB8-9787-1A6B69EDDE5B} = {E118E6FE-67E7-4472-A8D7-E7F470E66131}
+		{BB110405-6FB2-45A1-A1DD-4A2DCA74723B} = {E118E6FE-67E7-4472-A8D7-E7F470E66131}
 	EndGlobalSection
 EndGlobal