Skip to content

Commit

Permalink
fix recursion issue when entering focus view
Browse files Browse the repository at this point in the history
  • Loading branch information
vauvenal5 committed Nov 8, 2020
1 parent a037eb7 commit 6093b57
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
8 changes: 8 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/156.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- implement GET_CONTENT handler
- introduce navigator 2.0 to directory traversal
- add ACTION_PICK filter
- open default screen for image select
- fix removal of upstream removed folders
- fix recursive update issue from browse to home view
- fix memory leak
- fix browse view recursive issue when entering focus view
12 changes: 7 additions & 5 deletions lib/managers/file_manager_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:rx_command/rx_command.dart';
import 'package:yaga/managers/file_sub_manager.dart';
import 'package:yaga/model/nc_file.dart';
import 'package:yaga/utils/forground_worker/messages/file_list_response.dart';
import 'package:yaga/utils/logger.dart';

abstract class FileManagerBase {
Expand Down Expand Up @@ -31,20 +32,21 @@ abstract class FileManagerBase {
: Stream.value(file));
}

Stream<List<NcFile>> listFileLists(Uri uri, {bool recursive = false}) {
Stream<FileListResponse> listFileLists(String requestKey, Uri uri,
{bool recursive = false}) {
return this._fileSubManagers[uri.scheme].listFileList(uri).flatMap((list) {
if (!recursive) {
return Stream.value(list);
return Stream.value(FileListResponse(requestKey, uri, list));
}

return Rx.merge([
Stream.value(list),
Stream.value(FileListResponse(requestKey, uri, list)),
Stream.fromIterable(list)
.where((file) => file.isDirectory)
.doOnData((file) =>
_logger.d("Emiting from recursive. (${file.uri.path})"))
.flatMap(
(file) => this.listFileLists(file.uri, recursive: recursive))
.flatMap((file) =>
this.listFileLists(requestKey, file.uri, recursive: recursive))
]);
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/managers/widget_local/file_list_local_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FileListLocalManager {
.map((event) => event as FileListMessage)
.where((event) =>
event.uri == uri ||
(recursive.value &&
(this.recursive.value &&
event.uri.toString().startsWith(uri.toString())))
.listen((event) {
if (event is FileListResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'dart:isolate';
import 'package:yaga/managers/isolateable/isolated_file_manager.dart';
import 'package:yaga/utils/forground_worker/messages/file_list_done.dart';
import 'package:yaga/utils/forground_worker/messages/file_list_request.dart';
import 'package:yaga/utils/forground_worker/messages/file_list_response.dart';
import 'package:yaga/utils/forground_worker/messages/file_update_msg.dart';
import 'package:yaga/utils/service_locator.dart';

Expand All @@ -17,9 +16,8 @@ class FileListRequestHandler {

getIt
.get<IsolatedFileManager>()
.listFileLists(message.uri, recursive: message.recursive)
.listen((event) => isolateToMain
.send(FileListResponse(message.key, message.uri, event)))
.listFileLists(message.key, message.uri, recursive: message.recursive)
.listen((event) => isolateToMain.send(event))
.onDone(() {
isolateToMain.send(FileListDone(message.key, message.uri));
updateSub.cancel();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: A Nextcloud gallary app.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.15.5+0155
version: 0.15.6+0156

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit 6093b57

Please sign in to comment.