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

View File

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

View File

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