Skip to content

Commit e3ab911

Browse files
committed
Prepping to release
1 parent cdc980f commit e3ab911

27 files changed

+366
-93
lines changed

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: [aritchie]
2+
# custom: https://www.buymeacoffee.com/QDF8SWy

.github/ISSUE_TEMPLATE/bug_report.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Bug Report
2+
description: You have found something wrong with Shiny Remote Configuration
3+
title: "[Bug]: "
4+
labels: [bug, unverified]
5+
body:
6+
- type: textarea
7+
validations:
8+
required: true
9+
attributes:
10+
label: Steps To Reproduce
11+
description: Steps to reproduce the behavior.
12+
placeholder: |
13+
1.
14+
2.
15+
3.
16+
- type: textarea
17+
attributes:
18+
label: Expected Behavior
19+
validations:
20+
required: true
21+
- type: textarea
22+
attributes:
23+
label: Actual Behavior
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: exception
28+
attributes:
29+
label: Exception or Log output
30+
description: Please copy and paste any relevant log output
31+
- type: textarea
32+
id: codesample
33+
attributes:
34+
label: Code Sample
35+
description: Please include a github repo with your reproducible sample
36+
- type: checkboxes
37+
id: terms
38+
attributes:
39+
label: Terms of Filing
40+
description: By submitting this issue, you agree to the following
41+
options:
42+
- label: I have supplied a reproducible sample
43+
required: true
44+
- label: I am a Sponsor OR I am using the LATEST stable or preview release
45+
required: true
46+
- label: I am Sponsor OR My GitHub account is 30+ days old
47+
required: true
48+
- label: I understand that if I am checking these boxes and I am not actually following what they are saying, I will be removed from this repository!
49+
required: true

.github/ISSUE_TEMPLATE/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Shiny Community Forums
4+
url: https://github.com/shinyorg/shiny/discussions
5+
about: Please ask and answer questions here.
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Feature Request
2+
description: You have an idea for an enhancement within Shiny Remote Configuration
3+
title: "[Feature Request]: "
4+
labels: [feature request, unverified]
5+
body:
6+
- type: textarea
7+
attributes:
8+
label: Summary
9+
description: Your summary of the feature
10+
validations:
11+
required: true
12+
- type: textarea
13+
attributes:
14+
label: API Changes
15+
validations:
16+
required: true
17+
- type: textarea
18+
attributes:
19+
label: Intended Use Case
20+
validations:
21+
required: true

.github/PULL_REQUEST_TEMPLATE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
### Description of Change ###
2+
3+
<!-- Describe your changes here. -->
4+
5+
### Issues Resolved ###
6+
<!-- Please use the format "fixes #xxxx" for each issue this PR addresses -->
7+
8+
- fixes #
9+
10+
### API Changes ###
11+
<!-- List all API changes here (or just put None) -->
12+
13+
None
14+
15+
### Behavioral Changes ###
16+
<!-- Describe any changes that may change how a user's app behaves or appears when upgrading to this version of the codebase. -->
17+
18+
None
19+
20+
### Testing Procedure ###
21+
<!-- Please list the steps that should be taken to properly test these changes on each relevant platform. If you were unable to test these changes yourself on any or all platforms, please let us know. Also, if you are able to attach a video of your test run, you will be our personal hero. -->
22+
23+
### PR Checklist ###
24+
25+
- [ ] Rebased on top of the target branch at time of PR
26+
- [ ] Changes adhere to coding standard
27+
- [ ] Sent to a v(branch) or DEV branch

