You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think its important to recognize those that contribute to OpenSource projects like MermaidPad. So, I'd like to use the GitHub API to populate a section in the About Dialog with a list of Contributors. I see 2 possible designs.
Note
If anyone wants to pick this up, please provide your thoughts on the designs before beginning.
Possible Designs
Design A - static .json file
This design would create a contributors.json file created during Build/Release Workflow. This design allows for listing the contributor info if the user is offline.
Create a GitHub Action that creates a contributors.json file during the .github/workflows/build-and-release.yml Workflow
File would be an Embedded Resource and be copied into the Assets folder.
Modify MermaidPad.Build.targets to include hash calculation for contributors.json. There is already logic for doing this so just follow the existing pattern.
4a. (Preferred 🚀) The contributors.json file would be lazy-loaded at runtime by the AboutDialogViewModel. Before loading the file, it would need to be verified by the MermaidPad.Services.Platforms.AssetIntegrityService by comparing its pre-calculated SHA listed in MermaidPad.Generated.AssetHashes. If the user is ofline, we can come up with a pre-defined static list of all contributors that have worked on MermaidPad.
OR
4b. The file would be added to the list of assets loaded by the MermaidPad.Services.Platforms.AssetService. The flow would be very similar to what is being done for the .js files. This design isn't ideal since it would load the file at app startup and the About Dialog most likely won't ever be opened - so it's kinda wasteful.
Design B - real-time call to GitHub API
This design would make a realtime HTTP REST call to the GitHub API when the AboutDialog is loaded.
Extend the AboutDialogViewModel to include an injected HttpClient. I already setup DI for HttpClients in the Service Registration.
I don't think we need a GitHubApiService - unless the logic for the GitHub API call becomes a bit complicated or long.
Ensure that any updates made to the ViewModel use Dispatcher.UIThread to acess ViewModel properties
Contributor list should be ordered in decreasing order by the number of commits.
The list should be populated into a scrollable read-only ListBox. The number of contributors is (unfortunately) still quite low so I don't think we need to worry about paging yet- but if you want to add that, please feel free to do so!
At a minimum, the list should include their GitHub profile name/id.
Nice to haves include:
a. Make their name a clickable link to their GitHub profile page
b. Include their GitHub avatar
I think its important to recognize those that contribute to OpenSource projects like MermaidPad. So, I'd like to use the GitHub API to populate a section in the About Dialog with a list of Contributors. I see 2 possible designs.
Note
If anyone wants to pick this up, please provide your thoughts on the designs before beginning.
Possible Designs
Design A - static .json file
This design would create a
contributors.jsonfile created during Build/Release Workflow. This design allows for listing the contributor info if the user is offline.contributors.jsonfile during the.github/workflows/build-and-release.ymlWorkflowEmbedded Resourceand be copied into theAssetsfolder.MermaidPad.Build.targetsto include hash calculation forcontributors.json. There is already logic for doing this so just follow the existing pattern.4a. (Preferred 🚀) The
contributors.jsonfile would be lazy-loaded at runtime by theAboutDialogViewModel. Before loading the file, it would need to be verified by theMermaidPad.Services.Platforms.AssetIntegrityServiceby comparing its pre-calculated SHA listed inMermaidPad.Generated.AssetHashes. If the user is ofline, we can come up with a pre-defined static list of all contributors that have worked on MermaidPad.OR
4b. The file would be added to the list of assets loaded by the
MermaidPad.Services.Platforms.AssetService. The flow would be very similar to what is being done for the.jsfiles. This design isn't ideal since it would load the file at app startup and the About Dialog most likely won't ever be opened - so it's kinda wasteful.Design B - real-time call to GitHub API
This design would make a realtime HTTP REST call to the GitHub API when the
AboutDialogis loaded.AboutDialogViewModelto include an injectedHttpClient. I already setup DI for HttpClients in the Service Registration.GitHubApiService- unless the logic for the GitHub API call becomes a bit complicated or long.Requirements
asynccalls when possible.Dispatcher.UIThreadto acess ViewModel propertiesa. Make their name a clickable link to their GitHub profile page
b. Include their GitHub avatar