diff --git a/maui-island.sln b/maui-island.sln
index bdc920fd..1fd02dd3 100644
--- a/maui-island.sln
+++ b/maui-island.sln
@@ -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
@@ -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
@@ -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}
diff --git a/src/Core/MAUIsland.Core/MAUIsland.Core.csproj b/src/Core/MAUIsland.Core/MAUIsland.Core.csproj
index 7689ce36..856903b2 100644
--- a/src/Core/MAUIsland.Core/MAUIsland.Core.csproj
+++ b/src/Core/MAUIsland.Core/MAUIsland.Core.csproj
@@ -38,6 +38,7 @@
+
diff --git a/src/Core/MAUIsland.Core/ServiceExtension.cs b/src/Core/MAUIsland.Core/ServiceExtension.cs
index 9b9b631c..bf5f501a 100644
--- a/src/Core/MAUIsland.Core/ServiceExtension.cs
+++ b/src/Core/MAUIsland.Core/ServiceExtension.cs
@@ -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;
@@ -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;
}
}
\ No newline at end of file
diff --git a/src/Features/Gallery/Pages/BuiltIn/Controls/ProgressBar/ProgressBarPage.xaml b/src/Features/Gallery/Pages/BuiltIn/Controls/ProgressBar/ProgressBarPage.xaml
deleted file mode 100644
index 5cb2105f..00000000
--- a/src/Features/Gallery/Pages/BuiltIn/Controls/ProgressBar/ProgressBarPage.xaml
+++ /dev/null
@@ -1,173 +0,0 @@
-
-
-
-
-
-
-
-
-
- The .NET Multi-platform App UI (.NET MAUI) ProgressBar indicates to users that the app is progressing through a lengthy activity. The progress bar is a horizontal bar that is filled to a percentage represented by a double value.
-
-
- ProgressBar defines two properties:
-
-
-
- These properties are backed by BindableProperty objects, which means that they can be targets of data bindings, and styled.
-
-
-
-
- Progress is a double value that represents the current progress as a value from 0 to 1. Progress values less than 0 will be clamped to 0, values greater than 1 will be clamped to 1. The default value of this property is 0. ]]>
-
-
- ProgressColor is a Color values that defines the color of the ProgressBar. ]]>
-
-
-
-
-
- ProgressTo method animates the ProgressBar from its current Progress value to a provided value over time. The method accepts a double progress value, a uint duration in milliseconds, an Easing enum value and returns a Task. The following example demonstrates how to animate a ProgressBar: ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures.IntegrationTests/GitHubServiceIntegrationTest.cs b/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures.IntegrationTests/GitHubServiceIntegrationTest.cs
index 68e43149..05128154 100644
--- a/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures.IntegrationTests/GitHubServiceIntegrationTest.cs
+++ b/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures.IntegrationTests/GitHubServiceIntegrationTest.cs
@@ -19,7 +19,7 @@ public class GitHubServiceIntegrationTest
public GitHubServiceIntegrationTest()
{
var services = new ServiceCollection();
- services.RegisterLogicProvider();
+ services.RegisterGitHubFeatures();
serviceProvider = services.BuildServiceProvider();
}
#endregion
diff --git a/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures/ServiceExtension.cs b/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures/ServiceExtension.cs
index 41d8deb0..b82fd2b8 100644
--- a/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures/ServiceExtension.cs
+++ b/src/Features/GitHubFeatures/MAUIsland.GitHubFeatures/ServiceExtension.cs
@@ -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();
}
diff --git a/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Implementations/GitHubIssueLocalDbService.cs b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Implementations/GitHubIssueLocalDbService.cs
new file mode 100644
index 00000000..54614099
--- /dev/null
+++ b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Implementations/GitHubIssueLocalDbService.cs
@@ -0,0 +1,52 @@
+namespace MAUIsland.Features.LocalDbFeatures.GitHub;
+
+public class GitHubIssueLocalDbService : SQLitePCLRawService, IGitHubIssueLocalDbService
+{
+ #region [ CTor ]
+
+ public GitHubIssueLocalDbService(DatabaseSettings settings) : base(settings)
+ {
+
+ }
+
+
+ #endregion
+
+ #region [ Methods - Get Single ]
+ public async Task GetByIssueUrlAsync(string issueUrl)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(issueUrl))
+ {
+ return default;
+ }
+
+ return await _connection.Table().FirstOrDefaultAsync(x => x.IssueLinkUrl == issueUrl);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+ #endregion
+
+ #region [ Methods - Get List ]
+ public async Task?> GetByControlNameAsync(string controlName)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(controlName))
+ {
+ return default;
+ }
+
+ return await _connection.Table().Where(x => x.ControlName == controlName).ToListAsync();
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+ #endregion
+}
diff --git a/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Interfaces/IGitHubIssueLocalDbService.cs b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Interfaces/IGitHubIssueLocalDbService.cs
new file mode 100644
index 00000000..1a9aa70b
--- /dev/null
+++ b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Interfaces/IGitHubIssueLocalDbService.cs
@@ -0,0 +1,18 @@
+namespace MAUIsland.Features.LocalDbFeatures.GitHub;
+
+public interface IGitHubIssueLocalDbService : ILocalDbService
+{
+ ///
+ /// Get list of issues related to a control.
+ ///
+ ///
+ ///
+ Task?> GetByControlNameAsync(string controlName);
+
+ ///
+ /// Get single issue by its url.
+ ///
+ ///
+ ///
+ Task GetByIssueUrlAsync(string issueUrl);
+}
diff --git a/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/MAUIsland.Features.LocalDbFeatures.GitHub.csproj b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/MAUIsland.Features.LocalDbFeatures.GitHub.csproj
new file mode 100644
index 00000000..3c0f4bd0
--- /dev/null
+++ b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/MAUIsland.Features.LocalDbFeatures.GitHub.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/src/Presentations/Windows/Features/Common/Models/LocalDb/GitHubIssueLocalDbModel.cs b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Models/GitHubIssueLocalDbModel.cs
similarity index 78%
rename from src/Presentations/Windows/Features/Common/Models/LocalDb/GitHubIssueLocalDbModel.cs
rename to src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Models/GitHubIssueLocalDbModel.cs
index 35e42349..98f78619 100644
--- a/src/Presentations/Windows/Features/Common/Models/LocalDb/GitHubIssueLocalDbModel.cs
+++ b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/Models/GitHubIssueLocalDbModel.cs
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema;
-namespace MAUIsland;
+namespace MAUIsland.Features.LocalDbFeatures.GitHub;
[Table("IssueModel")]
public class GitHubIssueLocalDbModel : BaseLocalEntity
@@ -14,8 +14,8 @@ public GitHubIssueLocalDbModel()
#endregion
#region [ Properties ]
-
- // control name
+ [Column("control_name")]
+ public string ControlName { get; set; }
[Column("issue_id")]
public long IssueId { get; set; }
@@ -32,6 +32,9 @@ public GitHubIssueLocalDbModel()
[Column("owner_name")]
public string OwnerName { get; set; }
+ [Column("user_avatar_url")]
+ public string UserAvatarUrl { get; set; }
+
[Column("created_date")]
public DateTime CreatedDate { get; set; }
diff --git a/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/ServiceExtension.cs b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/ServiceExtension.cs
new file mode 100644
index 00000000..bc0680cc
--- /dev/null
+++ b/src/Features/LocalDbFeatures/GitHub/MAUIsland.Features.LocalDbFeatures.GitHub/ServiceExtension.cs
@@ -0,0 +1,12 @@
+using Microsoft.Extensions.DependencyInjection;
+
+namespace MAUIsland.Features.LocalDbFeatures.GitHub;
+
+public static class ServiceExtension
+{
+
+ public static void RegisterLocalDbFeaturesGitHub(this IServiceCollection services)
+ {
+ services.AddTransient();
+ }
+}
\ No newline at end of file
diff --git a/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/BaseLocalEntity.cs b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/BaseLocalEntity.cs
new file mode 100644
index 00000000..7fe9d3eb
--- /dev/null
+++ b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/BaseLocalEntity.cs
@@ -0,0 +1,9 @@
+namespace MAUIsland.Features.LocalDbFeatures;
+
+public class BaseLocalEntity
+{
+ [PrimaryKey]
+ [AutoIncrement]
+ [Column("id")]
+ public int Id { get; set; }
+}
diff --git a/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/DatabaseSettings.cs b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/DatabaseSettings.cs
new file mode 100644
index 00000000..48d03a95
--- /dev/null
+++ b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/DatabaseSettings.cs
@@ -0,0 +1,6 @@
+namespace MAUIsland.Features.LocalDbFeatures;
+
+public class DatabaseSettings
+{
+ public string DatabasePath { get; set; } = string.Empty;
+}
diff --git a/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/GlobalUsings.cs b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/GlobalUsings.cs
new file mode 100644
index 00000000..de12dba2
--- /dev/null
+++ b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/GlobalUsings.cs
@@ -0,0 +1 @@
+global using SQLite;
\ No newline at end of file
diff --git a/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/ILocalDbService.cs b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/ILocalDbService.cs
new file mode 100644
index 00000000..ab6cca05
--- /dev/null
+++ b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/ILocalDbService.cs
@@ -0,0 +1,11 @@
+namespace MAUIsland.Features.LocalDbFeatures;
+
+public interface ILocalDbService where T : class
+{
+ Task> GetAllAsync();
+ Task GetByIdAsync(int id);
+ Task AddAsync(T entity);
+ Task AddRangeAsync(IEnumerable entities);
+ Task UpdateAsync(T entity);
+ Task DeleteAsync(T entity);
+}
diff --git a/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/Implementations/SQLitePCLRawService.cs b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/Implementations/SQLitePCLRawService.cs
new file mode 100644
index 00000000..e7f26709
--- /dev/null
+++ b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/Implementations/SQLitePCLRawService.cs
@@ -0,0 +1,42 @@
+namespace MAUIsland.Features.LocalDbFeatures;
+
+public class SQLitePCLRawService : ILocalDbService where T : BaseLocalEntity, new()
+{
+ protected readonly SQLiteAsyncConnection _connection;
+
+ public SQLitePCLRawService(DatabaseSettings databaseSettings)
+ {
+ _connection = new SQLiteAsyncConnection(databaseSettings.DatabasePath);
+ _connection.CreateTableAsync().Wait();
+ }
+
+ public async Task AddAsync(T entity)
+ {
+ await _connection.InsertAsync(entity);
+ }
+
+ public async Task AddRangeAsync(IEnumerable entities)
+ {
+ await _connection.InsertAllAsync(entities);
+ }
+
+ public async Task DeleteAsync(T entity)
+ {
+ await _connection.DeleteAsync(entity);
+ }
+
+ public async Task> GetAllAsync()
+ {
+ return await _connection.Table().ToListAsync();
+ }
+
+ public async Task GetByIdAsync(int id)
+ {
+ return await _connection.Table().FirstOrDefaultAsync(x => x.Id == id);
+ }
+
+ public async Task UpdateAsync(T entity)
+ {
+ await _connection.UpdateAsync(entity);
+ }
+}
diff --git a/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/MAUIsland.Features.LocalDbFeatures.csproj b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/MAUIsland.Features.LocalDbFeatures.csproj
new file mode 100644
index 00000000..3ae4eb33
--- /dev/null
+++ b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/MAUIsland.Features.LocalDbFeatures.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/ServiceExtension.cs b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/ServiceExtension.cs
new file mode 100644
index 00000000..388d39ba
--- /dev/null
+++ b/src/Features/LocalDbFeatures/MAUIsland.Features.LocalDbFeatures/ServiceExtension.cs
@@ -0,0 +1,17 @@
+using Microsoft.Extensions.DependencyInjection;
+
+namespace MAUIsland.Features.LocalDbFeatures;
+
+public static class ServiceExtension
+{
+
+ public static void RegisterLocalDbFeatures(this IServiceCollection services, string databasePath)
+ {
+ DatabaseSettings settings = new()
+ {
+ DatabasePath = databasePath
+ };
+ services.AddSingleton(settings);
+
+ }
+}
diff --git a/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ActivityIndicator/ActivityIndicatorPageViewModel.cs b/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ActivityIndicator/ActivityIndicatorPageViewModel.cs
index 2871f33c..a5411236 100644
--- a/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ActivityIndicator/ActivityIndicatorPageViewModel.cs
+++ b/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ActivityIndicator/ActivityIndicatorPageViewModel.cs
@@ -1,4 +1,5 @@
-using MAUIsland.GitHubFeatures;
+using MAUIsland.Features.LocalDbFeatures.GitHub;
+using MAUIsland.GitHubFeatures;
namespace MAUIsland;
@@ -7,14 +8,17 @@ public partial class ActivityIndicatorPageViewModel : NavigationAwareBaseViewMod
#region [ Fields ]
private readonly IGitHubService gitHubService;
+ private readonly IGitHubIssueLocalDbService gitHubIssueLocalDbService;
#endregion
#region [ CTor ]
public ActivityIndicatorPageViewModel(IAppNavigator appNavigator,
- IGitHubService gitHubService)
+ IGitHubService gitHubService,
+ IGitHubIssueLocalDbService gitHubIssueLocalDbService)
: base(appNavigator)
{
this.gitHubService = gitHubService;
+ this.gitHubIssueLocalDbService = gitHubIssueLocalDbService;
}
#endregion
@@ -117,22 +121,60 @@ async Task RefreshControlIssues(bool forced)
IsBusy = true;
+ var now = DateTime.UtcNow;
+
+ // First: sync from local db.
+ // TODO: how to get control name?
+ var allLocalDbIssues = await GetIssueByControlNameFromLocalDb(ControlInformation.ControlName);
+
+ // If localdb version is not null & not outdated => use local version.
+ if (allLocalDbIssues != null && allLocalDbIssues.Any() && !allLocalDbIssues.Any(x => (now - x.LastUpdated).TotalHours > 1))
+ {
+ if (ControlIssues is null || forced)
+ {
+ ControlIssues = new(allLocalDbIssues.Select(x => new ControlIssueModel()
+ {
+ IssueId = x.IssueId,
+ Title = x.Title,
+ IssueLinkUrl = x.IssueLinkUrl,
+ MileStone = x.MileStone,
+ OwnerName = x.OwnerName,
+ AvatarUrl = x.UserAvatarUrl,
+ CreatedDate = x.CreatedDate,
+ LastUpdated = x.LastUpdated
+ }));
+ }
+ IsBusy = false;
+
+ // Done.
+ return;
+ }
+
+ // If localdb does not have issue info, or info outdated => sync from GitHub & save.
var result = await gitHubService.GetGitHubIssuesByLabels(ControlInformation.GitHubAuthorIssueName,
ControlInformation.GitHubRepositoryIssueName,
ControlInformation.GitHubIssueLabels);
- IsBusy = false;
if (result.IsT0) // Check if result is ServiceSuccess
{
- var items = result.AsT0.AttachedData as IEnumerable;
+ var issues = result.AsT0.AttachedData as IEnumerable;
+
+ // Save to localdb.
+ foreach (var issue in issues)
+ {
+ await UpdateLocalIssue(issue);
+ }
+
+ IsBusy = false;
if (ControlIssues is null || forced)
{
- ControlIssues = new(items.Select(x => new ControlIssueModel()
+ ControlIssues = new(issues.Select(x => new ControlIssueModel()
{
IssueId = x.Id,
Title = x.Title,
+
IssueLinkUrl = x.HtmlUrl,
MileStone = x.Milestone is null ? "No mile stone" : x.Milestone.Title,
OwnerName = x.User.Login,
@@ -144,6 +186,8 @@ async Task RefreshControlIssues(bool forced)
}
else
{
+ IsBusy = false;
+
var error = result.AsT1;
EmptyViewText = error.ErrorDetail;
await AppNavigator.ShowSnackbarAsync(error.ErrorDetail,
@@ -155,4 +199,59 @@ await AppNavigator.ShowSnackbarAsync(error.ErrorDetail,
}
}
#endregion
+
+ #region [ Methods - GitHub Issues - LocalDb ]
+ private async Task> GetIssueByControlNameFromLocalDb(string controlName)
+ {
+ try
+ {
+ var now = DateTime.UtcNow;
+
+ return await gitHubIssueLocalDbService.GetByControlNameAsync(controlName);
+ }
+ catch (Exception)
+ {
+ // Treat as nothing found.
+ return default;
+ }
+ }
+
+ private async Task UpdateLocalIssue(GitHubIssueModel issue)
+ {
+ try
+ {
+ var now = DateTime.UtcNow;
+
+ var localIssue = await gitHubIssueLocalDbService.GetByIssueUrlAsync(issue.Url);
+
+ if (localIssue is null)
+ {
+ await gitHubIssueLocalDbService.AddAsync(new()
+ {
+ IssueId = issue.Id,
+ Title = issue.Title,
+ IssueLinkUrl = issue.Url,
+ ControlName = ControlInformation.ControlName,
+ MileStone = issue.Milestone?.Title,
+ OwnerName = issue.User?.Login,
+ UserAvatarUrl = issue.User?.AvatarUrl,
+ CreatedDate = issue.CreatedAt.DateTime,
+ LastUpdated = now
+ });
+ return;
+ }
+
+ // Update fields: milestone (TODO: what else?).
+ localIssue.MileStone = issue.Milestone?.Title;
+ localIssue.LastUpdated = now;
+
+ await gitHubIssueLocalDbService.UpdateAsync(localIssue);
+ }
+ catch (Exception)
+ {
+ // TODO: should do something.
+ return;
+ }
+ }
+ #endregion
}
diff --git a/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPage.xaml b/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPage.xaml
index 4a45d0f7..65138a97 100644
--- a/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPage.xaml
+++ b/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPage.xaml
@@ -9,6 +9,7 @@
Padding="10"
x:DataType="app:ImageButtonPageViewModel"
BackgroundColor="Transparent">
+
+
+ https://github.com/dotnet/maui/issues/new/choose
+
+
Button defines the following properties:
@@ -200,7 +205,7 @@
-
+
diff --git a/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPageViewModel.cs b/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPageViewModel.cs
index c2852d45..e7b9adc6 100644
--- a/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPageViewModel.cs
+++ b/src/Presentations/Windows/Features/Gallery/Pages/BuiltIn/Controls/ImageButton/ImageButtonPageViewModel.cs
@@ -24,7 +24,7 @@ public ImageButtonPageViewModel(IAppNavigator appNavigator,
#region [ Properties ]
[ObservableProperty]
- string emptyViewText = "No issues found for this control";
+ string emptyViewText = "Fetching issues";
[ObservableProperty]
string gitHubAPIRateLimit = "https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28";
diff --git a/src/Presentations/Windows/Features/Home/Pages/HomePageViewModel.cs b/src/Presentations/Windows/Features/Home/Pages/HomePageViewModel.cs
index 24abfc35..465ab004 100644
--- a/src/Presentations/Windows/Features/Home/Pages/HomePageViewModel.cs
+++ b/src/Presentations/Windows/Features/Home/Pages/HomePageViewModel.cs
@@ -1,12 +1,14 @@
namespace MAUIsland;
public partial class HomePageViewModel : NavigationAwareBaseViewModel
{
- #region [Services]
+ #region [ Fields ]
+
private readonly IHomeService homeService;
private readonly IConversationService conversationService;
#endregion
- #region [CTor]
+ #region [ CTor ]
+
public HomePageViewModel(
IAppNavigator appNavigator,
IHomeService homeService,
@@ -18,7 +20,7 @@ IConversationService conversationService
}
#endregion
- #region [Properties]
+ #region [ Properties ]
[ObservableProperty]
string projectRepo = "https://github.com/Strypper/mauisland";
@@ -36,7 +38,7 @@ IConversationService conversationService
bool isBusy;
#endregion
- #region [Methods]
+ #region [ Methods ]
protected override void OnInit(IDictionary query)
{
@@ -82,7 +84,7 @@ private async Task LoadDataAsync(bool forced)
}
#endregion
- #region [RelayCommands]
+ #region [ RelayCommands ]
[RelayCommand]
Task OpenFactUrlAsync(MAUIFact fact) => AppNavigator.OpenUrlAsync(fact.FactUrl);
diff --git a/src/Presentations/Windows/MauiProgram.cs b/src/Presentations/Windows/MauiProgram.cs
index 292fb198..dd4c76ac 100644
--- a/src/Presentations/Windows/MauiProgram.cs
+++ b/src/Presentations/Windows/MauiProgram.cs
@@ -2,7 +2,6 @@
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Storage;
-using Material.Components.Maui.Extensions;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
@@ -31,7 +30,6 @@ public static MauiApp CreateMauiApp()
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("FluentSystemIcons-Regular.ttf", FontNames.FluentSystemIconsRegular);
})
- .UseMaterialComponents()
.ConfigureEssentials(essentials =>
{
essentials.UseVersionTracking();