Merge pull request 'Models integration bases' (#40) from models/endpoint into master
continuous-integration/drone/push Build is passing Details

Reviewed-on: ShopNCook/ShopNCook#40
pull/51/head
Maxime BATISTA 2 years ago
commit d9abce1972

@ -1,23 +1,32 @@
namespace ShoopNCook; namespace ShoopNCook;
using ShoopNCook.Pages; using Models;
using ShoopNCook.Models; using Endpoint;
using ShoopNCook.Models.API; using LocalEndpoint;
public partial class App : Application public partial class App : Application, ConnectionObserver, IApp
{ {
private IEndpoint Endpoint = new LocalEndpoint();
public UserNotifier Notifier => new ConsoleUserNotifier();
public App() public App()
{ {
InitializeComponent(); InitializeComponent();
ForceLogin(); //start in login state
}
Account account = getUserAccount(); public void OnAccountConnected(Account account)
{
var appShell = new AppShell(); Shell shell = new MainAppShell(account, this);
MainPage = appShell; shell.GoToAsync("//Main");
appShell.GoToAsync("//Splash"); MainPage = shell;
} }
private Account getUserAccount() public void ForceLogin()
{ {
return new Account(new User(new Uri("https://www.pngkey.com/png/full/115-1150152_default-profile-picture-avatar-png-green.png"), "Stub Account"), "test@example.com"); Shell shell = new ConnectAppShell(this, Endpoint.AccountManager, Notifier);
shell.GoToAsync("//Splash");
MainPage = shell;
} }
} }

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="ShoopNCook.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ShoopNCook"
xmlns:pages="clr-namespace:ShoopNCook.Pages"
Shell.FlyoutBehavior="Disabled"
Shell.NavBarIsVisible="False"
Shell.TabBarBackgroundColor="White"
Shell.TabBarTitleColor="{StaticResource Selected}"
Shell.TabBarUnselectedColor="{StaticResource TextColorSecondary}">
<ShellContent
x:Name="Splash"
Title="More"
ContentTemplate="{DataTemplate pages:Splash}"
Route="Splash"/>
<ShellContent
x:Name="LoginPage"
Title="Login"
ContentTemplate="{DataTemplate pages:LoginPage}"
Route="LoginPage"/>
<ShellContent
x:Name="RegisterPage"
Title="Register"
ContentTemplate="{DataTemplate pages:RegisterPage}"
Route="RegisterPage"/>
<TabBar>
<ShellContent
x:Name="HomeTab"
Title="Home"
ContentTemplate="{DataTemplate pages:HomePage}"
Route="HomePage"
Icon="home.svg"/>
<ShellContent
x:Name="FavoritesTab"
Title="Favorites"
ContentTemplate="{DataTemplate pages:FavoritesPage}"
Route="Favorites"
Icon="hearth_on.svg"/>
<ShellContent
x:Name="MyListTab"
Title="MyList"
ContentTemplate="{DataTemplate pages:MyListPage}"
Route="MyList"
Icon="list.svg"/>
<ShellContent
x:Name="MoreTab"
Title="More"
ContentTemplate="{DataTemplate pages:MorePage}"
Route="More"
Icon="more.svg"/>
</TabBar>
<FlyoutItem Title="Search">
<ShellContent
Title="Search Page"
ContentTemplate="{DataTemplate pages:SearchPage}"
Route="Search"/>
</FlyoutItem>
<FlyoutItem Title="RecipePage">
<ShellContent
Title="RecipePage"
ContentTemplate="{DataTemplate pages:RecipePage}"
Route="RecipePage"/>
</FlyoutItem>
<FlyoutItem Title="MyRecipePage">
<ShellContent
Title="MyRecipesPage"
ContentTemplate="{DataTemplate pages:MyRecipesPage}"
Route="MyRecipe"/>
</FlyoutItem>
<FlyoutItem Title="ProfilePage">
<ShellContent
Title="ProfilePage"
ContentTemplate="{DataTemplate pages:ProfilePage}"
Route="EditProfile"/>
</FlyoutItem>
<FlyoutItem>
<ShellContent
x:Name="ForgotPassword"
Title="Login"
ContentTemplate="{DataTemplate pages:ForgotPassword}"
Route="ForgotPassword"/>
</FlyoutItem>
<FlyoutItem>
<ShellContent
x:Name="CreateRecipe"
Title="CreateRecipe"
ContentTemplate="{DataTemplate pages:CreateRecipePage}"
Route="CreateRecipe"/>
</FlyoutItem>
</Shell>

@ -1,13 +0,0 @@
namespace ShoopNCook;
using ShoopNCook.Pages;
using Microsoft.Maui.Controls;
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="ShoopNCook.ConnectAppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:ShoopNCook.Pages"
Shell.FlyoutBehavior="Disabled"
Shell.NavBarIsVisible="False"
Shell.TabBarBackgroundColor="White"
Shell.TabBarTitleColor="{StaticResource Selected}"
Shell.TabBarUnselectedColor="{StaticResource TextColorSecondary}">
<ShellContent
x:Name="Splash"
Title="More"
ContentTemplate="{DataTemplate pages:Splash}"
Route="Splash"/>
<ShellContent
x:Name="LoginPage"
Title="Login"
Route="Login"/>
<ShellContent
x:Name="RegisterPage"
Title="Register"
Route="Register"/>
</Shell>

@ -0,0 +1,17 @@
namespace ShoopNCook;
using Microsoft.Maui.Controls;
using Models;
using Endpoint;
using ShoopNCook.Controllers;
using ShoopNCook.Pages;
public partial class ConnectAppShell : Shell
{
public ConnectAppShell(ConnectionObserver observer, IAccountManager accounts, UserNotifier notifier)
{
ConnectionController controller = new ConnectionController(observer, accounts, notifier);
InitializeComponent();
LoginPage.ContentTemplate = new DataTemplate(() => new LoginPage(controller));
RegisterPage.ContentTemplate = new DataTemplate(() => new RegisterPage(controller));
}
}

@ -0,0 +1,9 @@
using Models;
namespace ShoopNCook
{
public interface ConnectionObserver
{
public void OnAccountConnected(Account account);
}
}

@ -0,0 +1,24 @@
namespace ShoopNCook
{
/// <summary>
/// A notice reporter implementation that prints in console the applications's user notices.
/// </summary>
public class ConsoleUserNotifier :
UserNotifier
{
public void Error(string message)
{
Console.WriteLine("<User Notice> Error: " + message);
}
public void Notice(string message)
{
Console.WriteLine("<User Notice> Notice: " + message);
}
public void Warn(string message)
{
Console.WriteLine("<User Notice> Warn: " + message);
}
}
}

@ -0,0 +1,39 @@
using Endpoint;
using Models;
namespace ShoopNCook.Controllers
{
public class ConnectionController : LoginController, RegisterController
{
private readonly ConnectionObserver observer;
private readonly IAccountManager accounts;
private readonly UserNotifier notifier;
public ConnectionController(ConnectionObserver observer, IAccountManager accounts, UserNotifier notifier) {
this.observer = observer;
this.accounts = accounts;
this.notifier = notifier;
}
public void Login(string email, string password)
{
Account? acc = accounts.Login(email, password);
if (acc == null)
{
notifier.Error("Email or password invalid.");
return;
}
observer.OnAccountConnected(acc);
}
public void Register(string username, string email, string password)
{
Account? acc = accounts.Register(username, email, password);
if (acc == null)
{
notifier.Error("Invalid credentials.");
return;
}
observer.OnAccountConnected(acc);
}
}
}

@ -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);
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook.Controllers
{
public class MorePageController
{
private readonly IApp app;
public MorePageController(IApp app) {
this.app = app;
}
public void Logout()
{
app.Notifier.Notice("You have been loged out.");
app.ForceLogin();
}
}
}

