|
23 | 23 | import android.database.Cursor; |
24 | 24 | import android.graphics.drawable.Drawable; |
25 | 25 | import android.net.Uri; |
26 | | -import android.os.Build; |
27 | 26 | import android.os.Bundle; |
28 | 27 | import android.provider.ContactsContract; |
29 | 28 | import android.text.InputType; |
|
36 | 35 | import com.nextcloud.client.account.UserAccountManager; |
37 | 36 | import com.nextcloud.client.di.Injectable; |
38 | 37 | import com.nextcloud.client.network.ClientFactory; |
| 38 | +import com.nextcloud.utils.OCShareExtensionsKt; |
39 | 39 | import com.nextcloud.utils.extensions.BundleExtensionsKt; |
40 | 40 | import com.nextcloud.utils.extensions.FileExtensionsKt; |
41 | 41 | import com.nextcloud.utils.extensions.ViewExtensionsKt; |
|
69 | 69 |
|
70 | 70 | import java.util.ArrayList; |
71 | 71 | import java.util.List; |
72 | | -import java.util.stream.Collectors; |
73 | | -import java.util.stream.Stream; |
74 | 72 |
|
75 | 73 | import javax.inject.Inject; |
76 | 74 |
|
@@ -559,18 +557,10 @@ public void refreshSharesFromDB() { |
559 | 557 | } |
560 | 558 |
|
561 | 559 | private void addExternalAndInternalShares(List<OCShare> externalShares) { |
562 | | - List<OCShare> publicShares = fileDataStorageManager.getSharesByPathAndType(file.getRemotePath(), ShareType.PUBLIC_LINK, ""); |
563 | | - |
| 560 | + final var publicShares = fileDataStorageManager.getSharesByPathAndType(file.getRemotePath(), ShareType.PUBLIC_LINK, ""); |
564 | 561 | externalShareeListAdapter.removeAll(); |
565 | | - Stream<OCShare> combinedStream = Stream.concat(externalShares.stream(), publicShares.stream()) |
566 | | - .distinct(); |
567 | | - List<OCShare> combinedShares; |
568 | | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { |
569 | | - combinedShares = combinedStream.toList(); |
570 | | - } else { |
571 | | - combinedShares = combinedStream.collect(Collectors.toList()); |
572 | | - } |
573 | | - externalShareeListAdapter.addShares(combinedShares); |
| 562 | + final var shares = OCShareExtensionsKt.mergeDistinctByToken(externalShares, publicShares); |
| 563 | + externalShareeListAdapter.addShares(shares); |
574 | 564 | } |
575 | 565 |
|
576 | 566 | private void checkContactPermission() { |
|
0 commit comments