Loading app/src/main/java/foundation/e/apps/utils/ParentalControlAuthenticator.kt +22 −6 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 e Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.utils package foundation.e.apps.utils import android.content.Intent import android.content.Intent Loading @@ -5,15 +23,14 @@ import androidx.activity.result.ActivityResultLauncher import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred import timber.log.Timber import timber.log.Timber /* /** This class is used to to deal with PaCO, and get accurate password result * This class is used to deal with Parental Control, and get accurate password result This class is a singleton */ */ object ParentalControlAuthenticator { object ParentalControlAuthenticator { private const val KEY_PARENTAL_CONTROL_AUTHENTICATION = private const val KEY_PARENTAL_CONTROL_AUTHENTICATION = "foundation.e.parentalcontrol.START_AUTHENTICATE" //Parental Control intent "foundation.e.parentalcontrol.START_AUTHENTICATE" const val KEY_PARENTAL_CONTROL_RESULT = "authentication_result" //Parental Control Key const val KEY_PARENTAL_CONTROL_RESULT = "authentication_result" private var launcher: ActivityResultLauncher<Intent>? = null private var launcher: ActivityResultLauncher<Intent>? = null private var authResultDeferred: CompletableDeferred<Boolean>? = null private var authResultDeferred: CompletableDeferred<Boolean>? = null Loading @@ -32,7 +49,6 @@ object ParentalControlAuthenticator { authResultDeferred?.complete(false) authResultDeferred?.complete(false) } } // Await the Authenticate from Parental Control return authResultDeferred?.await() == true return authResultDeferred?.await() == true } } Loading Loading
app/src/main/java/foundation/e/apps/utils/ParentalControlAuthenticator.kt +22 −6 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 e Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.utils package foundation.e.apps.utils import android.content.Intent import android.content.Intent Loading @@ -5,15 +23,14 @@ import androidx.activity.result.ActivityResultLauncher import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred import timber.log.Timber import timber.log.Timber /* /** This class is used to to deal with PaCO, and get accurate password result * This class is used to deal with Parental Control, and get accurate password result This class is a singleton */ */ object ParentalControlAuthenticator { object ParentalControlAuthenticator { private const val KEY_PARENTAL_CONTROL_AUTHENTICATION = private const val KEY_PARENTAL_CONTROL_AUTHENTICATION = "foundation.e.parentalcontrol.START_AUTHENTICATE" //Parental Control intent "foundation.e.parentalcontrol.START_AUTHENTICATE" const val KEY_PARENTAL_CONTROL_RESULT = "authentication_result" //Parental Control Key const val KEY_PARENTAL_CONTROL_RESULT = "authentication_result" private var launcher: ActivityResultLauncher<Intent>? = null private var launcher: ActivityResultLauncher<Intent>? = null private var authResultDeferred: CompletableDeferred<Boolean>? = null private var authResultDeferred: CompletableDeferred<Boolean>? = null Loading @@ -32,7 +49,6 @@ object ParentalControlAuthenticator { authResultDeferred?.complete(false) authResultDeferred?.complete(false) } } // Await the Authenticate from Parental Control return authResultDeferred?.await() == true return authResultDeferred?.await() == true } } Loading