@ -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);
}
}

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,10 @@
using Models;
namespace Endpoint
{
public interface IAccountManager
{
public Account? Login(string email, string password);
public Account? Register(string email, string username, string password);
}
}

@ -0,0 +1,11 @@

namespace Endpoint
{
public interface IEndpoint
{
public IAccountManager AccountManager { get; }
}
}

@ -0,0 +1,16 @@
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook
{
public interface IApp
{
public UserNotifier Notifier { get; }
public void ForceLogin();
}
}

@ -0,0 +1,37 @@
using Models;
using 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)
{
if (email == null || username == null || password == null)
return null;
userAccount = new Account(new User(DEFAULT_ACCOUNT_IMAGE, username), email);
userPassword = password;
return userAccount;
}
}
}

@ -0,0 +1,10 @@
using Endpoint;
namespace LocalEndpoint
{
public class LocalEndpoint : IEndpoint
{
public IAccountManager AccountManager => new AccountManager();
}
}

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Endpoint\Endpoint.csproj" />
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="ShoopNCook.MainAppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:ShoopNCook.Pages"
Shell.FlyoutBehavior="Disabled"
Shell.NavBarIsVisible="False"
Shell.TabBarBackgroundColor="White"
Shell.TabBarTitleColor="{StaticResource Selected}"
Shell.TabBarUnselectedColor="{StaticResource TextColorSecondary}">
<TabBar>
<ShellContent
x:Name="HomeTab"
Title="Home"
Route="Home"
Icon="home.svg"/>
<ShellContent
x:Name="FavoritesTab"
Title="Favorites"
Route="Favorites"
Icon="hearth_on.svg"/>
<ShellContent
x:Name="MyListTab"
Title="MyList"
Route="MyList"
Icon="list.svg"/>
<ShellContent
x:Name="MoreTab"
Title="More"
Route="More"
Icon="more.svg"/>
</TabBar>
</Shell>

