Test assignment: a .NET MAUI Mobile app with functionality of previewing a link in a pretty and informative way.
LinkPreviewApp is a .NET MAUI application built for mobile devices. Composes simple previews for provided URLs (links to websites), supports opening the links in a default device's browser.
Supports 2 modes: a simple "standalone" application with a link preview composition logic included in the app, and a "backend-integrated" application working with a LinkPreviewApp.ApiService - a Backend .NET Web API. The second option requires hosting the Backend service somewhere, otherwise available only for a local development.
The reason for this architecture decision is: LinkPreviewApp.ApiService communicates with an external Link Preview service to get the link previews. It uses an API Key which is a developer's secret. LinkPreviewApp is a client-side application, in which it is strictly recommended to not put any sensitive developer's secrets. See https://blog.gitguardian.com/how-to-handle-mobile-app-secrets/ for a more detailed information.
- Build the application as you would normally.
- Use an IDE with emulator or publish the application and install on a real device.
Register on https://www.linkpreview.net/, obtain an API Key and provide it in the project LinkPreviewApp.ApiService in appsettings.json / appsettings.Development.json in:
"LinkPreviewService": {
"BaseUri": "https://api.linkpreview.net",
"ApiKey": "YourApiKey"
}
- Build and publish the Backend service ('LinkPreviewApp.ApiService' project). One of the possible options is to publish it as Azure App Service appication. (requires hosting the application somewhere).
- Update BackendLinkPreviewService.BaseUri in the appsettings.json of LinkPreviewApp project to use your Backend service URL.
- Build and publish the MAUI application LinkPreviewApp with a flag '/p:UseBackendService=true' (requires signing the application).
- Install the application on the device.
- Run the LinkPreviewApp.ApiService
- Update the links in the LinkPreviewApp project appsettings.Development.json to use the correct port.
- Run the LinkPreviewApp on some emulator or as a Windows Machine app (the app layout is not adjusted to different devices yet).