Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions DistFiles/localization/en/Bloom.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,28 @@
<source xml:lang="en">There was a problem while saving. Please return to the previous page and make sure it looks correct.</source>
<note>ID: Browser.ProblemSaving</note>
</trans-unit>
<trans-unit id="Collection.CollectionRequiresNewerVersion" translate="no">
<source xml:lang="en">The collection "{0}" requires Bloom {1} or greater. You are running Bloom {2}.</source>
<note>ID: Collection.CollectionRequiresNewerVersion</note>
<note>{0} is the name of the collection, {1} is the version it requires, {2} is the version of Bloom that is running.</note>
</trans-unit>
<trans-unit id="Collection.NewerVersionNeededHeader" sil:dynamic="true" translate="no">
<source xml:lang="en">This collection needs a newer version of Bloom.</source>
<note>ID: Collection.NewerVersionNeededHeader</note>
</trans-unit>
<trans-unit id="Collection.NothingNewerAvailable" translate="no">
<source xml:lang="en">This collection needs Bloom {0}, but you already have the newest Bloom available to you.</source>
<note>ID: Collection.NothingNewerAvailable</note>
<note>{0} is the version the collection requires.</note>
</trans-unit>
<trans-unit id="Collection.OpenDifferentCollection" translate="no">
<source xml:lang="en">Open a Different Collection</source>
<note>ID: Collection.OpenDifferentCollection</note>
</trans-unit>
<trans-unit id="Collection.UpgradeBloom" translate="no">
<source xml:lang="en">Upgrade Bloom</source>
<note>ID: Collection.UpgradeBloom</note>
</trans-unit>
<trans-unit id="CollectionSettingsDialog.AboutBloomSubscriptions">
<source xml:lang="en">About Bloom Subscriptions</source>
<note>ID: CollectionSettingsDialog.AboutBloomSubscriptions</note>
Expand Down
18 changes: 17 additions & 1 deletion src/BloomExe/ApplicationContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ public ApplicationContainer()
// containers, which is what we want for all the application singletons.
.SingleInstance()
.Where(t =>
new[] { typeof(CommonApi), typeof(NewCollectionWizardApi) }.Contains(t)
new[]
{
typeof(CommonApi),
typeof(NewCollectionWizardApi),
typeof(ProgressDialogApi),
}.Contains(t)
);

_container = builder.Build();
Expand All @@ -87,6 +92,17 @@ public ApplicationContainer()
var server = _container.Resolve<BloomServer>();
_container.Resolve<CommonApi>().RegisterWithApiHandler(server.ApiHandler);
_container.Resolve<NewCollectionWizardApi>().RegisterWithApiHandler(server.ApiHandler);
// A progress dialog has to be possible before any collection is open: the "this
// collection needs a newer Bloom" dialog upgrades Bloom right there, and the dialog it
// shows while doing so talks over these endpoints. This belongs here rather than in
// ProjectContext (where it used to be) because all of ProgressDialogApi's handlers are
// static and know nothing about a project -- and because it can only be registered
// ONCE: RegisterEndpointHandler does a Dictionary.Add, which throws on a duplicate
// key, and application-level registrations are deliberately not cleared between
// collections, so a second registration would never go away.
_container
.Resolve<ProgressDialogApi>()
.RegisterWithApiHandler(server.ApiHandler);
server.ApiHandler.RecordApplicationLevelHandlers();
}

Expand Down
467 changes: 304 additions & 163 deletions src/BloomExe/ApplicationUpdateSupport.cs
Comment thread
andrew-polk marked this conversation as resolved.
Comment thread
andrew-polk marked this conversation as resolved.

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/BloomExe/Collection/CollectionSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ public class CollectionSettings
// if this is null, relevant code uses the default, so we don't have to initialize it here
public string BadgeQrCodeLabel;

/// <summary>
/// The oldest version of Bloom that is allowed to open this collection, e.g. "6.5".
/// Empty means any version may open it. At this point there is no UI for setting this;
/// it has to be added by editing the .bloomCollection file by hand. See BL-16690.
/// The gate that actually enforces it is MinimumBloomVersionCheck.
/// </summary>
public string MinimumBloomVersion = "";

/// <summary>
/// The name of the element in the .bloomCollection file that holds MinimumBloomVersion.
/// MinimumBloomVersionCheck reads it without loading the whole CollectionSettings.
/// </summary>
public const string kMinimumBloomVersionElementName = "MinimumBloomVersion";

public static readonly Dictionary<string, string> CssNumberStylesToCultureOrDigits =
new Dictionary<string, string>()
{
Expand Down Expand Up @@ -419,6 +433,10 @@ public void Save()
xml.Add(BulkPublishBloomPubSettings.ToXElement());
xml.Add(new XElement("ShowBlorgLanguageQrCode", ShowBlorgLanguageQrCode));
xml.Add(new XElement("BadgeQrCodeLabel", BadgeQrCodeLabel));
// Only write this if it is actually in use. Save() builds the file from scratch, so if we
// didn't write it back, the first save after someone hand-added it would silently lose it.
if (!string.IsNullOrWhiteSpace(MinimumBloomVersion))
xml.Add(new XElement(kMinimumBloomVersionElementName, MinimumBloomVersion));
RobustIO.SaveXElement(xml, SettingsFilePath);

// Color palette settings are stored in a separate Json file
Expand Down Expand Up @@ -705,6 +723,7 @@ public void Load()

ShowBlorgLanguageQrCode = ReadBoolean(xml, "ShowBlorgLanguageQrCode", true);
BadgeQrCodeLabel = ReadString(xml, "BadgeQrCodeLabel", "");
MinimumBloomVersion = ReadString(xml, kMinimumBloomVersionElementName, "");

LoadDictionary(xml, "Palette", ColorPalettes);
}
Expand Down
Loading