@ -0,0 +1,17 @@
namespace ShoopNCook;
using Microsoft.Maui.Controls;
using Models;
using ShoopNCook.Controllers;
using ShoopNCook.Pages;
public partial class MainAppShell : Shell
{
public MainAppShell(Account account, IApp app)
{
InitializeComponent();
HomeTab.ContentTemplate = new DataTemplate(() => new HomePage(account, app));
FavoritesTab.ContentTemplate = new DataTemplate(() => new FavoritesPage(account, app));
MyListTab.ContentTemplate = new DataTemplate(() => new MyListPage(account, app));
MoreTab.ContentTemplate = new DataTemplate(() => new MorePage(account, new MorePageController(app)));
}
}

@ -16,7 +16,6 @@ public static class MauiProgram
fonts.AddFont("Poppins-Bold.ttf", "PoppinsBold"); fonts.AddFont("Poppins-Bold.ttf", "PoppinsBold");
fonts.AddFont("Poppins-Regular.ttf", "Poppins"); fonts.AddFont("Poppins-Regular.ttf", "Poppins");
fonts.AddFont("Poppins-Medium.ttf", "PoppinsMedium"); fonts.AddFont("Poppins-Medium.ttf", "PoppinsMedium");
fonts.AddFont("Poppins-Regular.ttf", "Poppins");
}); });
#if DEBUG #if DEBUG
builder.Logging.AddDebug(); builder.Logging.AddDebug();

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook.Models.API
{
public interface IAccountManager
{
public Account login(string email, string password);
}
}

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook.Models.API
{
public interface IEndpoint
{
public IAccountManager AccountManager { get; }
public ISearchEngine SearchEngine { get; }
}
}

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook.Models.API
{
public interface ISearchEngine
{
//TODO define methods to search recipes
}
}

