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
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ private UpdateChecker CreateUpdateChecker(FwLiteConfig? config = null)

[Theory]
[InlineData(FwLitePlatform.iOS)]
[InlineData(FwLitePlatform.Mac)]
[InlineData(FwLitePlatform.Android)]
public void ShouldCheckReleaseFeed_WhenStoreDistributedPlatform_ReturnsFalse(FwLitePlatform os)
{
//iOS/Mac have no GitHub release feed and Android is Play-driven; the feed round-trip is pointless.
//iOS has no GitHub release feed and Android is Play-driven; the feed round-trip is pointless.
//Preferences are empty (never checked), so the throttle would otherwise allow the check - this
//proves the platform skip wins for the default OnInterval condition.
var config = new FwLiteConfig { UpdateCheckCondition = UpdateCheckCondition.OnInterval, Os = os };
Expand All @@ -57,7 +56,6 @@ public void ShouldCheckReleaseFeed_WhenStoreDistributedPlatform_ReturnsFalse(FwL

[Theory]
[InlineData(FwLitePlatform.iOS)]
[InlineData(FwLitePlatform.Mac)]
[InlineData(FwLitePlatform.Android)]
public void ShouldCheckReleaseFeed_WhenAlwaysConfigured_OverridesStoreDistributedSkip(FwLitePlatform os)
{
Expand All @@ -68,11 +66,14 @@ public void ShouldCheckReleaseFeed_WhenAlwaysConfigured_OverridesStoreDistribute
checker.ShouldCheckReleaseFeed().Should().BeTrue();
}

[Fact]
public void ShouldCheckReleaseFeed_WhenNonStorePlatform_DelegatesToThrottle()
[Theory]
[InlineData(FwLitePlatform.Windows)]
[InlineData(FwLitePlatform.Linux)]
[InlineData(FwLitePlatform.Mac)]
public void ShouldCheckReleaseFeed_WhenNonStorePlatform_DelegatesToThrottle(FwLitePlatform os)
{
//Windows uses the feed; with an empty last-check the throttle allows the check.
var config = new FwLiteConfig { UpdateCheckCondition = UpdateCheckCondition.OnInterval, Os = FwLitePlatform.Windows };
//These use the feed; with an empty last-check the throttle allows the check.
var config = new FwLiteConfig { UpdateCheckCondition = UpdateCheckCondition.OnInterval, Os = os };
var checker = CreateUpdateChecker(config);

checker.ShouldCheckReleaseFeed().Should().BeTrue();
Expand Down
9 changes: 5 additions & 4 deletions backend/FwLite/FwLiteShared/AppUpdate/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ private void NotifyResult(UpdateResult result, FwLiteRelease release)
/// <summary>
/// Whether to check the GitHub release feed now: the shared interval gate
/// (<see cref="UpdateCheckThrottle.ShouldCheckForUpdate"/>) plus a skip for store-distributed
/// platforms. iOS/Mac have no release feed at all, and Android is driven by Google Play's in-app
/// updates (AndroidInAppUpdateService) instead of this check. The explicit <c>Always</c> condition
/// still forces a feed check for on-device endpoint testing.
/// platforms. iOS has no release feed at all, and Android is driven by Google Play's in-app
/// updates (AndroidInAppUpdateService) instead of this check. Mac uses the feed like Linux: it can't
/// install the update itself, so the user gets a Download prompt for the DMG. The explicit
/// <c>Always</c> condition still forces a feed check for on-device endpoint testing.
/// </summary>
internal bool ShouldCheckReleaseFeed()
{
if (config.Value.UpdateCheckCondition != UpdateCheckCondition.Always &&
config.Value.Os is FwLitePlatform.iOS or FwLitePlatform.Mac or FwLitePlatform.Android)
config.Value.Os is FwLitePlatform.iOS or FwLitePlatform.Android)
{
logger.LogInformation("Update check skipped: {Os} updates are store/Play-driven, not via the release feed",
config.Value.Os);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async ValueTask InvalidateReleaseCache()
var editionConfig = config.Value.Editions.GetValueOrDefault(edition);
if (editionConfig is null)
{
//Editions with no release-asset config (e.g. store-distributed iOS/Mac) have no GitHub
//Editions with no release-asset config (e.g. store-distributed iOS) have no GitHub
//feed to check. Return null ("no update") rather than throwing, which the endpoint would
//otherwise surface as a 500 on every client launch.
return null;
Expand Down
4 changes: 4 additions & 0 deletions backend/LexBoxApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
},
"Android": {
"FileNameRegex": "(?i)\\.apk$"
},
"Mac": {
// the notarized Mac Catalyst build, FieldWorksLite.dmg
"FileNameRegex": "(?i)\\.dmg$"
}
}
},
Expand Down
5 changes: 3 additions & 2 deletions backend/Testing/LexCore/Services/FwLiteReleaseServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public FwLiteReleaseServiceTests()
{
config.Editions.Add(FwLiteEdition.Windows, new FwLiteEditionConfig() { FileNameRegex = "(?i)\\.msixbundle$" });
config.Editions.Add(FwLiteEdition.Linux, new FwLiteEditionConfig() { FileNameRegex = "(?i)linux\\.zip$" });
config.Editions.Add(FwLiteEdition.Mac, new FwLiteEditionConfig() { FileNameRegex = "(?i)\\.dmg$" });
})
.Services
.AddHybridCache()
Expand All @@ -44,6 +45,7 @@ public FwLiteReleaseServiceTests()
[Theory]
[InlineData(FwLiteEdition.Windows)]
[InlineData(FwLiteEdition.Linux)]
[InlineData(FwLiteEdition.Mac)]
public async Task CanGetLatestRelease(FwLiteEdition edition)
{
var latestRelease = await _fwLiteReleaseService.GetLatestRelease(edition);
Expand All @@ -54,11 +56,10 @@ public async Task CanGetLatestRelease(FwLiteEdition edition)

[Theory]
[InlineData(FwLiteEdition.iOS)]
[InlineData(FwLiteEdition.Mac)]
[InlineData(FwLiteEdition.Android)]
public async Task UnconfiguredEditionReturnsNullInsteadOfThrowing(FwLiteEdition edition)
{
//Editions with no release-asset config (only Windows + Linux are configured in this fixture)
//Editions with no release-asset config (only Windows, Linux and Mac are configured in this fixture)
//must not throw: the should-update endpoint would otherwise 500 on every such client launch.
var latestRelease = await _fwLiteReleaseService.GetLatestRelease(edition);
latestRelease.Should().BeNull();
Expand Down
9 changes: 6 additions & 3 deletions docs/site/fw-lite/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ Windows and Linux computers, and Android phones and tablets (from Google Play).
same app on every device. There is no iPhone or iPad version yet.

:::warning[Mac: early testers only]
A Mac version is available for people who want to try it early. It doesn't update itself
yet, and it is less tested than the other versions. To try it, download
`FieldWorksLite.dmg` from the **Assets** of the
A Mac version is available for people who want to try it early. It is less tested than the
other versions. To try it, download `FieldWorksLite.dmg` from the **Assets** of the
[latest FieldWorks Lite release on GitHub](https://github.com/sillsdev/languageforge-lexbox/releases/latest).

It doesn't install updates by itself. When a new version is out, it tells you and offers a
**Download** button. Open the downloaded file and drag FieldWorks Lite into Applications,
replacing the old one. Your projects stay on your Mac.
:::

## Is my work safe if my phone or computer breaks?
Expand Down
Loading