Skip to content

Commit

Permalink
Give feedback to user
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <alper_ozturk@proton.me>
  • Loading branch information
alperozturk96 committed Jun 28, 2024
1 parent 38d9b0f commit 66f0da3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,11 @@ private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation ope
}

if (fileListFragment instanceof OCFileListFragment ocFileListFragment && file != null) {
ocFileListFragment.updateOCFile(file);
if (ocFileListFragment.getAdapterFiles().contains(file)) {
ocFileListFragment.updateOCFile(file);
} else {
DisplayUtils.showSnackMessage(this, R.string.file_activity_shared_file_cannot_be_updated);
}
}
} else {
// Detect Failure (403) --> maybe needs password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1387,14 +1387,18 @@ public void listDirectory(OCFile directory, OCFile file, boolean onlyOnDevice, b
}
}

public List<OCFile> getAdapterFiles() {
return mAdapter.getFiles();
}

public void updateOCFile(@NonNull OCFile file) {
List<OCFile> mFiles = mAdapter.getFiles();
if (!mFiles.contains(file)) {
int index = mFiles.indexOf(file);
if (index == -1) {
Log_OC.d(TAG, "File cannot be found in adapter's files");
return;
}

int index = mFiles.indexOf(file);
mFiles.set(index, file);
mAdapter.notifyItemChanged(file);
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,7 @@
<string name="check_back_later_or_reload">Check back later or reload.</string>
<string name="e2e_not_yet_setup">E2E not yet setup</string>
<string name="error_file_actions">Error showing file actions</string>
<string name="file_activity_shared_file_cannot_be_updated">Shared file cannot be updated</string>
<string name="pin_home">Pin to Home screen</string>
<string name="pin_shortcut_label">Open %1$s</string>
<string name="displays_mnemonic">Displays your 12 word passphrase</string>
Expand Down

0 comments on commit 66f0da3

Please sign in to comment.