Add app source and tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
47
lib/Peach/about/internal/file/FileStorage.dart
Normal file
47
lib/Peach/about/internal/file/FileStorage.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../../../comms/Comms.dart' show LogLine;
|
||||
import '../application/ServiceConfig.dart';
|
||||
import '../application/StepTracker.dart';
|
||||
import 'BuildService.dart';
|
||||
import 'ConnectFileStorage.dart';
|
||||
import 'WebArchive.dart';
|
||||
|
||||
/// The one concrete [ConnectFileStorage]. Owns the [BuildService] and delegates
|
||||
/// archiving to [WebArchive]; holds no state of its own beyond the builder.
|
||||
class FileStorage implements ConnectFileStorage {
|
||||
final BuildService _builder = BuildService();
|
||||
|
||||
@override
|
||||
bool get buildSupported => BuildService.supported;
|
||||
|
||||
@override
|
||||
Stream<LogLine> get buildLogs => _builder.logs;
|
||||
|
||||
@override
|
||||
Stream<List<DeployStep>> get buildStepStream => _builder.stepStream;
|
||||
|
||||
@override
|
||||
Future<BuildResult> build(ServiceConfig service) => _builder.build(service);
|
||||
|
||||
@override
|
||||
Future<BuildResult> buildWeb(ServiceConfig service) =>
|
||||
_builder.buildWeb(service);
|
||||
|
||||
@override
|
||||
void cancelBuild() => _builder.cancel();
|
||||
|
||||
@override
|
||||
Future<Uint8List> readArtifact(String path) => File(path).readAsBytes();
|
||||
|
||||
@override
|
||||
Future<bool> artifactExists(String path) => File(path).exists();
|
||||
|
||||
@override
|
||||
Future<(Uint8List, int)> packageWeb(String directoryPath) =>
|
||||
// Packaging a large static tree blocks long enough to drop frames, so it
|
||||
// runs on a background isolate.
|
||||
compute(packageWebDir, directoryPath);
|
||||
}
|
||||
Reference in New Issue
Block a user