mirror of https://github.com/x13a/Wasted.git
ref
This commit is contained in:
parent
255bed2760
commit
74533a60c3
|
@ -10,11 +10,7 @@ class AppNotificationManager(private val ctx: Context) {
|
|||
const val CHANNEL_DEFAULT_ID = "default"
|
||||
}
|
||||
|
||||
private var manager: NotificationManager? = null
|
||||
|
||||
init {
|
||||
manager = ctx.getSystemService(NotificationManager::class.java)
|
||||
}
|
||||
private val manager = ctx.getSystemService(NotificationManager::class.java)
|
||||
|
||||
fun createNotificationChannels() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
||||
|
|
|
@ -7,14 +7,10 @@ import android.content.Intent
|
|||
import android.os.Build
|
||||
|
||||
class DeviceAdminManager(private val ctx: Context) {
|
||||
private var dpm: DevicePolicyManager? = null
|
||||
private val dpm = ctx.getSystemService(DevicePolicyManager::class.java)
|
||||
private val deviceAdmin by lazy { ComponentName(ctx, DeviceAdminReceiver::class.java) }
|
||||
private val prefs by lazy { Preferences(ctx) }
|
||||
|
||||
init {
|
||||
dpm = ctx.getSystemService(DevicePolicyManager::class.java)
|
||||
}
|
||||
|
||||
fun remove() = dpm?.removeActiveAdmin(deviceAdmin)
|
||||
fun isActive(): Boolean = dpm?.isAdminActive(deviceAdmin) ?: false
|
||||
fun getCurrentFailedPasswordAttempts(): Int = dpm?.currentFailedPasswordAttempts ?: 0
|
||||
|
|
|
@ -11,11 +11,7 @@ class WipeJobManager(private val ctx: Context) {
|
|||
private const val JOB_ID = 1000
|
||||
}
|
||||
private val prefs by lazy { Preferences(ctx) }
|
||||
private var scheduler: JobScheduler? = null
|
||||
|
||||
init {
|
||||
scheduler = ctx.getSystemService(JobScheduler::class.java)
|
||||
}
|
||||
private val scheduler = ctx.getSystemService(JobScheduler::class.java)
|
||||
|
||||
fun schedule(): Int {
|
||||
return scheduler?.schedule(
|
||||
|
|
Loading…
Reference in New Issue