From 9acddede65453fb3c9a6dbf5554cde8b3c816487 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Thu, 19 Oct 2023 04:29:51 +0530 Subject: [PATCH 1/3] fix remote home button Signed-off-by: Sahil Yeole --- flutter/lib/models/file_model.dart | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/flutter/lib/models/file_model.dart b/flutter/lib/models/file_model.dart index 108c76f1e..9a9c0f491 100644 --- a/flutter/lib/models/file_model.dart +++ b/flutter/lib/models/file_model.dart @@ -375,8 +375,14 @@ class FileController { history.add(directory.value.path); } - void goToHomeDirectory() { - openDirectory(homePath); + void goToHomeDirectory() async { + if (isLocal) { + openDirectory(homePath); + return; + } + final homeDir = (await bind.sessionGetPeerOption( + sessionId: sessionId, name: "remote_home_dir")); + openDirectory(homeDir); } void goBack() { @@ -403,7 +409,7 @@ class FileController { } // TODO deprecated this - void initDirAndHome(Map evt) { + void initDirAndHome(Map evt) async { try { final fd = FileDirectory.fromJson(jsonDecode(evt['value'])); fd.format(options.value.isWindows, sort: sortBy.value); @@ -423,6 +429,14 @@ class FileController { } } else if (options.value.home.isEmpty) { options.value.home = fd.path; + + final homeDir = ( await bind.sessionGetPeerOption( + sessionId: sessionId, name: "remote_home_dir")); + + if (homeDir.isEmpty){ + bind.sessionPeerOption( + sessionId: sessionId, name: "remote_home_dir", value: fd.path); + } debugPrint("init remote home: ${fd.path}"); directory.value = fd; } From e08da096dd7f2722c7bba6183dcd697cd367af5e Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Thu, 19 Oct 2023 23:45:48 +0530 Subject: [PATCH 2/3] remove home dir peer option Signed-off-by: Sahil Yeole --- flutter/lib/models/file_model.dart | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/flutter/lib/models/file_model.dart b/flutter/lib/models/file_model.dart index 9a9c0f491..108c76f1e 100644 --- a/flutter/lib/models/file_model.dart +++ b/flutter/lib/models/file_model.dart @@ -375,14 +375,8 @@ class FileController { history.add(directory.value.path); } - void goToHomeDirectory() async { - if (isLocal) { - openDirectory(homePath); - return; - } - final homeDir = (await bind.sessionGetPeerOption( - sessionId: sessionId, name: "remote_home_dir")); - openDirectory(homeDir); + void goToHomeDirectory() { + openDirectory(homePath); } void goBack() { @@ -409,7 +403,7 @@ class FileController { } // TODO deprecated this - void initDirAndHome(Map evt) async { + void initDirAndHome(Map evt) { try { final fd = FileDirectory.fromJson(jsonDecode(evt['value'])); fd.format(options.value.isWindows, sort: sortBy.value); @@ -429,14 +423,6 @@ class FileController { } } else if (options.value.home.isEmpty) { options.value.home = fd.path; - - final homeDir = ( await bind.sessionGetPeerOption( - sessionId: sessionId, name: "remote_home_dir")); - - if (homeDir.isEmpty){ - bind.sessionPeerOption( - sessionId: sessionId, name: "remote_home_dir", value: fd.path); - } debugPrint("init remote home: ${fd.path}"); directory.value = fd; } From 8207908d9e054696e9e1a8b5150cee0a3ce19694 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Fri, 20 Oct 2023 00:14:14 +0530 Subject: [PATCH 3/3] fix remote home button Signed-off-by: Sahil Yeole --- flutter/lib/models/file_model.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flutter/lib/models/file_model.dart b/flutter/lib/models/file_model.dart index 108c76f1e..ae1d9b701 100644 --- a/flutter/lib/models/file_model.dart +++ b/flutter/lib/models/file_model.dart @@ -261,6 +261,7 @@ class FileController { required this.getOtherSideDirectoryData}); String get homePath => options.value.home; + void set homePath(String path) => options.value.home = path; OverlayDialogManager? get dialogManager => rootState.target?.dialogManager; String get shortPath { @@ -376,6 +377,11 @@ class FileController { } void goToHomeDirectory() { + if (isLocal) { + openDirectory(homePath); + return; + } + homePath = ""; openDirectory(homePath); }