Skip to content

Commit 596468e

Browse files
committed
fix: codacy
Signed-off-by: alperozturk <[email protected]>
1 parent 30fc950 commit 596468e

File tree

1 file changed

+21
-39
lines changed

1 file changed

+21
-39
lines changed

app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,48 +1153,30 @@ public void onReceive(Context context, Intent intent) {
11531153
boolean sameAccount = getAccount() != null && accountName.equals(getAccount().name)
11541154
&& getStorageManager() != null;
11551155

1156-
if (sameAccount) {
1157-
1158-
if (!FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
1159-
OCFile currentFile = (mFile == null) ? null :
1160-
getStorageManager().getFileByPath(mFile.getRemotePath());
1161-
OCFile currentDir = (getCurrentFolder() == null) ? null :
1162-
getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
1163-
1164-
if (currentDir == null) {
1165-
// current folder was removed from the server
1166-
DisplayUtils.showSnackMessage(
1167-
getActivity(),
1168-
R.string.sync_current_folder_was_removed,
1169-
getCurrentFolder().getFileName()
1170-
);
1171-
browseToRoot();
1172-
1173-
} else {
1174-
if (currentFile == null && !mFile.isFolder()) {
1175-
// currently selected file was removed in the server, and now we know it
1176-
currentFile = currentDir;
1177-
}
1178-
1179-
if (currentDir.getRemotePath().equals(syncFolderRemotePath)) {
1180-
populateDirectoryList(currentFile);
1181-
}
1156+
if (sameAccount && !FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
1157+
OCFile currentFile = (mFile == null) ? null : getStorageManager().getFileByPath(mFile.getRemotePath());
1158+
OCFile currentDir = (getCurrentFolder() == null) ? null : getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
1159+
1160+
if (currentDir == null) {
1161+
// current folder was removed from the server
1162+
DisplayUtils.showSnackMessage(getActivity(), R.string.sync_current_folder_was_removed, getCurrentFolder().getFileName());
1163+
browseToRoot();
1164+
} else {
1165+
if (currentFile == null && !mFile.isFolder()) {
1166+
// currently selected file was removed in the server, and now we know it
1167+
currentFile = currentDir;
11821168
}
11831169

1184-
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event)
1185-
/// TODO refactor and make common
1186-
&& syncResult != null && !syncResult.isSuccess()) {
1187-
1188-
if (syncResult.getCode() == ResultCode.UNAUTHORIZED ||
1189-
(syncResult.isException() && syncResult.getException()
1190-
instanceof AuthenticatorException)) {
1191-
1192-
requestCredentialsUpdate();
1193-
1194-
} else if (ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED == syncResult.getCode()) {
1170+
if (currentDir.getRemotePath().equals(syncFolderRemotePath)) {
1171+
populateDirectoryList(currentFile);
1172+
}
1173+
}
11951174

1196-
showUntrustedCertDialog(syncResult);
1197-
}
1175+
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) && syncResult != null && !syncResult.isSuccess()) {
1176+
if (syncResult.getCode() == ResultCode.UNAUTHORIZED || (syncResult.isException() && syncResult.getException() instanceof AuthenticatorException)) {
1177+
requestCredentialsUpdate();
1178+
} else if (ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED == syncResult.getCode()) {
1179+
showUntrustedCertDialog(syncResult);
11981180
}
11991181
}
12001182
}

0 commit comments

Comments
 (0)