From 2bff7c9ecdd77bc112d66843322f112ee7aa6820 Mon Sep 17 00:00:00 2001 From: Wojciech Klusek Date: Thu, 19 Oct 2023 11:41:40 +0200 Subject: [PATCH] Add force update section --- .../messaging_masstransit/handling_events.md | 2 +- docs/features/force_update/index.md | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/external_integrations/messaging_masstransit/handling_events.md b/docs/external_integrations/messaging_masstransit/handling_events.md index d1e261cea..bf2545a12 100644 --- a/docs/external_integrations/messaging_masstransit/handling_events.md +++ b/docs/external_integrations/messaging_masstransit/handling_events.md @@ -1,6 +1,6 @@ # Handling events -Once an event is raised, it can be handled by a corresponding `IConsumer` to perform the desired action. The default consumer configuration can be customized by overriding the `ConfigureConsumer` method from the `ConsumerDefinition` interface. In the following example, an email is sent to the employee who has been assigned to a assignment: +Once an event is raised, it can be handled by a corresponding `IConsumer` to perform the desired action. The default consumer configuration can be customized by overriding the `ConfigureConsumer` method from the `ConsumerDefinition` interface. In the following example, an email is sent to the employee who has been assigned to an assignment: ```csharp public class SendEmailToEmployeeOnEmployeeAssignedToAssignment diff --git a/docs/features/force_update/index.md b/docs/features/force_update/index.md index e69de29bb..6adfd3d5f 100644 --- a/docs/features/force_update/index.md +++ b/docs/features/force_update/index.md @@ -0,0 +1,32 @@ +# Force update + +CoreLibrary provides an opinionated library for adding force update support to mobile apps. It connects to the broaded CoreLibrary ecosystem and has a ready-made [Flutter implementation](https://github.com/leancodepl/flutter_corelibrary/tree/master/packages/force_update). + +## Configuration + +To enforce or suggest updates for client apps, you can utilize the `AddForceUpdate(...)` extension method from the `LeanCode.ForceUpdate` package in the `Startup.cs` file. This method is available on the `IServiceCollection` and needs to be called after `AddCQRS(...)`. The following example demonstrates the usage: + +```csharp +public override void ConfigureServices(IServiceCollection services) +{ + // ... + services.AddCQRS(CQRSTypes, CQRSTypes) + .AddForceUpdate( + new AndroidVersionsConfiguration( + new Version(AndroidMinimumRequiredVersion), + new Version(AndroidCurrentlySupportedVersion)), + new IOSVersionsConfiguration( + new Version(IOSMinimumRequiredVersion), + new Version(IOSCurrentlySupportedVersion))); + // ... +} +``` + +## Version support + +After configuation above. [VersionSupport] query is created and available at `/cqrs/query/LeanCode.ForceUpdate.Contracts.VersionSupport`. The query takes `Platform` (either IOS or Android) and the `Version` of the client app as parameters. It returns whether the client's version is supported, currently supported version and minimum required version for specified provider. + +By default, if the client's version is below the minimum required version, the response will indicate that an update is needed. If the client's version is between minimum required and currently supported version, the response will suggest an update. If the app version is greater or equal to the currently supported version, the response will indicate that the app is up to date. It's also possible to change this behavior by creating custom version handler and overriding `CheckVersionAsync` method from the [VersionHandler] class, responsible for version checking (for example when we want to force only specific group of users to update the app). + +[VersionSupport]: https://github.com/leancodepl/corelibrary/blob/v8.0-preview/src/Infrastructure/LeanCode.ForceUpdate.Contracts/VersionSupport.cs +[VersionHandler]: https://github.com/leancodepl/corelibrary/blob/v8.0-preview/src/Infrastructure/LeanCode.ForceUpdate/LeanCode.ForceUpdate.Services/VersionHandler.cs