feat(app): Check for updates downloads the server's newest APK and opens the installer

This commit is contained in:
2026-10-23 19:59:03 +01:00
parent 72e01471ab
commit 6152292aff
11 changed files with 523 additions and 0 deletions
@@ -0,0 +1,27 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/updates/app_updates.dart';
void main() {
test('builds live beside the server, under the preview origin', () {
expect(
updatesBaseFor(Uri.parse('wss://host.ts.net:8443/connect')).toString(),
'https://host.ts.net:8096/updates/',
);
});
test('version.json names the build and its APK', () {
final base = Uri.parse('https://host.ts.net:8096/updates/');
final update = AppUpdate.parse(
'{"versionCode": 29960000, "versionName": "0.1.29960000", '
'"apk": "pipelines.apk", "notes": "fixes"}',
base,
)!;
expect(update.versionCode, 29960000);
expect(
update.apk.toString(),
'https://host.ts.net:8096/updates/pipelines.apk',
);
expect(AppUpdate.parse('{}', base), isNull);
expect(AppUpdate.parse('not json', base), isNull);
});
}