feat: the app tells when sync fails, and when it is too old

Published apps can't be made to update, so the app now notices when it
no longer matches the server: the server names the oldest app build it
works with (instance.info's minimumAppBuild), asked before the first
sync of each launch, and the sync engine's refusal of differing synced
tables counts the same. Either way the app says "update the app; if it
is up to date, the server needs an update" in a banner on Home and in
the new Sync card in Settings, and what the person does meanwhile stays
on the device.

The Sync card shows where sync stands since the app started (syncing,
everything synced, sync failing, with the last completion and failure)
and offers Sync now. While the last sync failed, a dot sits on the
Profile tab and the Settings cog. One sync that goes through clears it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-03 23:26:47 +02:00
commit e35ce5c81d
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 1016 additions and 18 deletions

View file

@ -229,7 +229,7 @@ class EndpointInstance extends _isc.EndpointRef {
String get name => 'instance';
/// This instance's offer: GitHub sign-in only with the operator's OAuth
/// app, and where its source is.
/// app, where its source is, and the oldest app build it works with.
_ida.Future<_i26u8vl4.InstanceInfo> info() =>
caller.callServerEndpoint<_i26u8vl4.InstanceInfo>(
'instance',

View file

@ -19,17 +19,20 @@ abstract class InstanceInfo
InstanceInfo._({
this.gitHubClientId,
required this.sourceCodeUrl,
this.minimumAppBuild,
});
factory InstanceInfo({
String? gitHubClientId,
required String sourceCodeUrl,
int? minimumAppBuild,
}) = _InstanceInfoImpl;
factory InstanceInfo.fromJson(Map<String, dynamic> jsonSerialization) {
return InstanceInfo(
gitHubClientId: jsonSerialization['gitHubClientId'] as String?,
sourceCodeUrl: jsonSerialization['sourceCodeUrl'] as String,
minimumAppBuild: jsonSerialization['minimumAppBuild'] as int?,
);
}
@ -41,12 +44,18 @@ abstract class InstanceInfo
/// offering it to the people who use it.
String sourceCodeUrl;
/// The oldest build of the app (the number after `+` in its version) this
/// server still works with; older apps ask to be updated. Null from servers
/// that predate it: any build.
int? minimumAppBuild;
/// Returns a shallow copy of this [InstanceInfo]
/// with some or all fields replaced by the given arguments.
@_isc.useResult
InstanceInfo copyWith({
String? gitHubClientId,
String? sourceCodeUrl,
int? minimumAppBuild,
});
@override
Map<String, dynamic> toJson() {
@ -54,6 +63,7 @@ abstract class InstanceInfo
'__className__': 'InstanceInfo',
if (gitHubClientId != null) 'gitHubClientId': gitHubClientId,
'sourceCodeUrl': sourceCodeUrl,
if (minimumAppBuild != null) 'minimumAppBuild': minimumAppBuild,
};
}
@ -63,6 +73,7 @@ abstract class InstanceInfo
'__className__': 'InstanceInfo',
if (gitHubClientId != null) 'gitHubClientId': gitHubClientId,
'sourceCodeUrl': sourceCodeUrl,
if (minimumAppBuild != null) 'minimumAppBuild': minimumAppBuild,
};
}
@ -78,9 +89,11 @@ class _InstanceInfoImpl extends InstanceInfo {
_InstanceInfoImpl({
String? gitHubClientId,
required String sourceCodeUrl,
int? minimumAppBuild,
}) : super._(
gitHubClientId: gitHubClientId,
sourceCodeUrl: sourceCodeUrl,
minimumAppBuild: minimumAppBuild,
);
/// Returns a shallow copy of this [InstanceInfo]
@ -90,12 +103,16 @@ class _InstanceInfoImpl extends InstanceInfo {
InstanceInfo copyWith({
Object? gitHubClientId = _Undefined,
String? sourceCodeUrl,
Object? minimumAppBuild = _Undefined,
}) {
return InstanceInfo(
gitHubClientId: gitHubClientId is String?
? gitHubClientId
: this.gitHubClientId,
sourceCodeUrl: sourceCodeUrl ?? this.sourceCodeUrl,
minimumAppBuild: minimumAppBuild is int?
? minimumAppBuild
: this.minimumAppBuild,
);
}
}