-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - Check Auto Upload Sub Folder #14547
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ec5aa9e
use lifecycleScope
alperozturk96 f1da19e
add getEnabledOrWithoutEnabledParent extension for List<SyncedFolderD…
alperozturk96 fca8321
use extension
alperozturk96 81c6e09
add removeAutoUploadFromSubFoldersWithEnabledParent
alperozturk96 a5d2ca1
add documentations to the functions and use better function names
alperozturk96 d387442
add documentations to the functions and use better function names
alperozturk96 66ad7f2
check isGivenLocalPathHasEnabledParent
alperozturk96 e82f8dc
add tests
alperozturk96 a862c14
add missing import
alperozturk96 aa69adf
inform user and remove auto delete
alperozturk96 7161742
rename imagebutton
alperozturk96 f1e59bf
fix code analytics
alperozturk96 8b9a438
show alert dialog instead of snackbar
alperozturk96 8a507d9
change title, title icon and positive button text
alperozturk96 754c4a7
add tint for title icon
alperozturk96 291019a
fix code analytics
alperozturk96 95f4770
change positiveButtonTextId for overview page
alperozturk96 9f397f5
check parents recursively to determine sub folder of sub folders
alperozturk96 8d8eec1
fixes
alperozturk96 188858a
remove test due to file existance check
alperozturk96 b6be668
fix code analytics
alperozturk96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/nextcloud/utils/extensions/SyncedFolderExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Nextcloud - Android Client | ||
* | ||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]> | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
package com.nextcloud.utils.extensions | ||
|
||
import com.owncloud.android.datamodel.SyncedFolder | ||
import com.owncloud.android.datamodel.SyncedFolderDisplayItem | ||
import java.io.File | ||
|
||
fun List<SyncedFolderDisplayItem>.filterEnabledOrWithoutEnabledParent(): List<SyncedFolderDisplayItem> { | ||
return filter { it.isEnabled || !hasEnabledParent(it.localPath) } | ||
} | ||
|
||
@Suppress("ReturnCount") | ||
fun List<SyncedFolder>.hasEnabledParent(localPath: String?): Boolean { | ||
localPath ?: return false | ||
|
||
val localFile = File(localPath).takeIf { it.exists() } ?: return false | ||
val parent = localFile.parentFile ?: return false | ||
|
||
return any { it.isEnabled && File(it.localPath).exists() && File(it.localPath) == parent } || | ||
hasEnabledParent(parent.absolutePath) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only setIconAttribute for defaultTitleIconId otherwise it will override given titleIconId