Skip to content

Commit a917300

Browse files
committed
fix duplicated items
Signed-off-by: alperozturk <alper_ozturk@proton.me>
1 parent 4c17cdd commit a917300

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareActivity.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,19 @@ public void refreshSharesFromDB() {
345345
adapter.addShares(shares);
346346

347347
// TODO: Will be added later on...
348-
List<OCShare> publicShares = new ArrayList<>();
349-
350-
if (containsNoNewPublicShare(adapter.getShares())) {
351-
final OCShare ocShare = new OCShare();
352-
ocShare.setShareType(ShareType.NEW_PUBLIC_LINK);
353-
publicShares.add(ocShare);
354-
} else {
355-
adapter.removeNewPublicShare();
356-
}
348+
/*
349+
List<OCShare> publicShares = new ArrayList<>();
350+
351+
if (containsNoNewPublicShare(adapter.getShares())) {
352+
final OCShare ocShare = new OCShare();
353+
ocShare.setShareType(ShareType.NEW_PUBLIC_LINK);
354+
publicShares.add(ocShare);
355+
} else {
356+
adapter.removeNewPublicShare();
357+
}
357358
358-
adapter.addShares(publicShares);
359+
adapter.addShares(publicShares);
360+
*/
359361
});
360362
} catch (Exception e) {
361363
Log_OC.d(TAG, "Exception while refreshSharesFromDB: " + e);

app/src/main/java/it/niedermann/owncloud/notes/share/model/CreateShareResponseExtensions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.owncloud.android.lib.resources.shares.ShareType
66
fun List<CreateShareResponse>.toOCShare(): List<OCShare> {
77
return map { response ->
88
OCShare().apply {
9-
id = response.id.toLongOrNull() ?: 0
9+
id = response.id.toLongOrNull() ?: -1L
1010
fileSource = response.fileSource
1111
itemSource = response.itemSource
1212
shareType = when (response.shareType) {
@@ -32,5 +32,5 @@ fun List<CreateShareResponse>.toOCShare(): List<OCShare> {
3232
mimetype = response.mimetype
3333
ownerDisplayName = response.displaynameOwner
3434
}
35-
}
35+
}.filter { it.id != -1L }
3636
}

0 commit comments

Comments
 (0)