add sendFilesSupport configs to the MDM

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-11-05 12:28:00 +01:00 committed by Alper Öztürk
parent e9054e1a05
commit 60bcb92cd9
2 changed files with 13 additions and 2 deletions

View file

@ -11,6 +11,7 @@ import android.content.Context
import com.nextcloud.utils.extensions.getRestriction
import com.owncloud.android.BuildConfig
import com.owncloud.android.R
import com.owncloud.android.files.FileMenuFilter
import com.owncloud.android.utils.appConfig.AppConfigKeys
object MDMConfig {
@ -47,6 +48,17 @@ object MDMConfig {
return shareViaUsers && disableShareViaMDM
}
fun sendFilesSupport(context: Context): Boolean {
val disableShareViaMDM = context.getRestriction(
AppConfigKeys.DisableSharing,
context.resources.getBoolean(R.bool.disable_sharing)
)
val sendFilesToOtherApp = "on".equals(context.getString(R.string.send_files_to_other_apps), ignoreCase = true)
return sendFilesToOtherApp && !disableShareViaMDM
}
fun clipBoardSupport(context: Context): Boolean {
val disableClipboardSupport = context.getRestriction(
AppConfigKeys.DisableClipboard,

View file

@ -188,8 +188,7 @@ public class FileMenuFilter {
}
private void filterSendFiles(List<Integer> toHide, boolean inSingleFileFragment) {
boolean disableSharingViaMDM = ContextExtensionsKt.getRestriction(context, AppConfigKeys.DisableSharing, context.getResources().getBoolean(R.bool.disable_sharing));
if (!disableSharingViaMDM || (overflowMenu || SEND_OFF.equalsIgnoreCase(context.getString(R.string.send_files_to_other_apps)) || containsEncryptedFile()) ||
if (!MDMConfig.INSTANCE.sendFilesSupport(context) || (overflowMenu || containsEncryptedFile()) ||
(!inSingleFileFragment && (isSingleSelection() || !allFileDown())) ||
!toHide.contains(R.id.action_send_share_file)) {
toHide.add(R.id.action_send_file);