diff --git a/App.xaml.cs b/App.xaml.cs
index e77a22c..031cc02 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -1,17 +1,28 @@
namespace ShoopNCook;
using ShoopNCook.Pages;
using Models;
+using Models.Endpoint;
+using LocalEndpoint;
-public partial class App : Application
+public partial class App : Application, ConnectionObserver
{
+ private IEndpoint endpoint = new LocalEndpoint();
+
public App()
{
InitializeComponent();
- Shell main = new ConnectAppShell();
- main.GoToAsync("//Splash");
- MainPage = main;
+
+ Shell shell = new ConnectAppShell(this, endpoint.AccountManager);
+ shell.GoToAsync("//Splash");
+ MainPage = shell;
}
+ public void OnAccountConnected(Account account)
+ {
+ Shell shell = new MainAppShell(account);
+ shell.GoToAsync("//MainPage");
+ MainPage = shell;
+ }
}
\ No newline at end of file
diff --git a/ConnectAppShell.xaml b/ConnectAppShell.xaml
index 5a68f99..6fb0bb9 100644
--- a/ConnectAppShell.xaml
+++ b/ConnectAppShell.xaml
@@ -19,13 +19,11 @@
+ Route="Login"/>
+ Route="Register"/>
\ No newline at end of file
diff --git a/ConnectAppShell.xaml.cs b/ConnectAppShell.xaml.cs
index d3568ea..8cc6953 100644
--- a/ConnectAppShell.xaml.cs
+++ b/ConnectAppShell.xaml.cs
@@ -1,11 +1,17 @@
namespace ShoopNCook;
using Microsoft.Maui.Controls;
using Models;
-
+using Models.Endpoint;
+using ShoopNCook.Controllers;
+using ShoopNCook.Pages;
+
public partial class ConnectAppShell : Shell
{
- public ConnectAppShell()
+ public ConnectAppShell(ConnectionObserver observer, IAccountManager accounts)
{
+ ConnectionController controller = new ConnectionController(observer, accounts);
InitializeComponent();
+ LoginPage.ContentTemplate = new DataTemplate(() => new LoginPage(controller));
+ RegisterPage.ContentTemplate = new DataTemplate(() => new RegisterPage(controller));
}
}
diff --git a/ConnectionObserver.cs b/ConnectionObserver.cs
new file mode 100644
index 0000000..e4955f7
--- /dev/null
+++ b/ConnectionObserver.cs
@@ -0,0 +1,14 @@
+using Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShoopNCook
+{
+ public interface ConnectionObserver
+ {
+ public void OnAccountConnected(Account account);
+ }
+}
diff --git a/Controllers/ConnectionController.cs b/Controllers/ConnectionController.cs
new file mode 100644
index 0000000..8aa7803
--- /dev/null
+++ b/Controllers/ConnectionController.cs
@@ -0,0 +1,26 @@
+using Models.Endpoint;
+using Models;
+
+namespace ShoopNCook.Controllers
+{
+ public class ConnectionController : LoginController, RegisterController
+ {
+ private readonly ConnectionObserver observer;
+ private readonly IAccountManager accounts;
+ public ConnectionController(ConnectionObserver observer, IAccountManager accounts) {
+ this.observer = observer;
+ this.accounts = accounts;
+ }
+ public void Login(string email, string password)
+ {
+ Account acc = accounts.Login(email, password);
+ observer.OnAccountConnected(acc);
+ }
+
+ public void Register(string username, string email, string password)
+ {
+ Account acc = accounts.Register(username, email, password);
+ observer.OnAccountConnected(acc);
+ }
+ }
+}
diff --git a/Controllers/LoginController.cs b/Controllers/LoginController.cs
new file mode 100644
index 0000000..2006643
--- /dev/null
+++ b/Controllers/LoginController.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShoopNCook.Controllers
+{
+ public interface LoginController
+ {
+ public void Login(string email, string password);
+ }
+}
diff --git a/Controllers/RegisterController.cs b/Controllers/RegisterController.cs
new file mode 100644
index 0000000..b73b075
--- /dev/null
+++ b/Controllers/RegisterController.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShoopNCook.Controllers
+{
+ public interface RegisterController
+ {
+ public void Register(string username, string email, string password);
+ }
+}
diff --git a/LocalEndpoint/AccountManager.cs b/LocalEndpoint/AccountManager.cs
new file mode 100644
index 0000000..5f79089
--- /dev/null
+++ b/LocalEndpoint/AccountManager.cs
@@ -0,0 +1,34 @@
+using Models;
+using Models.Endpoint;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocalEndpoint
+{
+ internal class AccountManager : IAccountManager
+ {
+ private static readonly Uri DEFAULT_ACCOUNT_IMAGE = new Uri("https://www.pngkey.com/png/full/115-1150152_default-profile-picture-avatar-png-green.png");
+
+ private Account userAccount = new Account(new User(DEFAULT_ACCOUNT_IMAGE, "Stub Account"), "test@example.com");
+ private string userPassword = "123456";
+
+ public Account? Login(string email, string password)
+ {
+ if (userAccount.Email == email && userPassword == password)
+ {
+ return userAccount;
+ }
+ return null;
+ }
+
+ public Account? Register(string email, string username, string password)
+ {
+ userAccount = new Account(new User(DEFAULT_ACCOUNT_IMAGE, username), email);
+ userPassword = password;
+ return userAccount;
+ }
+ }
+}
diff --git a/LocalEndpoint/Class1.cs b/LocalEndpoint/Class1.cs
deleted file mode 100644
index 29fb9ea..0000000
--- a/LocalEndpoint/Class1.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace LocalEndpoint
-{
- public class Class1
- {
-
- }
-}
\ No newline at end of file
diff --git a/LocalEndpoint/LocalEndpoint.cs b/LocalEndpoint/LocalEndpoint.cs
new file mode 100644
index 0000000..f45112a
--- /dev/null
+++ b/LocalEndpoint/LocalEndpoint.cs
@@ -0,0 +1,11 @@
+using Models.Endpoint;
+
+namespace LocalEndpoint
+{
+ public class LocalEndpoint : IEndpoint
+ {
+ public IAccountManager AccountManager => new AccountManager();
+
+ public ISearchEngine SearchEngine => throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/LocalEndpoint/LocalEndpoint.csproj b/LocalEndpoint/LocalEndpoint.csproj
index e45d1d7..a913705 100644
--- a/LocalEndpoint/LocalEndpoint.csproj
+++ b/LocalEndpoint/LocalEndpoint.csproj
@@ -1,4 +1,4 @@
-
+
net7.0
diff --git a/MainAppShell.xaml b/MainAppShell.xaml
index 549c9f7..53d2736 100644
--- a/MainAppShell.xaml
+++ b/MainAppShell.xaml
@@ -10,24 +10,6 @@
Shell.TabBarTitleColor="{StaticResource Selected}"
Shell.TabBarUnselectedColor="{StaticResource TextColorSecondary}">
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/ShoopNCook.csproj b/ShoopNCook.csproj
index cff5220..f220635 100644
--- a/ShoopNCook.csproj
+++ b/ShoopNCook.csproj
@@ -48,27 +48,22 @@
-
-
-
-
-
@@ -118,7 +113,7 @@
-
+
diff --git a/ShoopNCook.sln b/ShoopNCook.sln
index f0e9130..f914fd4 100644
--- a/ShoopNCook.sln
+++ b/ShoopNCook.sln
@@ -1,44 +1,44 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.0.31611.283
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShoopNCook", "ShoopNCook.csproj", "{8ED2FB1D-C04D-478D-9271-CC91FE110396}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{E50D92DC-0BB1-4998-B085-EF47C55675AC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "Models\Models.csproj", "{A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalEndpoint", "LocalEndpoint\LocalEndpoint.csproj", "{57732316-93B9-4DA0-A212-F8892D3D968B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Build.0 = Release|Any CPU
- {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.Build.0 = Release|Any CPU
- {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Release|Any CPU.Build.0 = Release|Any CPU
- {57732316-93B9-4DA0-A212-F8892D3D968B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {57732316-93B9-4DA0-A212-F8892D3D968B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {57732316-93B9-4DA0-A212-F8892D3D968B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {57732316-93B9-4DA0-A212-F8892D3D968B}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
- EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31611.283
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShoopNCook", "ShoopNCook.csproj", "{8ED2FB1D-C04D-478D-9271-CC91FE110396}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{E50D92DC-0BB1-4998-B085-EF47C55675AC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "Models\Models.csproj", "{A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalEndpoint", "LocalEndpoint\LocalEndpoint.csproj", "{57732316-93B9-4DA0-A212-F8892D3D968B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {57732316-93B9-4DA0-A212-F8892D3D968B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {57732316-93B9-4DA0-A212-F8892D3D968B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {57732316-93B9-4DA0-A212-F8892D3D968B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {57732316-93B9-4DA0-A212-F8892D3D968B}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
+ EndGlobalSection
+EndGlobal
diff --git a/Views/Components/RecipeView.xaml b/Views/Components/RecipeView.xaml
index 1842b45..8e794da 100644
--- a/Views/Components/RecipeView.xaml
+++ b/Views/Components/RecipeView.xaml
@@ -23,7 +23,7 @@
StrokeShape="RoundRectangle 20"
BackgroundColor="{StaticResource ImageBackground}">
-
+
+ Placeholder="Mail address"
+ x:Name="EmailEntry"/>
@@ -57,7 +58,8 @@
+ Placeholder="Password"
+ x:Name="PasswordEntry"/>
+ Placeholder="User Name"
+ x:Name="UserNameEntry"/>
@@ -59,7 +60,8 @@
+ Placeholder="Mail address"
+ x:Name="EmailEntry"/>
@@ -76,7 +78,8 @@
+ Placeholder="Password"
+ x:Name="PasswordEntry"/>