refactor(app,learn): people's files on the device shared in halkyon_app
ADR 0043's recommendation, for Todo's attachments: what Learn had for its files on the device moves into halkyon_app, unchanged but for its names, and Learn uses it from there. - FileCache, DirectoryFileCache (Learn's AssetFileCache): the files by their SHA-256 in a folder of the person's, and which wait to be uploaded. - FileServerGateway, ServerpodFileServerGateway (Learn's AssetServerGateway): halkyon_base's files endpoint, taking the module's caller rather than Learn's client; FileLimitReached, FileRoom. - Their fakes in halkyon_app's testing: MemoryFileCache, FakeFileServerGateway, sha256Of. - SealedFile: the format every app seals a file in (HLKF, version 1), sealing with halkyon_app's ContentCipher; Learn's Privacy seals and opens its files with it, for the same context as before, so every file sealed so far opens as it did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
b7f0aaaec7
commit
5dd7575dd6
35 changed files with 272 additions and 235 deletions
|
|
@ -2,26 +2,26 @@ import 'dart:convert';
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache, sha256Of;
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/bloc/sound_bloc.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
|
||||
import '../../../support/fake_asset_gateway.dart';
|
||||
import '../../../support/fake_asset_sealing.dart';
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/fake_sound_player.dart';
|
||||
import '../../../support/memory_asset_file_cache.dart';
|
||||
|
||||
void main() {
|
||||
late MemoryAssetFileCache files;
|
||||
late MemoryFileCache files;
|
||||
late AssetRepository assets;
|
||||
late FakeSoundPlayer player;
|
||||
late String sound;
|
||||
|
||||
setUp(() async {
|
||||
files = MemoryAssetFileCache();
|
||||
files = MemoryFileCache();
|
||||
assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
FakeFileServerGateway(),
|
||||
files,
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,19 +3,19 @@ import 'dart:convert';
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache, sha256Of;
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_payload.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/model/stored_file.dart';
|
||||
|
||||
import '../../../support/fake_asset_gateway.dart';
|
||||
import '../../../support/fake_asset_sealing.dart';
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/memory_asset_file_cache.dart';
|
||||
|
||||
void main() {
|
||||
late FakeAssetGateway rows;
|
||||
late FakeAssetServerGateway server;
|
||||
late MemoryAssetFileCache cache;
|
||||
late FakeFileServerGateway server;
|
||||
late MemoryFileCache cache;
|
||||
late StreamController<void> triggers;
|
||||
late AssetRepository repository;
|
||||
|
||||
|
|
@ -26,8 +26,8 @@ void main() {
|
|||
|
||||
setUp(() {
|
||||
rows = FakeAssetGateway();
|
||||
server = FakeAssetServerGateway();
|
||||
cache = MemoryAssetFileCache();
|
||||
server = FakeFileServerGateway();
|
||||
cache = MemoryFileCache();
|
||||
triggers = StreamController<void>.broadcast();
|
||||
filesAllowed = true;
|
||||
repository = AssetRepository(
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_file_cache.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
void main() {
|
||||
late Directory folder;
|
||||
late DirectoryAssetFileCache cache;
|
||||
final hash = 'a' * 64;
|
||||
final other = 'b' * 64;
|
||||
|
||||
setUp(() async {
|
||||
folder = await Directory.systemTemp.createTemp('files');
|
||||
cache = DirectoryAssetFileCache(Directory(p.join(folder.path, 'files')));
|
||||
});
|
||||
tearDown(() => folder.delete(recursive: true));
|
||||
|
||||
test('keeps a file by its hash, and has none it was not given', () async {
|
||||
expect(await cache.read(hash), isNull);
|
||||
|
||||
await cache.write(hash, Uint8List.fromList([1, 2, 3]));
|
||||
|
||||
expect(await cache.read(hash), [1, 2, 3]);
|
||||
expect(File(cache.pathOf(hash)).readAsBytesSync(), [1, 2, 3]);
|
||||
expect(
|
||||
Directory(p.join(folder.path, 'files')).listSync().map((e) => e.path),
|
||||
[cache.pathOf(hash)],
|
||||
reason: 'nothing half-written is left beside it',
|
||||
);
|
||||
});
|
||||
|
||||
test('keeps the file it has when given it again', () async {
|
||||
await cache.write(hash, Uint8List.fromList([1]));
|
||||
await cache.write(hash, Uint8List.fromList([2]));
|
||||
|
||||
expect(await cache.read(hash), [1]);
|
||||
});
|
||||
|
||||
test('notes which files wait to be uploaded', () async {
|
||||
expect(await cache.pendingUploads(), isEmpty);
|
||||
|
||||
await cache.markPending(hash);
|
||||
await cache.markPending(other);
|
||||
await cache.clearPending(hash);
|
||||
await cache.clearPending('c' * 64);
|
||||
|
||||
expect(await cache.pendingUploads(), {other});
|
||||
});
|
||||
|
||||
test('refuses anything but a SHA-256 in a path', () async {
|
||||
for (final forged in ['../sync.sqlite', 'A' * 64, '${'a' * 63}/', '']) {
|
||||
expect(() => cache.pathOf(forged), throwsArgumentError);
|
||||
await expectLater(cache.markPending(forged), throwsArgumentError);
|
||||
await expectLater(
|
||||
cache.write(forged, Uint8List.fromList([1])),
|
||||
throwsArgumentError,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -2,19 +2,19 @@ import 'dart:convert';
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache, sha256Of;
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_payload.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
|
||||
import '../../../support/fake_asset_gateway.dart';
|
||||
import '../../../support/fake_asset_sealing.dart';
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/memory_asset_file_cache.dart';
|
||||
|
||||
/// A private studyset's files (ADR 0019, D5): sealed with its tree's key for
|
||||
/// their row before they are hashed, uploaded and kept.
|
||||
void main() {
|
||||
late FakeAssetGateway rows;
|
||||
late FakeAssetServerGateway server;
|
||||
late FakeFileServerGateway server;
|
||||
late FakeAssetSealing sealing;
|
||||
late AssetRepository device;
|
||||
final image = Uint8List.fromList(utf8.encode('a private picture'));
|
||||
|
|
@ -26,7 +26,7 @@ void main() {
|
|||
final repository = AssetRepository(
|
||||
rows,
|
||||
server,
|
||||
MemoryAssetFileCache(),
|
||||
MemoryFileCache(),
|
||||
keys,
|
||||
);
|
||||
addTearDown(repository.dispose);
|
||||
|
|
@ -35,7 +35,7 @@ void main() {
|
|||
|
||||
setUp(() {
|
||||
rows = FakeAssetGateway();
|
||||
server = FakeAssetServerGateway();
|
||||
server = FakeFileServerGateway();
|
||||
sealing = FakeAssetSealing(keys: {'diary': 'key-diary'});
|
||||
device = deviceWith(sealing);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import 'package:material_ui/material_ui.dart';
|
|||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_note_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
import '../../support/pump_app.dart';
|
||||
import '../../support/test_dependencies.dart';
|
||||
|
||||
|
|
@ -44,7 +43,7 @@ void main() {
|
|||
noteGateway: FakeNoteGateway(),
|
||||
files: files,
|
||||
assetGateway: assets,
|
||||
assetFiles: MemoryAssetFileCache(),
|
||||
assetFiles: MemoryFileCache(),
|
||||
),
|
||||
location: RoutePaths.newNote('japanese'),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache, sha256Of;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_payload.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
|
|
@ -17,11 +19,9 @@ import 'package:material_ui/material_ui.dart';
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_sound_player.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
import '../../support/pump_app.dart';
|
||||
import '../../support/test_dependencies.dart';
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ void main() {
|
|||
late FakeCardGateway cardGateway;
|
||||
late CardRepository cards;
|
||||
late FakeAssetGateway assetGateway;
|
||||
late MemoryAssetFileCache files;
|
||||
late MemoryFileCache files;
|
||||
late AssetRepository assets;
|
||||
late FakeSoundPlayer sounds;
|
||||
|
||||
|
|
@ -37,10 +37,10 @@ void main() {
|
|||
cardGateway = FakeCardGateway();
|
||||
cards = CardRepository(cardGateway);
|
||||
assetGateway = FakeAssetGateway();
|
||||
files = MemoryAssetFileCache();
|
||||
files = MemoryFileCache();
|
||||
assets = AssetRepository(
|
||||
assetGateway,
|
||||
FakeAssetServerGateway(),
|
||||
FakeFileServerGateway(),
|
||||
files,
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/work/work_progress.dart';
|
||||
|
|
@ -22,7 +24,6 @@ import 'package:halkyon_learn_flutter/src/feature/tag/data/tag_repository.dart';
|
|||
|
||||
import '../../../support/fake_asset_gateway.dart';
|
||||
import '../../../support/fake_asset_sealing.dart';
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/fake_card_gateway.dart';
|
||||
import '../../../support/fake_learning_path_gateway.dart';
|
||||
import '../../../support/fake_note_gateway.dart';
|
||||
|
|
@ -30,7 +31,6 @@ import '../../../support/fake_pdf_source_gateway.dart';
|
|||
import '../../../support/fake_review_gateway.dart';
|
||||
import '../../../support/fake_studyset_gateway.dart';
|
||||
import '../../../support/fake_tag_gateway.dart';
|
||||
import '../../../support/memory_asset_file_cache.dart';
|
||||
import 'anki_package_test.dart' show fixture;
|
||||
|
||||
void main() {
|
||||
|
|
@ -55,8 +55,8 @@ void main() {
|
|||
assetRows = FakeAssetGateway();
|
||||
assets = AssetRepository(
|
||||
assetRows,
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
importer = AnkiImporter(
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import 'package:halkyon_learn_flutter/src/feature/studyset/data/studyset_reposit
|
|||
import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset_content.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/fake_card_gateway.dart';
|
||||
import '../../../support/fake_note_gateway.dart';
|
||||
import '../../../support/fake_studyset_gateway.dart';
|
||||
|
|
@ -26,13 +25,13 @@ import '../data/anki_package_test.dart' show fixture;
|
|||
void main() {
|
||||
late FakeCardGateway cardGateway;
|
||||
late FakeFilePicker files;
|
||||
late FakeAssetServerGateway server;
|
||||
late FakeFileServerGateway server;
|
||||
late FakeNoteGateway noteGateway;
|
||||
|
||||
setUp(() {
|
||||
cardGateway = FakeCardGateway();
|
||||
files = FakeFilePicker();
|
||||
server = FakeAssetServerGateway();
|
||||
server = FakeFileServerGateway();
|
||||
noteGateway = FakeNoteGateway();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/model/stored_file.dart';
|
||||
|
|
@ -40,7 +42,6 @@ import 'package:halkyon_ui/halkyon_ui.dart';
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_device_dictionaries.dart';
|
||||
import '../../support/fake_dictionary_gateway.dart';
|
||||
|
|
@ -51,7 +52,6 @@ import '../../support/fake_pdf_source_gateway.dart';
|
|||
import '../../support/fake_review_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/fake_tag_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
|
||||
/// One person's repositories, on fake gateways of their own.
|
||||
final class _Person() {
|
||||
|
|
@ -63,8 +63,8 @@ final class _Person() {
|
|||
final reviews = ReviewRepository(FakeReviewGateway());
|
||||
final assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
late final tags = TagRepository(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import 'dart:typed_data';
|
|||
import 'package:archive/archive.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/work/work_progress.dart';
|
||||
|
|
@ -33,7 +35,6 @@ import 'package:halkyon_learn_flutter/src/feature/tag/data/tag_repository.dart';
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_device_dictionaries.dart';
|
||||
import '../../support/fake_dictionary_gateway.dart';
|
||||
|
|
@ -44,7 +45,6 @@ import '../../support/fake_pdf_source_gateway.dart';
|
|||
import '../../support/fake_review_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/fake_tag_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
|
||||
/// The JSON a synced [payload] holds.
|
||||
Map<String, Object?> json(ByteData payload) =>
|
||||
|
|
@ -280,8 +280,8 @@ void main() {
|
|||
assetRows = FakeAssetGateway();
|
||||
assets = AssetRepository(
|
||||
assetRows,
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
pdfs = PdfSourceRepository(FakePdfSourceGateway(), assets);
|
||||
|
|
|
|||
|
|
@ -20,13 +20,11 @@ import 'package:material_ui/material_ui.dart' hide Card;
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_note_gateway.dart';
|
||||
import '../../support/fake_pdf_engine.dart';
|
||||
import '../../support/fake_pdf_source_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
import '../../support/pump_app.dart';
|
||||
import '../../support/test_dependencies.dart';
|
||||
|
||||
|
|
@ -74,7 +72,7 @@ void main() {
|
|||
late FakeNoteGateway noteGateway;
|
||||
late FakePdfSourceGateway pdfGateway;
|
||||
late FakeAssetGateway assetGateway;
|
||||
late MemoryAssetFileCache files;
|
||||
late MemoryFileCache files;
|
||||
late FakePdfEngine engine;
|
||||
|
||||
setUp(() {
|
||||
|
|
@ -95,7 +93,7 @@ void main() {
|
|||
noteGateway = FakeNoteGateway();
|
||||
pdfGateway = FakePdfSourceGateway();
|
||||
assetGateway = FakeAssetGateway();
|
||||
files = MemoryAssetFileCache();
|
||||
files = MemoryFileCache();
|
||||
engine = FakePdfEngine();
|
||||
});
|
||||
|
||||
|
|
@ -240,7 +238,7 @@ void main() {
|
|||
'selected, tied to the page', (tester) async {
|
||||
final assets = AssetRepository(
|
||||
assetGateway,
|
||||
FakeAssetServerGateway(),
|
||||
FakeFileServerGateway(),
|
||||
files,
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -29,14 +29,12 @@ import 'package:material_ui/material_ui.dart';
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_conversation_gateway.dart';
|
||||
import '../../support/fake_grammar_gateway.dart';
|
||||
import '../../support/fake_photo_picker.dart';
|
||||
import '../../support/fake_settings_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
import '../../support/memory_device_settings_store.dart';
|
||||
import '../../support/pump_app.dart';
|
||||
import '../../support/test_dependencies.dart';
|
||||
|
|
@ -123,7 +121,7 @@ void main() {
|
|||
late MemoryDeviceSettingsStore store;
|
||||
late List<Uri> searched;
|
||||
late FakeAssetGateway assetGateway;
|
||||
late MemoryAssetFileCache assetFiles;
|
||||
late MemoryFileCache assetFiles;
|
||||
late FakeGrammarGateway grammar;
|
||||
|
||||
setUp(() {
|
||||
|
|
@ -150,7 +148,7 @@ void main() {
|
|||
speech = FakeSpeechInput();
|
||||
searched = [];
|
||||
assetGateway = FakeAssetGateway();
|
||||
assetFiles = MemoryAssetFileCache();
|
||||
assetFiles = MemoryFileCache();
|
||||
grammar = FakeGrammarGateway(
|
||||
found: {
|
||||
'私はりんごは食べる': const [
|
||||
|
|
@ -1469,7 +1467,7 @@ void main() {
|
|||
Future<String> picturedCard() async {
|
||||
final assets = AssetRepository(
|
||||
assetGateway,
|
||||
FakeAssetServerGateway(),
|
||||
FakeFileServerGateway(),
|
||||
assetFiles,
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@ import 'dart:typed_data';
|
|||
import 'dart:ui' show Rect;
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/assistant/data/assistant_files.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/pdf_source/model/pdf_source.dart';
|
||||
|
||||
import '../../../support/fake_asset_gateway.dart';
|
||||
import '../../../support/fake_asset_sealing.dart';
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/fake_pdf_engine.dart';
|
||||
import '../../../support/memory_asset_file_cache.dart';
|
||||
|
||||
// What a model is sent of the person's files (ADR 0021, D12): images every
|
||||
// provider reads, none larger than the smallest limit, and a PDF's pages
|
||||
|
|
@ -25,8 +25,8 @@ void main() {
|
|||
setUp(() {
|
||||
assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
engine = FakePdfEngine();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import 'dart:convert';
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/content/published_ref.dart';
|
||||
|
|
@ -24,7 +26,6 @@ import 'package:material_ui/material_ui.dart' hide Card;
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_explore_gateway.dart';
|
||||
import '../../support/fake_learning_path_gateway.dart';
|
||||
|
|
@ -32,7 +33,6 @@ import '../../support/fake_note_gateway.dart';
|
|||
import '../../support/fake_pdf_source_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/fake_tag_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
import '../../support/pump_app.dart';
|
||||
import '../../support/test_dependencies.dart';
|
||||
|
||||
|
|
@ -95,8 +95,8 @@ void main() {
|
|||
final paths = LearningPathRepository(FakeLearningPathGateway());
|
||||
final assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
// The person added release 1 to their library before.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/card/data/card_payload.dart';
|
||||
|
|
@ -25,14 +27,12 @@ import 'package:halkyon_learn_flutter/src/feature/tag/data/tag_repository.dart';
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_learning_path_gateway.dart';
|
||||
import '../../support/fake_note_gateway.dart';
|
||||
import '../../support/fake_pdf_source_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/fake_tag_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
|
||||
/// The JSON a synced [payload] holds.
|
||||
Map<String, Object?> json(ByteData payload) =>
|
||||
|
|
@ -180,8 +180,8 @@ void main() {
|
|||
);
|
||||
final assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
pdfs = PdfSourceRepository(FakePdfSourceGateway(), assets);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import 'dart:convert';
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/content/published_ref.dart';
|
||||
|
|
@ -30,14 +32,12 @@ import 'package:halkyon_learn_flutter/src/feature/tag/data/tag_repository.dart';
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_learning_path_gateway.dart';
|
||||
import '../../support/fake_note_gateway.dart';
|
||||
import '../../support/fake_pdf_source_gateway.dart';
|
||||
import '../../support/fake_studyset_gateway.dart';
|
||||
import '../../support/fake_tag_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
|
||||
/// The JSON a synced [payload] holds.
|
||||
Map<String, Object?> json(ByteData payload) =>
|
||||
|
|
@ -89,8 +89,8 @@ void main() {
|
|||
);
|
||||
assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
pdfs = PdfSourceRepository(FakePdfSourceGateway(), assets);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import 'dart:convert';
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/citation/model/citation.dart';
|
||||
|
|
@ -23,13 +25,11 @@ import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset_conten
|
|||
|
||||
import '../../../support/fake_asset_gateway.dart';
|
||||
import '../../../support/fake_asset_sealing.dart';
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/fake_card_gateway.dart';
|
||||
import '../../../support/fake_learning_path_gateway.dart';
|
||||
import '../../../support/fake_note_gateway.dart';
|
||||
import '../../../support/fake_pdf_source_gateway.dart';
|
||||
import '../../../support/fake_studyset_gateway.dart';
|
||||
import '../../../support/memory_asset_file_cache.dart';
|
||||
|
||||
void main() {
|
||||
late FakeStudysetGateway studysetGateway;
|
||||
|
|
@ -49,8 +49,8 @@ void main() {
|
|||
paths = LearningPathRepository(FakeLearningPathGateway());
|
||||
assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
pdfs = PdfSourceRepository(FakePdfSourceGateway(), assets);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:archive/archive.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_payload.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
|
|
@ -22,12 +24,10 @@ import 'package:material_ui/material_ui.dart';
|
|||
|
||||
import '../../../support/fake_asset_gateway.dart';
|
||||
import '../../../support/fake_asset_sealing.dart';
|
||||
import '../../../support/fake_asset_server_gateway.dart';
|
||||
import '../../../support/fake_card_gateway.dart';
|
||||
import '../../../support/fake_file_saver.dart';
|
||||
import '../../../support/fake_review_gateway.dart';
|
||||
import '../../../support/fake_studyset_gateway.dart';
|
||||
import '../../../support/memory_asset_file_cache.dart';
|
||||
import '../../../support/pump_app.dart';
|
||||
import '../../../support/test_dependencies.dart';
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ void main() {
|
|||
late FakeStudysetGateway studysets;
|
||||
late FakeCardGateway cardGateway;
|
||||
late FakeAssetGateway assetGateway;
|
||||
late MemoryAssetFileCache cache;
|
||||
late MemoryFileCache cache;
|
||||
late FakeFileSaver saver;
|
||||
late FakeReviewGateway reviewGateway;
|
||||
late _HeldExportArchiver archiver;
|
||||
|
|
@ -48,7 +48,7 @@ void main() {
|
|||
);
|
||||
cardGateway = FakeCardGateway();
|
||||
assetGateway = FakeAssetGateway();
|
||||
cache = MemoryAssetFileCache();
|
||||
cache = MemoryFileCache();
|
||||
saver = FakeFileSaver();
|
||||
reviewGateway = FakeReviewGateway();
|
||||
archiver = _HeldExportArchiver();
|
||||
|
|
@ -256,7 +256,7 @@ void main() {
|
|||
'links to', (tester) async {
|
||||
final assets = AssetRepository(
|
||||
assetGateway,
|
||||
FakeAssetServerGateway(),
|
||||
FakeFileServerGateway(),
|
||||
cache,
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache;
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/profile/public_person.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/card/data/card_repository.dart';
|
||||
|
|
@ -13,12 +15,10 @@ import 'package:halkyon_learn_flutter/src/feature/note/data/note_repository.dart
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_feedback_gateways.dart';
|
||||
import '../../support/fake_learning_path_gateway.dart';
|
||||
import '../../support/fake_note_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
|
||||
/// The author's inbox shows what they do at once: a thread read, a
|
||||
/// decision taken; accepting a suggestion waits, as it changes content.
|
||||
|
|
@ -53,8 +53,8 @@ void main() {
|
|||
server = FakeFeedbackServerGateway(threads: [report]);
|
||||
final assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
addTearDown(assets.dispose);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/testing.dart'
|
||||
show FakeFileServerGateway, MemoryFileCache, sha256Of;
|
||||
import 'package:halkyon_editor/halkyon_editor.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/asset/data/asset_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/content/published_ref.dart';
|
||||
|
|
@ -17,12 +19,10 @@ import 'package:halkyon_learn_flutter/src/feature/note/model/note_content.dart';
|
|||
|
||||
import '../../support/fake_asset_gateway.dart';
|
||||
import '../../support/fake_asset_sealing.dart';
|
||||
import '../../support/fake_asset_server_gateway.dart';
|
||||
import '../../support/fake_card_gateway.dart';
|
||||
import '../../support/fake_feedback_gateways.dart';
|
||||
import '../../support/fake_learning_path_gateway.dart';
|
||||
import '../../support/fake_note_gateway.dart';
|
||||
import '../../support/memory_asset_file_cache.dart';
|
||||
|
||||
const origin = PublishedRef(
|
||||
publication: 'publication-1',
|
||||
|
|
@ -48,8 +48,8 @@ void main() {
|
|||
notes = NoteRepository(FakeNoteGateway());
|
||||
assets = AssetRepository(
|
||||
FakeAssetGateway(),
|
||||
FakeAssetServerGateway(),
|
||||
MemoryAssetFileCache(),
|
||||
FakeFileServerGateway(),
|
||||
MemoryFileCache(),
|
||||
FakeAssetSealing(),
|
||||
);
|
||||
feedback = FeedbackRepository(
|
||||
|
|
@ -133,10 +133,10 @@ void main() {
|
|||
'tree: one of another private tree, named by a row the instance '
|
||||
'planted, is never uploaded', () async {
|
||||
final rows = FakeAssetGateway();
|
||||
final cache = MemoryAssetFileCache();
|
||||
final cache = MemoryFileCache();
|
||||
final sealedAssets = AssetRepository(
|
||||
rows,
|
||||
FakeAssetServerGateway(),
|
||||
FakeFileServerGateway(),
|
||||
cache,
|
||||
FakeAssetSealing(
|
||||
keys: {'own-tree': 'k-own', 'other-tree': 'k-other'},
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue