-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🆕 feat(UrlScheme): add Url Scheme Page
- Loading branch information
Showing
8 changed files
with
184 additions
and
2 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,9 @@ | ||
namespace SwashbucklerDiary.Rcl.Models | ||
{ | ||
public class UrlScheme | ||
{ | ||
public string Name { get; set; } = string.Empty; | ||
|
||
public string Path { get; set; } = string.Empty; | ||
} | ||
} |
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
50 changes: 50 additions & 0 deletions
50
src/SwashbucklerDiary.Rcl/Pages/Mine/About/UrlSchemePage.razor
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,50 @@ | ||
@page "/urlScheme" | ||
@namespace SwashbucklerDiary.Rcl.Pages | ||
@inherits ImportantComponentBase | ||
|
||
<MyAppBar Title="UrlScheme" | ||
OnClick="NavigateToBack"> | ||
</MyAppBar> | ||
|
||
<ScrollContainer> | ||
<MChipGroup @bind-Value="scheme" | ||
Class="mb-2" | ||
Mandatory> | ||
@foreach (var item in schemes) | ||
{ | ||
<MChip Value="item" | ||
Filter | ||
Outlined> | ||
@item | ||
</MChip> | ||
} | ||
</MChipGroup> | ||
|
||
<MCard Class="my-list-card" | ||
Elevation="0" | ||
Rounded="@("lg")"> | ||
<MList Class="dynamic-list-item-collection"> | ||
@foreach (var item in urlSchemes) | ||
{ | ||
<MListItem @key="item" | ||
OnClick="()=>CopyAsync(item.Path)"> | ||
<MListItemContent> | ||
<MListItemTitle> | ||
@(I18n.T(item.Name)) | ||
</MListItemTitle> | ||
<MListItemSubtitle> | ||
@($"{scheme}://{item.Path}") | ||
</MListItemSubtitle> | ||
</MListItemContent> | ||
<MListItemAction> | ||
<MIcon>mdi-content-copy</MIcon> | ||
</MListItemAction> | ||
</MListItem> | ||
|
||
<MDivider Class="mx-5"></MDivider> | ||
} | ||
|
||
</MList> | ||
</MCard> | ||
</ScrollContainer> | ||
|
34 changes: 34 additions & 0 deletions
34
src/SwashbucklerDiary.Rcl/Pages/Mine/About/UrlSchemePage.razor.cs
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,34 @@ | ||
using Masa.Blazor; | ||
using SwashbucklerDiary.Rcl.Components; | ||
using SwashbucklerDiary.Rcl.Models; | ||
|
||
namespace SwashbucklerDiary.Rcl.Pages | ||
{ | ||
public partial class UrlSchemePage : ImportantComponentBase | ||
{ | ||
private StringNumber? scheme; | ||
|
||
private readonly string[] schemes = ["swashbucklerdiary", "xiakeriji"]; | ||
|
||
private List<UrlScheme> urlSchemes = []; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
await base.OnInitializedAsync(); | ||
|
||
await ReadJson(); | ||
} | ||
|
||
private async Task ReadJson() | ||
{ | ||
urlSchemes = await StaticWebAssets.ReadJsonAsync<List<UrlScheme>>("json/url-scheme/url-scheme.json"); | ||
} | ||
|
||
private async Task CopyAsync(string path) | ||
{ | ||
var text = $"{scheme}://{path}"; | ||
await PlatformIntegration.SetClipboard(text); | ||
await PopupServiceHelper.Success(I18n.T("Share.CopySuccess")); | ||
} | ||
} | ||
} |
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
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
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
46 changes: 46 additions & 0 deletions
46
src/SwashbucklerDiary.Rcl/wwwroot/json/url-scheme/url-scheme.json
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,46 @@ | ||
[ | ||
{ | ||
"Name": "UrlScheme.Index", | ||
"Path": "" | ||
}, | ||
{ | ||
"Name": "UrlScheme.History", | ||
"Path": "history" | ||
}, | ||
{ | ||
"Name": "UrlScheme.FileBrowse", | ||
"Path": "fileBrowse" | ||
}, | ||
{ | ||
"Name": "UrlScheme.Mine", | ||
"Path": "mine" | ||
}, | ||
{ | ||
"Name": "UrlScheme.Search", | ||
"Path": "search?query=" | ||
}, | ||
{ | ||
"Name": "UrlScheme.SearchFunction", | ||
"Path": "searchAppFunction?query=" | ||
}, | ||
{ | ||
"Name": "UrlScheme.Write", | ||
"Path": "write" | ||
}, | ||
{ | ||
"Name": "UrlScheme.Setting", | ||
"Path": "setting" | ||
}, | ||
{ | ||
"Name": "UrlScheme.Backup", | ||
"Path": "backups" | ||
}, | ||
{ | ||
"Name": "UrlScheme.Export", | ||
"Path": "export" | ||
}, | ||
{ | ||
"Name": "UrlScheme.About", | ||
"Path": "about" | ||
} | ||
] |