-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
prasannap
committed
Jul 1, 2024
1 parent
ef0e902
commit b0113aa
Showing
58 changed files
with
2,008 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version = "1.0" encoding = "UTF-8" ?> | ||
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:MoviesTracker" | ||
x:Class="MoviesTracker.App"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Resources/Styles/Colors.xaml" /> | ||
<ResourceDictionary Source="Resources/Styles/Styles.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using MoviesTracker.Services; | ||
using MoviesTracker.ViewModels; | ||
using MoviesTracker.Models; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace MoviesTracker | ||
{ | ||
public partial class App : Application | ||
{ | ||
public static Supabase.Client SupabaseClient { get; private set; } | ||
public static IServiceProvider ServiceProvider { get; private set; } | ||
|
||
public App() | ||
{ | ||
InitializeComponent(); | ||
|
||
SupabaseClient = new Supabase.Client(AppConfig.SUPABASE_URL, AppConfig.SUPABASE_KEY); | ||
SupabaseClient.InitializeAsync().Wait(); | ||
|
||
var services = new ServiceCollection(); | ||
ConfigureServices(services); | ||
|
||
ServiceProvider = services.BuildServiceProvider(); | ||
var mainPage = ServiceProvider.GetRequiredService<AppShell>(); | ||
|
||
MainPage = mainPage; | ||
} | ||
|
||
private void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.AddSingleton<IAuthService, AuthService>(); | ||
services.AddSingleton<IDataService, DataService>(); | ||
services.AddTransient<LoginViewModel>(); | ||
services.AddTransient<SignUpViewModel>(); | ||
services.AddTransient<MoviesListingViewModel>(); | ||
services.AddSingleton<AppShell>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Shell | ||
x:Class="MoviesTracker.AppShell" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:views="clr-namespace:MoviesTracker.Views" | ||
Shell.FlyoutBehavior="Disabled"> | ||
|
||
<ShellContent Route="LoginPage" ContentTemplate="{DataTemplate views:LoginPage}" /> | ||
<ShellContent Route="SignUpPage" ContentTemplate="{DataTemplate views:SignUpPage}" /> | ||
<ShellContent Route="MoviesListingPage" ContentTemplate="{DataTemplate views:MoviesListingPage}" /> | ||
</Shell> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using MoviesTracker.Views; | ||
|
||
namespace MoviesTracker | ||
{ | ||
public partial class AppShell : Shell | ||
{ | ||
public AppShell() | ||
{ | ||
InitializeComponent(); | ||
|
||
RegisterForRoute<AddMoviePage>(); | ||
RegisterForRoute<UpdateMoviePage>(); | ||
} | ||
|
||
protected void RegisterForRoute<T>() | ||
{ | ||
Routing.RegisterRoute(typeof(T).Name, typeof(T)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="MoviesTracker.MainPage"> | ||
|
||
<ScrollView> | ||
<VerticalStackLayout | ||
Padding="30,0" | ||
Spacing="25"> | ||
<Image | ||
Source="dotnet_bot.png" | ||
HeightRequest="185" | ||
Aspect="AspectFit" | ||
SemanticProperties.Description="dot net bot in a race car number eight" /> | ||
|
||
<Label | ||
Text="Hello, World!" | ||
Style="{StaticResource Headline}" | ||
SemanticProperties.HeadingLevel="Level1" /> | ||
|
||
<Label | ||
Text="Welcome to .NET Multi-platform App UI" | ||
Style="{StaticResource SubHeadline}" | ||
SemanticProperties.HeadingLevel="Level2" | ||
SemanticProperties.Description="Welcome to dot net Multi platform App U I" /> | ||
|
||
<Button | ||
x:Name="CounterBtn" | ||
Text="Click me" | ||
SemanticProperties.Hint="Counts the number of times you click" | ||
Clicked="OnCounterClicked" | ||
HorizontalOptions="Fill" /> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
|
||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace MoviesTracker | ||
{ | ||
public partial class MainPage : ContentPage | ||
{ | ||
int count = 0; | ||
|
||
public MainPage() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void OnCounterClicked(object sender, EventArgs e) | ||
{ | ||
count++; | ||
|
||
if (count == 1) | ||
CounterBtn.Text = $"Clicked {count} time"; | ||
else | ||
CounterBtn.Text = $"Clicked {count} times"; | ||
|
||
SemanticScreenReader.Announce(CounterBtn.Text); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using MoviesTracker.Models; | ||
using MoviesTracker.Services; | ||
using MoviesTracker.ViewModels; | ||
using MoviesTracker.Views; | ||
using CommunityToolkit.Maui; | ||
using Microsoft.Extensions.Logging; | ||
using Supabase; | ||
|
||
namespace MoviesTracker | ||
{ | ||
public static class MauiProgram | ||
{ | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder.UseMauiApp<App>() | ||
.UseMauiCommunityToolkit() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | ||
}); | ||
|
||
// Configure Supabase | ||
var url = AppConfig.SUPABASE_URL; | ||
var key = AppConfig.SUPABASE_KEY; | ||
builder.Services.AddSingleton(provider => new Supabase.Client(url, key)); | ||
|
||
// Add ViewModels | ||
builder.Services.AddTransient<LoginViewModel>(); | ||
builder.Services.AddTransient<SignUpViewModel>(); | ||
builder.Services.AddSingleton<MoviesListingViewModel>(); | ||
builder.Services.AddTransient<AddMovieViewModel>(); | ||
builder.Services.AddTransient<UpdateMovieViewModel>(); | ||
|
||
// Add Views | ||
builder.Services.AddSingleton<LoginPage>(); | ||
builder.Services.AddSingleton<SignUpPage>(); | ||
builder.Services.AddSingleton<MoviesListingPage>(); | ||
builder.Services.AddTransient<AddMoviePage>(); | ||
builder.Services.AddTransient<UpdateMoviePage>(); | ||
|
||
// Add Data Service | ||
builder.Services.AddSingleton<IAuthService, AuthService>(); | ||
builder.Services.AddSingleton<IDataService, DataService>(); | ||
|
||
#if DEBUG | ||
builder.Logging.AddDebug(); | ||
#endif | ||
|
||
return builder.Build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
namespace MoviesTracker.Models; | ||
|
||
public static class AppConfig | ||
{ | ||
public const string SUPABASE_URL = "https://qdlkufwnccsvaxeqqlnp.supabase.co"; | ||
public const string SUPABASE_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFkbGt1ZnduY2NzdmF4ZXFxbG5wIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTk3NDY5OTIsImV4cCI6MjAzNTMyMjk5Mn0.eL1QVu-xZymRRd_pUTFPzsxs0b_Gw8yLCn2ilDsTPxo"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MoviesTracker.Models | ||
{ | ||
public class AuthUser | ||
{ | ||
public string Email { get; set; } | ||
public string Password { get; set; } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Postgrest.Attributes; | ||
using Postgrest.Models; | ||
|
||
namespace MoviesTracker.Models | ||
{ | ||
[Postgrest.Attributes.Table("movies")] | ||
public class Movie : BaseModel | ||
{ | ||
[Postgrest.Attributes.PrimaryKey("id", false)] | ||
public int Id { get; set; } | ||
|
||
[Postgrest.Attributes.Column("title")] | ||
public string Title { get; set; } | ||
|
||
[Postgrest.Attributes.Column("director")] | ||
public string Director { get; set; } | ||
|
||
[Postgrest.Attributes.Column("image_url")] | ||
public string ImageUrl { get; set; } | ||
|
||
[Postgrest.Attributes.Column("created_at", ignoreOnInsert: true)] | ||
public DateTime CreatedAt { get; set; } | ||
|
||
[Postgrest.Attributes.Column("is_finished")] | ||
public bool IsFinished { get; set; } | ||
|
||
[Postgrest.Attributes.Column("release_date")] | ||
public DateTime ReleaseDate { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks> | ||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.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 --> | ||
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> --> | ||
|
||
<!-- Note for MacCatalyst: | ||
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64. | ||
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>. | ||
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated; | ||
either BOTH runtimes must be indicated or ONLY macatalyst-x64. --> | ||
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> --> | ||
|
||
<OutputType>Exe</OutputType> | ||
<RootNamespace>MoviesTracker</RootNamespace> | ||
<UseMaui>true</UseMaui> | ||
<SingleProject>true</SingleProject> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<!-- Display name --> | ||
<ApplicationTitle>MoviesTracker</ApplicationTitle> | ||
|
||
<!-- App Identifier --> | ||
<ApplicationId>com.companyname.moviestracker</ApplicationId> | ||
|
||
<!-- Versions --> | ||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> | ||
<ApplicationVersion>1</ApplicationVersion> | ||
|
||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> | ||
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- App Icon --> | ||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> | ||
|
||
<!-- Splash Screen --> | ||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" /> | ||
|
||
<!-- Images --> | ||
<MauiImage Include="Resources\Images\*" /> | ||
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" /> | ||
|
||
<!-- Custom Fonts --> | ||
<MauiFont Include="Resources\Fonts\*" /> | ||
|
||
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> | ||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.1" /> | ||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" /> | ||
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.61" /> | ||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.61" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" /> | ||
<PackageReference Include="supabase-csharp" Version="0.16.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Update="Views\AddMoviePage.xaml.cs"> | ||
<DependentUpon>AddMoviePage.xaml</DependentUpon> | ||
</Compile> | ||
<Compile Update="Views\MoviesListingPage.xaml.cs"> | ||
<DependentUpon>MoviesListingPage.xaml</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<MauiXaml Update="Views\AddMoviePage.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
</MauiXaml> | ||
<MauiXaml Update="Views\LoginPage.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
</MauiXaml> | ||
<MauiXaml Update="Views\MoviesListingPage.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
</MauiXaml> | ||
<MauiXaml Update="Views\SignUpPage.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
</MauiXaml> | ||
<MauiXaml Update="Views\UpdateMoviePage.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
</MauiXaml> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Android.App; | ||
using Android.Content.PM; | ||
using Android.OS; | ||
|
||
namespace MoviesTracker | ||
{ | ||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] | ||
public class MainActivity : MauiAppCompatActivity | ||
{ | ||
} | ||
} |
Oops, something went wrong.