Skip to content

Commit

Permalink
Merge pull request #192 from Strypper/184-get-issues-by-labels-then-s…
Browse files Browse the repository at this point in the history
…ave-them-to-localdb

184 get issues by labels then save them to localdb
  • Loading branch information
Strypper authored Mar 24, 2024
2 parents 52de297 + b24d754 commit 0fc0adf
Show file tree
Hide file tree
Showing 23 changed files with 363 additions and 195 deletions.
22 changes: 21 additions & 1 deletion maui-island.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.GitHubFeatures.In
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland", "src\Presentations\Windows\MAUIsland.csproj", "{72B83E80-9D22-4A44-AB91-253A616A9D9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAUIsland.Core", "src\Core\MAUIsland.Core\MAUIsland.Core.csproj", "{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.Core", "src\Core\MAUIsland.Core\MAUIsland.Core.csproj", "{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LocalDbFeatures", "LocalDbFeatures", "{44F9EA87-2C75-4685-B49F-8ECF3CE577CA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub", "GitHub", "{966A4C62-0966-4106-A407-A65F27A07986}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAUIsland.Features.LocalDbFeatures.GitHub", "src\Features\LocalDbFeatures\GitHub\MAUIsland.Features.LocalDbFeatures.GitHub\MAUIsland.Features.LocalDbFeatures.GitHub.csproj", "{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.Features.LocalDbFeatures", "src\Features\LocalDbFeatures\MAUIsland.Features.LocalDbFeatures\MAUIsland.Features.LocalDbFeatures.csproj", "{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -48,6 +56,14 @@ Global
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}.Release|Any CPU.Build.0 = Release|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Release|Any CPU.Build.0 = Release|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -61,6 +77,10 @@ Global
{6F539157-0DE3-407A-8769-EB997EB7AE59} = {23A84AFF-0047-4364-9351-E4521D52A26B}
{72B83E80-9D22-4A44-AB91-253A616A9D9C} = {2FD579F3-6496-437C-956B-E6F62B2D2A5A}
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265} = {36CB9EBB-A677-4AF0-A0A9-BDEBDE60F123}
{44F9EA87-2C75-4685-B49F-8ECF3CE577CA} = {73E66A66-7BCD-44FE-949C-BD42C274B840}
{966A4C62-0966-4106-A407-A65F27A07986} = {44F9EA87-2C75-4685-B49F-8ECF3CE577CA}
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4} = {966A4C62-0966-4106-A407-A65F27A07986}
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1} = {44F9EA87-2C75-4685-B49F-8ECF3CE577CA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
Expand Down
1 change: 1 addition & 0 deletions src/Core/MAUIsland.Core/MAUIsland.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

<ItemGroup>
<ProjectReference Include="..\..\Features\GitHubFeatures\MAUIsland.GitHubFeatures\MAUIsland.GitHubFeatures.csproj" />
<ProjectReference Include="..\..\Features\LocalDbFeatures\GitHub\MAUIsland.Features.LocalDbFeatures.GitHub\MAUIsland.Features.LocalDbFeatures.GitHub.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
21 changes: 20 additions & 1 deletion src/Core/MAUIsland.Core/ServiceExtension.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using CommunityToolkit.Maui;
using CommunityToolkit.Maui.Core;
using Material.Components.Maui.Extensions;
using MAUIsland.Features.LocalDbFeatures;
using MAUIsland.Features.LocalDbFeatures.GitHub;
using MAUIsland.GitHubFeatures;
using SkiaSharp.Views.Maui.Controls.Hosting;
using Xe.AcrylicView;
Expand All @@ -10,13 +13,29 @@ public static class ServicesExtension
{
public static MauiAppBuilder InitCore(this MauiAppBuilder builder)
{

builder.UseAcrylicView();
builder.UseSkiaSharp(true);
builder.UseMaterialComponents();
builder.UseMauiCommunityToolkit();
builder.UseMauiCommunityToolkitCore();
builder.UseMauiCommunityToolkitMediaElement();

builder.Services.RegisterLogicProvider();


builder.Services.RegisterGitHubFeatures();



#region [ LocalDb ]

var DbName = "mauisland.db";
var localDbPath = Path.Combine(FileSystem.AppDataDirectory, DbName);
builder.Services.RegisterLocalDbFeatures(localDbPath);
builder.Services.RegisterLocalDbFeaturesGitHub();
#endregion


return builder;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GitHubServiceIntegrationTest
public GitHubServiceIntegrationTest()
{
var services = new ServiceCollection();
services.RegisterLogicProvider();
services.RegisterGitHubFeatures();
serviceProvider = services.BuildServiceProvider();
}
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ namespace MAUIsland.GitHubFeatures;

public static class ServiceExtension
{

public static void RegisterLogicProvider(this IServiceCollection services)
public static void RegisterGitHubFeatures(this IServiceCollection services)
{
services.AddTransient<IGitHubService, OctokitGitHubClient>();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace MAUIsland.Features.LocalDbFeatures.GitHub;

public class GitHubIssueLocalDbService : SQLitePCLRawService<GitHubIssueLocalDbModel>, IGitHubIssueLocalDbService
{
#region [ CTor ]

public GitHubIssueLocalDbService(DatabaseSettings settings) : base(settings)
{

}


#endregion

#region [ Methods - Get Single ]
public async Task<GitHubIssueLocalDbModel?> GetByIssueUrlAsync(string issueUrl)
{
try
{
if (string.IsNullOrEmpty(issueUrl))
{
return default;
}

return await _connection.Table<GitHubIssueLocalDbModel>().FirstOrDefaultAsync(x => x.IssueLinkUrl == issueUrl);
}
catch (Exception ex)
{
throw;
}
}
#endregion

#region [ Methods - Get List ]
public async Task<IEnumerable<GitHubIssueLocalDbModel>?> GetByControlNameAsync(string controlName)
{
try
{
if (string.IsNullOrEmpty(controlName))
{
return default;
}

return await _connection.Table<GitHubIssueLocalDbModel>().Where(x => x.ControlName == controlName).ToListAsync();
}
catch (Exception ex)
{
throw;
}
}
#endregion
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace MAUIsland.Features.LocalDbFeatures.GitHub;

public interface IGitHubIssueLocalDbService : ILocalDbService<GitHubIssueLocalDbModel>
{
/// <summary>
/// Get list of issues related to a control.
/// </summary>
/// <param name="controlName"></param>
/// <returns></returns>
Task<IEnumerable<GitHubIssueLocalDbModel>?> GetByControlNameAsync(string controlName);

/// <summary>
/// Get single issue by its url.
/// </summary>
/// <param name="issueUrl"></param>
/// <returns></returns>
Task<GitHubIssueLocalDbModel?> GetByIssueUrlAsync(string issueUrl);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\MAUIsland.Features.LocalDbFeatures\MAUIsland.Features.LocalDbFeatures.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit 0fc0adf

Please sign in to comment.