@ -1,4 +1,4 @@
namespace ShoopNCook.Models namespace Models
{ {
public class Account public class Account
{ {

@ -1,10 +1,10 @@
 namespace Models
namespace ShoopNCook.Models
{ {
public class Ingredient public class Ingredient
{ {
public Ingredient(string name, float amount, Quantity quantity) { public Ingredient(string name, float amount, Quantity quantity)
{
Name = name; Name = name;
Amount = amount; Amount = amount;
Quantity = quantity; Quantity = quantity;

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -1,13 +1,12 @@
 namespace Models
namespace ShoopNCook.Models
{ {
public class PreparationStep public class PreparationStep
{ {
public PreparationStep(string name, string description) public PreparationStep(string name, string description)
{ {
this.Name = name; Name = name;
this.Description = description; Description = description;
} }
public string Name { get; init; } public string Name { get; init; }

@ -1,5 +1,4 @@
 namespace Models
namespace ShoopNCook.Models
{ {
public class Quantity public class Quantity
{ {

@ -1,5 +1,4 @@
 namespace Models
namespace ShoopNCook.Models
{ {
public class Recipe public class Recipe
{ {

@ -1,5 +1,4 @@
 namespace Models
namespace ShoopNCook.Models
{ {
public class RecipeInfo public class RecipeInfo
{ {

@ -1,5 +1,4 @@
 namespace Models
namespace ShoopNCook.Models
{ {
public class User public class User
{ {
@ -10,7 +9,7 @@ namespace ShoopNCook.Models
Name = name; Name = name;
} }
public Uri ProfilePicture { get; init; } public Uri ProfilePicture { get; init; }
public string Name { get; init; } public string Name { get; init; }
} }
} }

@ -1,174 +1,204 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net7.0;net7.0-android</TargetFrameworks> <TargetFrameworks>net7.0;net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET --> <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> --> <!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>ShoopNCook</RootNamespace> <RootNamespace>ShoopNCook</RootNamespace>
<UseMaui>true</UseMaui> <UseMaui>true</UseMaui>
<SingleProject>true</SingleProject> <SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<!-- Display name --> <!-- Display name -->
<ApplicationTitle>ShoopNCook</ApplicationTitle> <ApplicationTitle>ShoopNCook</ApplicationTitle>
<!-- App Identifier --> <!-- App Identifier -->
<ApplicationId>com.companyname.shoopncook</ApplicationId> <ApplicationId>com.companyname.shoopncook</ApplicationId>
<ApplicationIdGuid>bf17e1fe-a722-42f6-a24d-3327d351c924</ApplicationIdGuid> <ApplicationIdGuid>bf17e1fe-a722-42f6-a24d-3327d351c924</ApplicationIdGuid>
<!-- Versions --> <!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion> <ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- App Icon --> <!-- App Icon -->
<!-- Splash Screen --> <!-- Splash Screen -->
<!-- Images --> <!-- Images -->
<MauiImage Include="Resources\Images\*" /> <MauiImage Include="Resources\Images\*" />
<!-- Custom Fonts --> <!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" /> <MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Remove="ShopNCookTests\**" /> <AndroidResource Remove="ShopNCookTests\**" />
<AndroidResource Remove="Tests\**" /> <AndroidResource Remove="Tests\**" />
<Compile Remove="ShopNCookTests\**" /> <Compile Remove="Endpoint\**" />
<Compile Remove="Tests\**" /> <Compile Remove="LocalEndpoint\**" />
<EmbeddedResource Remove="ShopNCookTests\**" /> <Compile Remove="Models\**" />
<EmbeddedResource Remove="Tests\**" /> <Compile Remove="ShopNCookTests\**" />
<MauiCss Remove="ShopNCookTests\**" /> <Compile Remove="Tests\**" />
<MauiCss Remove="Tests\**" /> <EmbeddedResource Remove="Endpoint\**" />
<MauiXaml Remove="ShopNCookTests\**" /> <EmbeddedResource Remove="LocalEndpoint\**" />
<MauiXaml Remove="Tests\**" /> <EmbeddedResource Remove="Models\**" />
<None Remove="ShopNCookTests\**" /> <EmbeddedResource Remove="ShopNCookTests\**" />
<None Remove="Tests\**" /> <EmbeddedResource Remove="Tests\**" />
</ItemGroup> <MauiCss Remove="Endpoint\**" />
<MauiCss Remove="LocalEndpoint\**" />
<ItemGroup> <MauiCss Remove="Models\**" />
<None Remove="Resources\Fonts\Poppins-Bold.ttf" /> <MauiCss Remove="ShopNCookTests\**" />
<None Remove="Resources\Fonts\Poppins-Medium.ttf" /> <MauiCss Remove="Tests\**" />
<None Remove="Resources\Fonts\Poppins-Regular.ttf" /> <MauiXaml Remove="Endpoint\**" />
<None Remove="Resources\Images\cookie.svg" /> <MauiXaml Remove="LocalEndpoint\**" />
<None Remove="Resources\Images\email_icon.svg" /> <MauiXaml Remove="Models\**" />
<None Remove="Resources\Images\facebook_logo.svg" /> <MauiXaml Remove="ShopNCookTests\**" />
<None Remove="Resources\Images\hearth_off.svg" /> <MauiXaml Remove="Tests\**" />
<None Remove="Resources\Images\hearth_on.svg" /> <None Remove="Endpoint\**" />
<None Remove="Resources\Images\Home.svg" /> <None Remove="LocalEndpoint\**" />
<None Remove="Resources\Images\list.svg" /> <None Remove="Models\**" />
<None Remove="Resources\Images\logout_arrow.svg" /> <None Remove="ShopNCookTests\**" />
<None Remove="Resources\Images\minus.svg" /> <None Remove="Tests\**" />
<None Remove="Resources\Images\moon_white.svg" /> </ItemGroup>
<None Remove="Resources\Images\email_icon.svg" />
<None Remove="Resources\Images\facebook_logo.svg" /> <ItemGroup>
<None Remove="Resources\Images\more.svg" /> <None Remove="Resources\Fonts\Poppins-Bold.ttf" />
<None Remove="Resources\Images\password_icon.svg" /> <None Remove="Resources\Fonts\Poppins-Medium.ttf" />
<None Remove="Resources\Images\search_options.svg" /> <None Remove="Resources\Fonts\Poppins-Regular.ttf" />
<None Remove="Resources\Images\share.svg" /> <None Remove="Resources\Images\cookie.svg" />
<None Remove="Resources\Images\star_empty.svg" /> <None Remove="Resources\Images\email_icon.svg" />
<None Remove="Resources\Images\star_full.svg" /> <None Remove="Resources\Images\facebook_logo.svg" />
<None Remove="Resources\Images\user.svg" /> <None Remove="Resources\Images\hearth_off.svg" />
<None Remove="Resources\Images\user_fill.svg" /> <None Remove="Resources\Images\hearth_on.svg" />
<None Remove="Resources\Images\visibility_off.svg" /> <None Remove="Resources\Images\Home.svg" />
<None Remove="Resources\Images\visibility_on.svg" /> <None Remove="Resources\Images\list.svg" />
</ItemGroup> <None Remove="Resources\Images\logout_arrow.svg" />
<None Remove="Resources\Images\minus.svg" />
<ItemGroup> <None Remove="Resources\Images\moon_white.svg" />
<None Remove="Resources\Fonts\arrow_back_ios_FILL0_wght400_GRAD200_opsz48.svg" /> <None Remove="Resources\Images\email_icon.svg" />
<None Remove="Resources\Images\default_profile_picture.png" /> <None Remove="Resources\Images\facebook_logo.svg" />
</ItemGroup> <None Remove="Resources\Images\more.svg" />
<None Remove="Resources\Images\password_icon.svg" />
<ItemGroup> <None Remove="Resources\Images\search_options.svg" />
<MauiFont Include="Resources\Images\arrow_back.svg" /> <None Remove="Resources\Images\share.svg" />
</ItemGroup> <None Remove="Resources\Images\star_empty.svg" />
<None Remove="Resources\Images\star_full.svg" />
<ItemGroup> <None Remove="Resources\Images\user.svg" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" /> <None Remove="Resources\Images\user_fill.svg" />
<PackageReference Include="xunit" Version="2.4.2" /> <None Remove="Resources\Images\visibility_off.svg" />
</ItemGroup> <None Remove="Resources\Images\visibility_on.svg" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\MyListPage.xaml.cs"> <ItemGroup>
<DependentUpon>MyListPage.xaml</DependentUpon> <None Remove="Resources\Fonts\arrow_back_ios_FILL0_wght400_GRAD200_opsz48.svg" />
</Compile> <None Remove="Resources\Images\default_profile_picture.png" />
</ItemGroup>
<ItemGroup>
<MauiFont Include="Resources\Images\arrow_back.svg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Endpoint\Endpoint.csproj" />
<ProjectReference Include="LocalEndpoint\LocalEndpoint.csproj" />
<ProjectReference Include="Models\Models.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="ConnectAppShell.xaml.cs">
<DependentUpon>ConnectAppShell.xaml</DependentUpon>
</Compile>
<Compile Update="MainAppShell.xaml.cs">
<DependentUpon>MainAppShell.xaml</DependentUpon>
</Compile>
<Compile Update="Views\MyListPage.xaml.cs">
<DependentUpon>MyListPage.xaml</DependentUpon>
</Compile>
<Compile Update="Views\Components\IngredientEntry.xaml.cs"> <Compile Update="Views\Components\IngredientEntry.xaml.cs">
<DependentUpon>IngredientEntry.xaml</DependentUpon> <DependentUpon>IngredientEntry.xaml</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MauiXaml Update="Views\CreateRecipePage.xaml"> <MauiXaml Update="ConnectAppShell.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Splash.xaml"> <MauiXaml Update="Views\CreateRecipePage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Components\CounterView.xaml"> <MauiXaml Update="Views\Splash.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Components\HeadedButton.xaml"> <MauiXaml Update="Views\Components\CounterView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Components\IngredientEntry.xaml"> <MauiXaml Update="Views\Components\HeadedButton.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Components\IngredientView.xaml"> <MauiXaml Update="Views\Components\IngredientEntry.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\FavoritesPage.xaml"> <MauiXaml Update="Views\Components\IngredientView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\MorePage.xaml"> <MauiXaml Update="Views\FavoritesPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\ProfilePage.xaml"> <MauiXaml Update="Views\MorePage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\RecipePage.xaml"> <MauiXaml Update="Views\ProfilePage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Components\RecipeView.xaml"> <MauiXaml Update="Views\RecipePage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\RegisterPage.xaml"> <MauiXaml Update="Views\Components\RecipeView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\SearchPage.xaml"> <MauiXaml Update="Views\RegisterPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Components\RecipeView.xaml"> <MauiXaml Update="Views\SearchPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\SearchPage.xaml"> <MauiXaml Update="Views\Components\RecipeView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\SearchPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\Components\StepEntry.xaml"> <MauiXaml Update="Views\Components\StepEntry.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Views\Components\StoredRecipeView.xaml"> <MauiXaml Update="Views\Components\StoredRecipeView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
</ItemGroup> </ItemGroup>
<ProjectExtensions> <ProjectExtensions>
<VisualStudio> <VisualStudio>
<UserProperties XamarinHotReloadDebuggerTimeoutExceptionShoopNCookHideInfoBar="True" XamarinHotReloadUnhandledDeviceExceptionShoopNCookHideInfoBar="True" /> <UserProperties XamarinHotReloadDebuggerTimeoutExceptionShoopNCookHideInfoBar="True" XamarinHotReloadUnhandledDeviceExceptionShoopNCookHideInfoBar="True" />
</VisualStudio> </VisualStudio>
</ProjectExtensions> </ProjectExtensions>
</Project> </Project>

@ -1,32 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283 VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShoopNCook", "ShoopNCook.csproj", "{8ED2FB1D-C04D-478D-9271-CC91FE110396}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShoopNCook", "ShoopNCook.csproj", "{8ED2FB1D-C04D-478D-9271-CC91FE110396}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{E50D92DC-0BB1-4998-B085-EF47C55675AC}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{E50D92DC-0BB1-4998-B085-EF47C55675AC}"
EndProject EndProject
Global Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "Models\Models.csproj", "{A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}"
GlobalSection(SolutionConfigurationPlatforms) = preSolution EndProject
Debug|Any CPU = Debug|Any CPU Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalEndpoint", "LocalEndpoint\LocalEndpoint.csproj", "{57732316-93B9-4DA0-A212-F8892D3D968B}"
Release|Any CPU = Release|Any CPU EndProject
EndGlobalSection Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Endpoint", "Endpoint\Endpoint.csproj", "{C976BDD8-710D-4162-8A42-973B634491F9}"
GlobalSection(ProjectConfigurationPlatforms) = postSolution EndProject
{8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU Global
{8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Build.0 = Debug|Any CPU GlobalSection(SolutionConfigurationPlatforms) = preSolution
{8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Deploy.0 = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
{8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.ActiveCfg = Release|Any CPU Release|Any CPU = Release|Any CPU
{8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection
{8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Deploy.0 = Release|Any CPU GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.Build.0 = Release|Any CPU {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Build.0 = Release|Any CPU
GlobalSection(SolutionProperties) = preSolution {8ED2FB1D-C04D-478D-9271-CC91FE110396}.Release|Any CPU.Deploy.0 = Release|Any CPU
HideSolutionNode = FALSE {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
EndGlobalSection {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
GlobalSection(ExtensibilityGlobals) = postSolution {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572} {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
EndGlobal {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
{C976BDD8-710D-4162-8A42-973B634491F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C976BDD8-710D-4162-8A42-973B634491F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C976BDD8-710D-4162-8A42-973B634491F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C976BDD8-710D-4162-8A42-973B634491F9}.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

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook
{
public interface UserNotifier
{
public void Notice(string message);
public void Error(string message);
public void Warn(string message);
}
}

@ -23,7 +23,7 @@
StrokeShape="RoundRectangle 20" StrokeShape="RoundRectangle 20"
BackgroundColor="{StaticResource ImageBackground}"> BackgroundColor="{StaticResource ImageBackground}">
<Grid> <Grid>
<Image /> <Image x:Name="RecipeImage" />
<HorizontalStackLayout <HorizontalStackLayout
x:Name="Stars" x:Name="Stars"
VerticalOptions="End" VerticalOptions="End"

@ -1,8 +1,10 @@
using Models;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class FavoritesPage : ContentPage public partial class FavoritesPage : ContentPage
{ {
public FavoritesPage() public FavoritesPage(Account account, IApp app)
{ {
InitializeComponent(); InitializeComponent();
} }

@ -13,22 +13,22 @@
JustifyContent="SpaceBetween" JustifyContent="SpaceBetween"
AlignItems="Center" AlignItems="Center"
AlignContent="Center" AlignContent="Center"
Margin="20,35,20,20" Margin="20,35,20,20">
>
<Border <Border
Style="{StaticResource SecondaryBorder}" Style="{StaticResource SecondaryBorder}"
BackgroundColor="{StaticResource BackgroundSecondary}" BackgroundColor="{StaticResource BackgroundSecondary}"
StrokeShape="RoundRectangle 1500" StrokeShape="RoundRectangle 1500">
>
<ImageButton <ImageButton
Source="default_profile_picture.png" x:Name="ProfilePictureImage"
WidthRequest="65" WidthRequest="65"
HeightRequest="65"/> HeightRequest="65"/>
</Border> </Border>
<Label Style="{StaticResource h1}" x:Name="ProfilePictureName"/>
</FlexLayout> </FlexLayout>
<Grid <Grid
ColumnDefinitions="*,Auto" ColumnDefinitions="*,Auto"
Grid.Row="1" Grid.Row="1"
Margin="20"> Margin="20">

@ -1,10 +1,14 @@
using Models;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class HomePage : ContentPage public partial class HomePage : ContentPage
{ {
public HomePage() public HomePage(Account account, IApp app)
{ {
InitializeComponent(); InitializeComponent();
ProfilePictureImage.Source = ImageSource.FromUri(account.User.ProfilePicture);
ProfilePictureName.Text = account.User.Name;
} }
private async void OnSyncButtonClicked(object sender, EventArgs e) private async void OnSyncButtonClicked(object sender, EventArgs e)
{ {

@ -38,7 +38,8 @@
<Entry <Entry
Style="{StaticResource UserInput}" Style="{StaticResource UserInput}"
Grid.Column="2" Grid.Column="2"
Placeholder="Mail address"/> Placeholder="Mail address"
x:Name="EmailEntry"/>
</Grid> </Grid>
</Border> </Border>
@ -57,7 +58,8 @@
<Entry <Entry
Style="{StaticResource UserInput}" Style="{StaticResource UserInput}"
Grid.Column="2" Grid.Column="2"
Placeholder="Password"/> Placeholder="Password"
x:Name="PasswordEntry"/>
<ImageButton <ImageButton
Grid.Column="3" Grid.Column="3"
Source="visibility_off.svg" Source="visibility_off.svg"

@ -1,27 +1,28 @@
namespace ShoopNCook.Pages; using Endpoint;
using ShoopNCook.Controllers;
public partial class LoginPage : ContentPage
{ namespace ShoopNCook.Pages;
public LoginPage()
{ public partial class LoginPage : ContentPage
InitializeComponent(); {
} private readonly LoginController controller;
private async void OnLoginButtonClicked(object sender, EventArgs e) public LoginPage(LoginController controller)
{ {
// Vérifiez les informations d'identification de l'utilisateur ici InitializeComponent();
bool isValidUser = true; this.controller = controller;
}
if (isValidUser) private async void OnLoginButtonClicked(object sender, EventArgs e)
{ {
await Shell.Current.GoToAsync("//HomePage"); string email = EmailEntry.Text;
} string password = PasswordEntry.Text;
} controller.Login(email, password);
private async void ForgotPasswordTapped(object sender, EventArgs e) }
{ private async void ForgotPasswordTapped(object sender, EventArgs e)
await Shell.Current.Navigation.PushAsync(new ForgotPassword()); {
} await Shell.Current.Navigation.PushAsync(new ForgotPassword());
private async void RegisterLabbelTapped(object sender, EventArgs e) }
{ private async void RegisterLabbelTapped(object sender, EventArgs e)
await Shell.Current.GoToAsync("//RegisterPage"); {
} await Shell.Current.GoToAsync("//Register");
}
} }

@ -1,17 +1,21 @@
using Models;
using ShoopNCook.Controllers;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class MorePage : ContentPage public partial class MorePage : ContentPage
{ {
public MorePage(): this("Adom Shafi", ImageSource.FromFile("default_profile_picture.png"))
{
}
public MorePage(string userName, ImageSource userImage) private readonly MorePageController controller;
public MorePage(Account account, MorePageController controller)
{ {
InitializeComponent(); InitializeComponent();
ProfileImage.Source = userImage; ProfileImage.Source = ImageSource.FromUri(account.User.ProfilePicture);
ProfileName.Text = userName; ProfileName.Text = account.User.Name;
this.controller = controller;
} }
private async void OnMyRecipesButtonTapped(object sender, EventArgs e) private async void OnMyRecipesButtonTapped(object sender, EventArgs e)
{ {
await Shell.Current.Navigation.PushAsync(new MyRecipesPage()); await Shell.Current.Navigation.PushAsync(new MyRecipesPage());
@ -22,9 +26,9 @@ public partial class MorePage : ContentPage
await Shell.Current.Navigation.PushAsync(new ProfilePage()); await Shell.Current.Navigation.PushAsync(new ProfilePage());
} }
private async void OnLogoutButtonTapped(object sender, EventArgs e) private void OnLogoutButtonTapped(object sender, EventArgs e)
{ {
await Shell.Current.GoToAsync("//LoginPage"); controller.Logout();
} }
private async void OnShareButtonClicked(object sender, EventArgs e) private async void OnShareButtonClicked(object sender, EventArgs e)
{ {

@ -1,9 +1,11 @@
using Models;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class MyListPage : ContentPage public partial class MyListPage : ContentPage
{ {
public MyListPage() public MyListPage(Account account, IApp app)
{ {
InitializeComponent(); InitializeComponent();
} }
} }

@ -40,7 +40,8 @@
<Entry <Entry
Style="{StaticResource UserInput}" Style="{StaticResource UserInput}"
Grid.Column="2" Grid.Column="2"
Placeholder="User Name"/> Placeholder="User Name"
x:Name="UserNameEntry"/>
</Grid> </Grid>
</Border> </Border>
@ -59,7 +60,8 @@
<Entry <Entry
Style="{StaticResource UserInput}" Style="{StaticResource UserInput}"
Grid.Column="2" Grid.Column="2"
Placeholder="Mail address"/> Placeholder="Mail address"
x:Name="EmailEntry"/>
</Grid> </Grid>
</Border> </Border>
@ -76,7 +78,8 @@
<Entry <Entry
Style="{StaticResource UserInput}" Style="{StaticResource UserInput}"
Grid.Column="2" Grid.Column="2"
Placeholder="Password"/> Placeholder="Password"
x:Name="PasswordEntry"/>
<ImageButton <ImageButton
Grid.Column="3" Grid.Column="3"
Source="visibility_off.svg" Source="visibility_off.svg"
@ -84,8 +87,6 @@
</Grid> </Grid>
</Border> </Border>
<Border <Border
Margin="0, 30, 0, 0" Margin="0, 30, 0, 0"
Stroke="{StaticResource BackgroundPrimary}" Stroke="{StaticResource BackgroundPrimary}"

@ -1,17 +1,24 @@
using ShoopNCook.Controllers;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class RegisterPage : ContentPage public partial class RegisterPage : ContentPage
{ {
public RegisterPage() private readonly RegisterController controller;
public RegisterPage(RegisterController controller)
{ {
InitializeComponent(); InitializeComponent();
this.controller = controller;
} }
private async void LoginTapped(object sender, EventArgs e) private async void LoginTapped(object sender, EventArgs e)
{ {
await Shell.Current.GoToAsync("//LoginPage"); await Shell.Current.GoToAsync("//Login");
} }
private async void RegisterTapped(object sender, EventArgs e) private void RegisterTapped(object sender, EventArgs e)
{ {
await Shell.Current.GoToAsync("//LoginPage"); string email = EmailEntry.Text;
string password = PasswordEntry.Text;
string username = UserNameEntry.Text;
controller.Register(username, email, password);
} }
} }

@ -5,12 +5,10 @@ public partial class Splash : ContentPage
public Splash() public Splash()
{ {
InitializeComponent(); InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
} }
private async void OnGetStartedButtonClicked(object sender, EventArgs e) private async void OnGetStartedButtonClicked(object sender, EventArgs e)
{ {
await Shell.Current.GoToAsync("//LoginPage"); await Shell.Current.GoToAsync("//Login");
} }
} }

Loading…
Cancel
Save