This commit is contained in:
Jobobby04 2021-09-06 15:34:58 -04:00
parent 52cdb636c9
commit cc38579fca
3 changed files with 8 additions and 7 deletions

View File

@ -50,17 +50,18 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
// SY -->
val today: Calendar = Calendar.getInstance()
val timeRanges = preferences.authenticatorTimeRanges().get().mapNotNull { TimeRange.fromPreferenceString(it) }
val timeRanges = preferences.authenticatorTimeRanges().get()
.mapNotNull { TimeRange.fromPreferenceString(it) }
if (timeRanges.isNotEmpty()) {
val now = today.get(Calendar.HOUR_OF_DAY).hours + today.get(Calendar.MINUTE).minutes
val locked = timeRanges.any { now in it }
if (!locked) {
val lockedNow = timeRanges.any { now in it }
if (!lockedNow) {
return false
}
}
val lockedDays = preferences.authenticatorDays().get()
val locked = lockedDays == LOCK_ALL_DAYS || when (today.get(Calendar.DAY_OF_WEEK)) {
val lockedToday = lockedDays == LOCK_ALL_DAYS || when (today.get(Calendar.DAY_OF_WEEK)) {
Calendar.SUNDAY -> (lockedDays and LOCK_SUNDAY) == LOCK_SUNDAY
Calendar.MONDAY -> (lockedDays and LOCK_MONDAY) == LOCK_MONDAY
Calendar.TUESDAY -> (lockedDays and LOCK_TUESDAY) == LOCK_TUESDAY
@ -71,7 +72,7 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
else -> false
}
if (!locked) {
if (!lockedToday) {
return false
}
// SY <--

View File

@ -157,7 +157,7 @@ class SettingsAppearanceController : SettingsController() {
summary = "%s"
}
}
preferenceCategory {
titleRes = R.string.pref_category_navbar

View File

@ -36,7 +36,7 @@ class ConfiguringDialogController : DialogController() {
.show()
}
}
xLogE("Configuration error!", e)
this@ConfiguringDialogController.xLogE("Configuration error!", e)
}
launchUI {
finish()