Skip to content

Commit

Permalink
Update SMB file handling to new system
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelMess committed Apr 23, 2022
1 parent 3ef6546 commit 85f4f50
Show file tree
Hide file tree
Showing 18 changed files with 609 additions and 251 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,12 @@ dependencies {

implementation 'org.tukaani:xz:1.8'

implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
//ReactiveX
implementation "io.reactivex.rxjava2:rxandroid:$reactiveXAndroidVersion"
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version)
implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.9'
implementation "io.reactivex.rxjava2:rxjava:$reactiveXVersion"

implementation project(':commons_compress_7z')
implementation project(':file_operations')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static android.os.Build.VERSION_CODES.Q;

import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Calendar;
Expand All @@ -38,6 +39,7 @@
import com.amaze.filemanager.database.UtilsHandler;
import com.amaze.filemanager.file_operations.exceptions.CloudPluginException;
import com.amaze.filemanager.file_operations.filesystem.OpenMode;
import com.amaze.filemanager.file_operations.filesystem.filetypes.AmazeFile;
import com.amaze.filemanager.filesystem.HybridFile;
import com.amaze.filemanager.filesystem.HybridFileParcelable;
import com.amaze.filemanager.filesystem.RootHelper;
Expand Down Expand Up @@ -69,8 +71,6 @@
import androidx.core.util.Pair;

import jcifs.smb.SmbAuthException;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;

public class LoadFilesListTask
extends AsyncTask<Void, Void, Pair<OpenMode, ArrayList<LayoutElementParcelable>>> {
Expand Down Expand Up @@ -141,7 +141,7 @@ public LoadFilesListTask(
hFile.setPath(hFile.getPath() + "/");
}
try {
SmbFile[] smbFile = hFile.getSmbFile(5000).listFiles();
AmazeFile[] smbFile = new AmazeFile(hFile.getPath()).listFiles();
list = mainFragment.addToSmb(smbFile, path, showHiddenFiles);
openmode = OpenMode.SMB;
} catch (SmbAuthException e) {
Expand All @@ -150,7 +150,7 @@ public LoadFilesListTask(
}
e.printStackTrace();
return null;
} catch (SmbException | NullPointerException e) {
} catch (NullPointerException | IOException e) {
Log.w(getClass().getSimpleName(), "Failed to load smb files for path: " + path, e);
mainFragment.reauthenticateSmb();
return null;
Expand Down
Loading

0 comments on commit 85f4f50

Please sign in to comment.