Skip to content

Commit

Permalink
Merge pull request #16 from DevElkami/Dev
Browse files Browse the repository at this point in the history
MAUII Finished
  • Loading branch information
DevElkami authored May 7, 2023
2 parents e21056b + 3823b71 commit ac7d1a2
Show file tree
Hide file tree
Showing 38 changed files with 526 additions and 227 deletions.
13 changes: 12 additions & 1 deletion MauiPasswordVault/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using MauiPasswordVault.View;
using Microsoft.Maui.Hosting;
using System.Globalization;
using System.Text.RegularExpressions;

namespace MauiPasswordVault
{
Expand All @@ -8,9 +11,17 @@ public App(SearchPage searchPage)
{
if (Application.Current != null)
Application.Current.UserAppTheme = AppTheme.Dark;

InitializeComponent();

#if DEBUG
Resources.MergedDictionaries.Add(new MauiPasswordVault.Resources.Lang.en());
#else
if (Thread.CurrentThread.CurrentUICulture.IetfLanguageTag == "fr-FR")
Resources.MergedDictionaries.Add(new MauiPasswordVault.Resources.Lang.fr());
else
Resources.MergedDictionaries.Add(new MauiPasswordVault.Resources.Lang.en());
#endif

MainPage = new NavigationPage(searchPage);
}
}
Expand Down
29 changes: 19 additions & 10 deletions MauiPasswordVault/MauiPasswordVault.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
<ApplicationTitle>Password Vault</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.mauipasswordvault</ApplicationId>
<ApplicationId>com.github.vault</ApplicationId>
<ApplicationIdGuid>8409360f-6d94-4dc3-a09f-38b31006a68d</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>3.0.0.0</ApplicationDisplayVersion>
<ApplicationDisplayVersion>3.3.0.0</ApplicationDisplayVersion>
<ApplicationVersion>3</ApplicationVersion>

<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>
<Version>3.0.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<Version>3.3.0.0</Version>
<AssemblyVersion>3.3.0.0</AssemblyVersion>
<FileVersion>3.3.0.0</FileVersion>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
Expand All @@ -42,8 +42,8 @@
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.png" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- App Splash -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#A265BE" Resize="false" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
Expand All @@ -57,12 +57,15 @@
</ItemGroup>

<ItemGroup>
<None Remove="Resources\Images\home.svg" />
<None Remove="Resources\Images\information.svg" />
</ItemGroup>
<None Remove="Platforms\Android\Resources\style.xml" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="5.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="NLog" Version="5.1.4" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
</ItemGroup>

<ItemGroup>
Expand All @@ -76,6 +79,12 @@
</ItemGroup>

<ItemGroup>
<MauiXaml Update="Resources\Lang\en.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Resources\Lang\fr.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\AboutPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
Expand Down
31 changes: 27 additions & 4 deletions MauiPasswordVault/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using MauiPasswordVault.Service;
using CommunityToolkit.Maui;
using MauiPasswordVault.Service;
using MauiPasswordVault.View;
using MauiPasswordVault.ViewModel;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using NLog;
using VaultCore;
using NLog.Config;
using NLog.Targets;

namespace MauiPasswordVault;

Expand All @@ -13,6 +18,7 @@ public static MauiApp CreateMauiApp()
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
Expand All @@ -22,6 +28,26 @@ public static MauiApp CreateMauiApp()
fonts.AddFont("AwesomeSolid.otf", "AwesomeSolid");
});

#region Logger
LoggingConfiguration logConfig = new();

FileTarget fileTarget = new()
{
FileName = typeof(MauiProgram).FullName + ".log",
Layout = @"${longdate} [${uppercase:${level}}] ${logger} - ${message} ${exception:format=tostring}"
};

LoggingRule fileRule = new("*", NLog.LogLevel.Info, fileTarget);
logConfig.LoggingRules.Add(fileRule);
logConfig.AddTarget("logfile", fileTarget);

builder.Logging.ClearProviders();
builder.Logging.AddNLog(logConfig);
#if DEBUG
builder.Logging.AddDebug();
#endif
#endregion

builder.Services.AddSingleton<MyVault>();
builder.Services.AddSingleton<NavigationService>();
builder.Services.AddSingleton<ErrorService>();
Expand All @@ -37,9 +63,6 @@ public static MauiApp CreateMauiApp()

builder.Services.AddTransient<ErrorPage>();
builder.Services.AddTransient<ErrorViewModel>();
#if DEBUG
builder.Logging.AddDebug();
#endif

return builder.Build();
}
Expand Down
2 changes: 1 addition & 1 deletion MauiPasswordVault/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace MauiPasswordVault
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
[Activity(Theme = "@style/MyAppTheme", MainLauncher = true, ScreenOrientation = ScreenOrientation.Sensor, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimary">#A265BE</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
<color name="colorAccent">#A265BE</color>
<color name="ListViewSelected">#000000</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyAppTheme" parent="Maui.SplashTheme">
<item name="android:colorPressedHighlight">@color/ListViewSelected</item>
<item name="android:colorFocusedHighlight">@color/ListViewSelected</item>
<item name="android:colorActivatedHighlight">@color/ListViewSelected</item>
<item name="android:activatedBackgroundIndicator">@color/ListViewSelected</item>
</style>
</resources>
Binary file added MauiPasswordVault/Resources/Images/dimport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 0 additions & 93 deletions MauiPasswordVault/Resources/Images/dotnet_bot.svg

This file was deleted.

1 change: 0 additions & 1 deletion MauiPasswordVault/Resources/Images/home.svg

This file was deleted.

Loading

0 comments on commit ac7d1a2

Please sign in to comment.