- private void saveShareDB(OCShare shareFile) {
- // Save share file
- mStorageManager.saveShare(shareFile);
-
- // Get the path
- String path = shareFile.getPath();
- if (shareFile.isDirectory()) {
- path = path + FileUtils.PATH_SEPARATOR;
- }
+ private void saveSharesDB(ArrayList<OCShare> shares) {
+
+ if (shares.size() > 0) {
+ // Save share file
+ mStorageManager.saveShares(shares);
+
+ ArrayList<OCFile> sharedFiles = new ArrayList<OCFile>();
+
+ for (OCShare share : shares) {
+ // Get the path
+ String path = share.getPath();
+ if (share.isDirectory()) {
+ path = path + FileUtils.PATH_SEPARATOR;
+ }
+
+ // Update OCFile with data from share: ShareByLink ¿and publicLink?
+ OCFile file = mStorageManager.getFileByPath(path);
+ if (file != null) {
+ if (share.getShareType().equals(ShareType.PUBLIC_LINK)) {
+ file.setShareByLink(true);
+ sharedFiles.add(file);
+ }
+ }
+ }