.github/workflows/build.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
logLevel:
7+
description: 'Log level'
8+
required: true
9+
default: 'warning'
10+
push:
11+
branches:
12+
- main
13+
- dev
14+
- v*
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
runs-on: windows-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Setup .NET 8.0
31+
uses: actions/setup-dotnet@v3
32+
with:
33+
dotnet-version: '8.0.x'
34+
35+
- name: Build
36+
run: dotnet build Build.slnf /restore -m -property:Configuration=Release -property:PublicRelease=true
37+
38+
- name: Test
39+
run: dotnet test tests/Shiny.Mediator.Tests/Shiny.Mediator.Tests.csproj --no-restore --verbosity normal
40+
41+
- name: Post NuGet Artifacts
42+
uses: actions/upload-artifact@v2
43+
with:
44+
name: nuget-artifacts
45+
path: '**/*.nupkg'
46+
47+
- name: Publish Artifacts
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: nugets
51+
path: ${{ github.workspace }}/artifacts
52+
retention-days: 5
53+
54+
- name: Publish NuGets
55+
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v') }}
56+
run: dotnet nuget push **\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGETAPIKEY }} --skip-duplicate

Build.slnf

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"solution": {
3+
"path": "ShinyMediator.sln",
4+
"projects": [
5+
"src\\Shiny.Extensions.Configuration.Remote\\Shiny.Extensions.Configuration.Remote.csproj",
6+
"src\\Shiny.Extensions.Configuration.Remote.Maui\\Shiny.Extensions.Configuration.Remote.Maui.csproj"
7+
]
8+
}
9+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# remoteconfig
1+
# Remote Configuration Provider
22

remoteconfig.sln

