This commit is contained in:
lucky 2022-01-15 15:03:45 +03:00
parent 6bf789e31b
commit b58e83213c
1 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ open class MainActivity : AppCompatActivity() {
private val shortcut by lazy { ShortcutManager(this) } private val shortcut by lazy { ShortcutManager(this) }
private val job by lazy { WipeJobManager(this) } private val job by lazy { WipeJobManager(this) }
private val requestAdminPolicy = private val registerForDeviceAdmin =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
when (result.resultCode) { when (result.resultCode) {
RESULT_OK -> setOn() RESULT_OK -> setOn()
@ -238,7 +238,7 @@ open class MainActivity : AppCompatActivity() {
admin.remove() admin.remove()
} }
private fun requestAdmin() = requestAdminPolicy.launch(admin.makeRequestIntent()) private fun requestAdmin() = registerForDeviceAdmin.launch(admin.makeRequestIntent())
private fun makeCode(): String = UUID.randomUUID().toString() private fun makeCode(): String = UUID.randomUUID().toString()
private fun setCodeReceiverState(value: Boolean) = private fun setCodeReceiverState(value: Boolean) =
setComponentState(CodeReceiver::class.java, value) setComponentState(CodeReceiver::class.java, value)