Skip to content

Commit

Permalink
sync: dropbox: Use the service when listing files
Browse files Browse the repository at this point in the history
Wrap the logic to list the remote files in a call to useDropboxService.
  • Loading branch information
jefftharris committed Jul 17, 2024
1 parent 2cc79f0 commit 234b52d
Showing 1 changed file with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,22 +241,25 @@ public void sync(Account acct,

/** List files */
public List<ProviderRemoteFile> listFiles(String path)
throws DbxException
throws Exception
{
List<ProviderRemoteFile> files = new ArrayList<>();
ListFolderResult result = itsClient.files().listFolder(path);
do {
for (Metadata child: result.getEntries()) {
files.add(new DropboxCoreProviderFile(child));
}
useDropboxService(() -> {
ListFolderResult result = itsClient.files().listFolder(path);
do {
for (Metadata child : result.getEntries()) {
files.add(new DropboxCoreProviderFile(child));
}

if (result.getHasMore()) {
result = itsClient.files()
.listFolderContinue(result.getCursor());
} else {
result = null;
}
} while(result != null);
if (result.getHasMore()) {
result = itsClient
.files()
.listFolderContinue(result.getCursor());
} else {
result = null;
}
} while (result != null);
});

return files;
}
Expand Down

0 comments on commit 234b52d

Please sign in to comment.