Class AchievementPushTextBaseline
Builds the record a push saves for an achievement that already exists on the platform: the platform's own texts as the baseline, with the authored text laid over it only for the locales in scope.
Inherited Members
Namespace: Serenity.Achievements.Application.Sync
Assembly: Serenity.Achievements.Application.dll
Syntax
public static class AchievementPushTextBaseline
Remarks
A storefront save may replace an achievement's whole language map rather than merge into it, so a save that names only the locales an author picked could drop every other language the platform holds. The record this produces always carries the platform's complete current texts, and the authored text replaces them only where a locale is in scope. A locale the author rejected during review is then reverted to the platform's value by AchievementPushPlanExecutor, and a locale outside the scope is never touched because the baseline already holds what the platform has. The platform's extras ride along unchanged — they carry the identity ids and any text the platform keeps in a language this project has no locale for.
Methods
MergeWithSnapshot(IReadOnlyList<AchievementSyncRecord>, AchievementStorefrontSnapshot, IReadOnlyList<string>)
Returns authored with every record whose api name matches exactly one record of
snapshot laid over that record's texts (see OverPlatformTexts(AchievementSyncRecord, AchievementSyncRecord, IReadOnlyList<string>)). A
record with no such match passes through unchanged and keeps every authored locale: a new
achievement has no platform text to preserve. With no snapshot nothing can be preserved either, and
the authored records are returned as they are.
Declaration
public static IReadOnlyList<AchievementSyncRecord> MergeWithSnapshot(IReadOnlyList<AchievementSyncRecord> authored, AchievementStorefrontSnapshot snapshot, IReadOnlyList<string> scopedLocaleCodes)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementSyncRecord> | authored | The authored records, which may carry more locales than the push covers. |
| AchievementStorefrontSnapshot | snapshot | What the platform held when it was last pulled. May be null. |
| IReadOnlyList<string> | scopedLocaleCodes | The locales whose authored text may replace the platform's. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<AchievementSyncRecord> |
OverPlatformTexts(AchievementSyncRecord, AchievementSyncRecord, IReadOnlyList<string>)
Returns authored with the platform's texts underneath and its extras.
Declaration
public static AchievementSyncRecord OverPlatformTexts(AchievementSyncRecord authored, AchievementSyncRecord platform, IReadOnlyList<string> scopedLocaleCodes)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementSyncRecord | authored | The authored record, which may carry more locales than the push covers. |
| AchievementSyncRecord | platform | The same achievement as the platform currently holds it. |
| IReadOnlyList<string> | scopedLocaleCodes | The locales whose authored text may replace the platform's. |
Returns
| Type | Description |
|---|---|
| AchievementSyncRecord |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | When the authored record, the platform record or the scope is missing. |