Skip to content

Commit 0f79b10

Browse files
committed
fix enforce protection
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 01141b6 commit 0f79b10

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

app/src/main/java/com/owncloud/android/ui/dialog/AppPassCodeDialog.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class AppPassCodeDialog :
4848
val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton
4949
positiveButton?.let {
5050
viewThemeUtils.material.colorMaterialButtonPrimaryTonal(it)
51+
val enforceProtection = MDMConfig.enforceProtection(requireContext())
52+
if (enforceProtection) {
53+
it.isEnabled = (binding.lockPasscode.isChecked || binding.lockDeviceCredentials.isChecked)
54+
}
5155
}
5256

5357
val dismissable = arguments?.getBoolean(ARG_DISMISSABLE, true) ?: true
@@ -122,6 +126,13 @@ class AppPassCodeDialog :
122126
}
123127

124128
currentSelection = selectedLock
129+
130+
val positiveButton = (dialog as? AlertDialog)
131+
?.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton
132+
val enforceProtection = MDMConfig.enforceProtection(requireContext())
133+
if (enforceProtection) {
134+
positiveButton?.isEnabled = (binding.lockPasscode.isChecked || binding.lockDeviceCredentials.isChecked)
135+
}
125136
}
126137
}
127138

0 commit comments

Comments
 (0)