Closed hawkbee1 closed 4 years ago
app usecase : display filtered list of things in assistant/search screen list.view builder ? taking userSearchResultList as parameter which is a thing list (stuff in code until now)
domain use case : get images of thing (thing) => for each path getImage(path) domain unit use case : get image (path) repository domain ? distant image or local image if local is here we get this one if local is not here 2 cases :
first : write first test for get image => should get image file for the path from the domain repository image_repository
data layer : we don't need models and mappers since we just deal with files But we need to take care of choosing between local and Firebase data source
we check path to know if it's a local path or a remote one
if local path we check if file is present, if file is present we return it
else we check connection
if device connected to internet we download file and store it locally
after storing file locally we change path of thing in thing list json file
we return file
I already know I will lack some tests at end of this dev process :-1:
no more app explosion but... I think something's fishy here
adding test : local image repository : should extract filename from remote path
switch on dev branch and ran debug mode : same pbm
method = "StorageReference#writeToFile" this = {MethodChannel} arguments = {_InternalLinkedHashMap} size = 4 result = {_ByteDataView} TypedDataView(cid: 143)
=> bucket and app value are null => some files should already be on local drive so the path has change during new version dev =>
checking old local storage parameters : old version stored image at root of application document directory and new one is storing in image folder. checking activity to see if migration needed... I have regular users so I won't change folder without handling migration.
changing or not ?
verdict => keep images in root folder
changing image folder of tests to point directly on tdd/fixtures/image in image_local_data_source_test.dart updating code to have passing test changing image folder of tests to point directly on tdd/fixtures/image in test/tdd/data/datasources/image_remote_data_source_test.dart => good without change... tdd hurra !
new bug : app is trying to download file with local storage path path
error is presently not due to memory explosion as expected but 404 error inside firebase storage moduel when using writeToFile.... try catch doesn't work on this one... :-/ time to attempt a new package update in new branch
can't catch firebase storage error, issue is dealt in firebase repository : https://github.com/FirebaseExtended/flutterfire/issues/792
App try to load all the images which cause too much memory consumption.