Skip to content

Commit d5359f4

Browse files
committed
remove filters
Signed-off-by: alperozturk <alper_ozturk@proton.me>
1 parent 41fc243 commit d5359f4

File tree

6 files changed

+0
-68
lines changed

6 files changed

+0
-68
lines changed

app/src/main/java/com/nextcloud/client/database/dao/FileDao.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,4 @@ interface FileDao {
146146

147147
@Query("SELECT remote_id FROM filelist WHERE file_owner = :accountName AND remote_id IS NOT NULL")
148148
fun getAllRemoteIds(accountName: String): List<String>
149-
150-
@Query("SELECT parent FROM filelist WHERE _id = :fileId LIMIT 1")
151-
suspend fun getParentId(fileId: Long): Long?
152-
153-
@Query("SELECT favorite FROM filelist WHERE _id = :fileId LIMIT 1")
154-
suspend fun isFavoriteFolder(fileId: Long): Int?
155-
156-
@Query(
157-
"""
158-
SELECT
159-
(share_by_link = 1) OR
160-
(shared_via_users = 1) OR
161-
(permissions LIKE '%S%')
162-
FROM filelist
163-
WHERE _id = :fileId LIMIT 1
164-
"""
165-
)
166-
suspend fun isSharedFolder(fileId: Long): Boolean?
167149
}

app/src/main/java/com/owncloud/android/datamodel/OCFileListAdapterDataProviderImpl.kt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,4 @@ class OCFileListAdapterDataProviderImpl(private val storageManager: FileDataStor
2020
storageManager.fileDao.getFolderContentSuspended(id)
2121

2222
override fun createFileInstance(entity: FileEntity): OCFile = storageManager.createFileInstance(entity)
23-
24-
override suspend fun hasFavoriteParent(fileId: Long): Boolean {
25-
var currentId: Long? = fileId
26-
27-
while (currentId != null) {
28-
val parentId = storageManager.fileDao.getParentId(currentId) ?: return false
29-
val isFavorite = storageManager.fileDao.isFavoriteFolder(parentId) == 1
30-
if (isFavorite) return true
31-
currentId = parentId
32-
}
33-
34-
return false
35-
}
36-
37-
override suspend fun hasSharedParent(fileId: Long): Boolean {
38-
var currentId: Long? = fileId
39-
40-
while (currentId != null) {
41-
val parentId = storageManager.fileDao.getParentId(currentId) ?: return false
42-
val isShared = storageManager.fileDao.isSharedFolder(parentId) == true
43-
if (isShared) return true
44-
currentId = parentId
45-
}
46-
47-
return false
48-
}
4923
}

app/src/main/java/com/owncloud/android/ui/adapter/helper/OCFileListAdapterDataProvider.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ interface OCFileListAdapterDataProvider {
1414
fun convertToOCFiles(id: Long): List<OCFile>
1515
suspend fun getFolderContent(id: Long): List<FileEntity>
1616
fun createFileInstance(entity: FileEntity): OCFile
17-
suspend fun hasFavoriteParent(fileId: Long): Boolean
18-
suspend fun hasSharedParent(fileId: Long): Boolean
1917
}

app/src/main/java/com/owncloud/android/ui/adapter/helper/OCFileListAdapterHelper.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,6 @@ class OCFileListAdapterHelper {
9090
}
9191
}
9292

93-
val hasSharedParent = dataProvider.hasSharedParent(file.fileId)
94-
if (isSharedView && !hasSharedParent && !file.isShared) {
95-
continue
96-
}
97-
98-
val hasFavoriteParent = dataProvider.hasFavoriteParent(file.fileId)
99-
if (isFavoritesView && !hasFavoriteParent && !file.isFavorite) {
100-
continue
101-
}
102-
10393
if (file.isTempFile()) {
10494
continue
10595
}

app/src/test/java/com/owncloud/android/ui/adapter/MockOCFileListAdapterDataProvider.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ class MockOCFileListAdapterDataProvider : OCFileListAdapterDataProvider {
1717

1818
private var offlineOCFile: OCFile? = null
1919
private var files = listOf<OCFile>()
20-
var hasFavoriteParent = false
21-
var hasSharedParent = false
2220

2321
private fun getEntities(): List<FileEntity> = files.map { file ->
2422
FileEntity(
@@ -96,8 +94,4 @@ class MockOCFileListAdapterDataProvider : OCFileListAdapterDataProvider {
9694
}
9795

9896
override fun createFileInstance(entity: FileEntity): OCFile = files.first { it.fileId == entity.id }
99-
100-
override suspend fun hasFavoriteParent(fileId: Long): Boolean = hasFavoriteParent
101-
102-
override suspend fun hasSharedParent(fileId: Long): Boolean = hasSharedParent
10397
}

app/src/test/java/com/owncloud/android/ui/adapter/OCFileListAdapterHelperTest.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ class OCFileListAdapterHelperTest {
150150
}
151151
val file6 = env.file(sub2, "image6.jpg", 16, MimeType.JPEG)
152152

153-
dataProvider.hasFavoriteParent = true
154-
dataProvider.hasSharedParent = false
155-
156153
env.prepare(listOf(root, sub1, sub2, file1, file2, file3, file4, file5, file6))
157154
stubPreferences(sort = FileSortOrder.SORT_A_TO_Z, favFirst = true)
158155
val (list, sort) = env.run(sub1)
@@ -182,9 +179,6 @@ class OCFileListAdapterHelperTest {
182179
}
183180
val file6 = env.file(sub2, "image6.jpg", 16, MimeType.JPEG)
184181

185-
dataProvider.hasFavoriteParent = false
186-
dataProvider.hasSharedParent = true
187-
188182
env.prepare(listOf(root, sub1, sub2, file1, file2, file3, file4, file5, file6))
189183
stubPreferences(sort = FileSortOrder.SORT_A_TO_Z, favFirst = true)
190184
val (list, sort) = env.run(sub1)

0 commit comments

Comments
 (0)