+21-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,27 @@
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Extensions.Configuration.Remote", "src\Shiny.Extensions.Configuration.Remote\Shiny.Extensions.Configuration.Remote.csproj", "{51AE2B06-A8FB-4282-A2FB-37D256805A5F}"
44
EndProject
5-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Extensions.Configuration.RemoteHosting", "src\Shiny.Extensions.Configuration.RemoteHosting\Shiny.Extensions.Configuration.RemoteHosting.csproj", "{12F6F831-B685-46FF-B7C4-885B292C9C98}"
6-
EndProject
75
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.Api", "samples\Sample.Api\Sample.Api.csproj", "{ECD283B3-0C19-4F87-BFC6-2737187DBF4F}"
86
EndProject
97
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "samples\Sample\Sample.csproj", "{61FF0CA6-1E67-40C5-849A-1D76F085AD05}"
108
EndProject
9+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Extensions.Configuration.Remote.Maui", "src\Shiny.Extensions.Configuration.Remote.Maui\Shiny.Extensions.Configuration.Remote.Maui.csproj", "{258258A3-FB19-4ABF-ADA7-66972136AF7B}"
10+
EndProject
11+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{D90754E5-A1F0-494C-8511-51ED67ED62B1}"
12+
ProjectSection(SolutionItems) = preProject
13+
README.md = README.md
14+
src\Directory.build.props = src\Directory.build.props
15+
src\Directory.build.targets = src\Directory.build.targets
16+
src\nuget.png = src\nuget.png
17+
src\nuget.txt = src\nuget.txt
18+
version.json = version.json
19+
.github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md
20+
.github\ISSUE_TEMPLATE\bug_report.yml = .github\ISSUE_TEMPLATE\bug_report.yml
21+
.github\ISSUE_TEMPLATE\feature_request.yml = .github\ISSUE_TEMPLATE\feature_request.yml
22+
.github\workflows\build.yml = .github\workflows\build.yml
23+
Build.slnf = Build.slnf
24+
EndProjectSection
25+
EndProject
1126
Global
1227
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1328
Debug|Any CPU = Debug|Any CPU
@@ -18,10 +33,6 @@ Global
1833
{51AE2B06-A8FB-4282-A2FB-37D256805A5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
1934
{51AE2B06-A8FB-4282-A2FB-37D256805A5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
2035
{51AE2B06-A8FB-4282-A2FB-37D256805A5F}.Release|Any CPU.Build.0 = Release|Any CPU
21-
{12F6F831-B685-46FF-B7C4-885B292C9C98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22-
{12F6F831-B685-46FF-B7C4-885B292C9C98}.Debug|Any CPU.Build.0 = Debug|Any CPU
23-
{12F6F831-B685-46FF-B7C4-885B292C9C98}.Release|Any CPU.ActiveCfg = Release|Any CPU
24-
{12F6F831-B685-46FF-B7C4-885B292C9C98}.Release|Any CPU.Build.0 = Release|Any CPU
2536
{ECD283B3-0C19-4F87-BFC6-2737187DBF4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2637
{ECD283B3-0C19-4F87-BFC6-2737187DBF4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
2738
{ECD283B3-0C19-4F87-BFC6-2737187DBF4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -30,5 +41,9 @@ Global
3041
{61FF0CA6-1E67-40C5-849A-1D76F085AD05}.Debug|Any CPU.Build.0 = Debug|Any CPU
3142
{61FF0CA6-1E67-40C5-849A-1D76F085AD05}.Release|Any CPU.ActiveCfg = Release|Any CPU
3243
{61FF0CA6-1E67-40C5-849A-1D76F085AD05}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{258258A3-FB19-4ABF-ADA7-66972136AF7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45+
{258258A3-FB19-4ABF-ADA7-66972136AF7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{258258A3-FB19-4ABF-ADA7-66972136AF7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
47+
{258258A3-FB19-4ABF-ADA7-66972136AF7B}.Release|Any CPU.Build.0 = Release|Any CPU
3348
EndGlobalSection
3449
EndGlobal

samples/Sample.Api/Program.cs

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
using System.Security.Authentication;
2-
using Microsoft.AspNetCore.Mvc;
3-
41
var builder = WebApplication.CreateBuilder(args);
52
builder.Services.AddHttpContextAccessor();
63

74
var app = builder.Build();
85

96
app.MapGet(
107
"/configuration",
11-
async (
12-
[FromServices] IHttpContextAccessor http,
13-
[FromServices] IConfiguration cfg
14-
) =>
8+
async (CancellationToken ct) =>
159
{
16-
var accessKey = http.HttpContext!.Request.Headers["X-Key"];
17-
if (accessKey != cfg["AccessKey"])
18-
throw new InvalidCredentialException("You do not belong here");
19-
20-
await Task.Delay(5000);
10+
await Task.Delay(5000, ct);
2111
return new
2212
{
2313
ValueFrom = "Server",

samples/Sample.Api/Sample.Api.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

9-
<ItemGroup>
10-
<ProjectReference Include="..\..\src\Shiny.Extensions.Configuration.RemoteHosting\Shiny.Extensions.Configuration.RemoteHosting.csproj"/>
11-
</ItemGroup>
12-
139
</Project>

samples/Sample/MainViewModel.cs

+14-12
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ public partial class MainViewModel : ObservableObject
1010
{
1111
readonly IRemoteConfigurationProvider remoteProvider;
1212

13-
14-
//IRemoteConfigurationProvider remoteProvider
15-
public MainViewModel(IOptionsMonitor<MyConfig> cfg)
13+
public MainViewModel(
14+
IRemoteConfigurationProvider remoteProvider,
15+
IOptionsMonitor<MyConfig> cfg
16+
)
1617
{
18+
this.remoteProvider = remoteProvider;
1719
cfg.OnChange(this.Update);
1820
this.Update(cfg.CurrentValue);
1921
}
@@ -36,14 +38,14 @@ void Update(MyConfig config)
3638
[RelayCommand]
3739
async Task Refresh(CancellationToken cancellationToken)
3840
{
39-
// try
40-
// {
41-
// await this.remoteProvider.LoadAsync(cancellationToken);
42-
// }
43-
// catch (OperationCanceledException) {}
44-
// catch (Exception ex)
45-
// {
46-
// await App.Current.MainPage.DisplayAlert(ex.ToString(), "ERROR", "OK");
47-
// }
41+
try
42+
{
43+
await this.remoteProvider.LoadAsync(cancellationToken);
44+
}
45+
catch (OperationCanceledException) {}
46+
catch (Exception ex)
47+
{
48+
await App.Current.MainPage.DisplayAlert(ex.ToString(), "ERROR", "OK");
49+
}
4850
}
4951
}

samples/Sample/MauiProgram.cs

+11-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
using Shiny.Extensions.Configuration.Remote;
1+
using Shiny.Extensions.Configuration.Remote.Maui;
22

33
namespace Sample;
44

5+
56
public static class MauiProgram
67
{
78
public static MauiApp CreateMauiApp()
@@ -10,27 +11,16 @@ public static MauiApp CreateMauiApp()
1011
.CreateBuilder()
1112
.UseMauiApp<App>();
1213

13-
builder
14-
.Configuration
15-
// we load the default/builtin accesstoken here
16-
.AddJsonPlatformBundle()
17-
18-
// if remote has requested past values, those will be available here through configuration
19-
// so you could basically change the URI & AccessKey below
20-
.AddRemote(
21-
Path.Combine(FileSystem.AppDataDirectory, "remotesettings.json"),
22-
cfg => (
23-
cfg["ConfigurationUri"]!,
24-
cfg["AccessToken"]!
25-
),
26-
false
27-
);
14+
// we load the default/builtin accesstoken here
15+
builder.Configuration.AddJsonPlatformBundle();
16+
17+
// if remote has requested past values, those will be available here through configuration
18+
// so you could basically change the URI & AccessKey below
19+
// calling this method adds IRemoteConfigurationProvider to DI which allows you to await the configuration in a startup page if needed
20+
builder.AddRemoteMaui();
2821

29-
builder.Services.Configure<MyConfig>(x =>
30-
{
31-
32-
builder.Configuration.Bind(x);
33-
});
22+
// The extension method `BindConfiguration` is part of Microsoft.Extensions.Options.ConfigurationExtensions - don't hate the messenger
23+
builder.Services.AddOptions<MyConfig>().BindConfiguration("");
3424
#if DEBUG
3525
builder.Logging.SetMinimumLevel(LogLevel.Trace);
3626
builder.Logging.AddDebug();

samples/Sample/Sample.csproj

+2-8
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,12 @@
1818

1919
<MauiVersion>8.0.61</MauiVersion>
2020
<ShinyVersion>3.3.3</ShinyVersion>
21-
<!--slower build, faster runtime in DEBUG-->
22-
<!-- <_MauiForceXamlCForDebug Condition="'$(Configuration)' == 'Debug'">true</_MauiForceXamlCForDebug> -->
2321
</PropertyGroup>
2422

2523
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
2624
<DefineConstants>$(DefineConstants);PLATFORM</DefineConstants>
2725
<SupportedOSPlatformVersion>26.0</SupportedOSPlatformVersion>
2826
<TargetPlatformVersion>34</TargetPlatformVersion>
29-
<!--
30-
<EmbedAssembliesIntoApk Condition="'$(Configuration)' == 'Debug'">true</EmbedAssembliesIntoApk>
31-
<AndroidPackageFormats Condition="'$(Configuration)' == 'Release'">aab</AndroidPackageFormats>
32-
<AndroidLinkTool>r8</AndroidLinkTool>
33-
<AndroidLinkTool>proguard</AndroidLinkTool>
34-
-->
3527
</PropertyGroup>
3628

3729
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
@@ -64,12 +56,14 @@
6456

6557
<ItemGroup>
6658
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
59+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
6760
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)"/>
6861
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" Condition="'$(Configuration)' == 'Debug'"/>
6962
<PackageReference Include="Shiny.Extensions.Configuration" Version="$(ShinyVersion)"/>
7063
</ItemGroup>
7164

7265
<ItemGroup>
66+
<ProjectReference Include="..\..\src\Shiny.Extensions.Configuration.Remote.Maui\Shiny.Extensions.Configuration.Remote.Maui.csproj" />
7367
<ProjectReference Include="..\..\src\Shiny.Extensions.Configuration.Remote\Shiny.Extensions.Configuration.Remote.csproj" />
7468
</ItemGroup>
7569

0 commit comments

Comments
 (0)