Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fa8b7bc authored by Matheo Levallois's avatar Matheo Levallois
Browse files

Merge branch '0000-several-refactor-on-comments-in-parentalControlAuthenticator' into 'main'

several refactor on comments in parentalcontrolauthenticator

See merge request !610
parents f4042b84 76edd1ac
Loading
Loading
Loading
Loading
Loading
+22 −6
Original line number 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

import android.content.Intent
@@ -5,15 +23,14 @@ import androidx.activity.result.ActivityResultLauncher
import kotlinx.coroutines.CompletableDeferred
import timber.log.Timber

/*
This class is used to to deal with PaCO, and get accurate password result
This class is a singleton
/**
 * This class is used to deal with Parental Control, and get accurate password result
 */
object ParentalControlAuthenticator {

    private const val KEY_PARENTAL_CONTROL_AUTHENTICATION =
        "foundation.e.parentalcontrol.START_AUTHENTICATE" //Parental Control intent
    const val KEY_PARENTAL_CONTROL_RESULT = "authentication_result" //Parental Control Key
        "foundation.e.parentalcontrol.START_AUTHENTICATE"
    const val KEY_PARENTAL_CONTROL_RESULT = "authentication_result"

    private var launcher: ActivityResultLauncher<Intent>? = null
    private var authResultDeferred: CompletableDeferred<Boolean>? = null
@@ -32,7 +49,6 @@ object ParentalControlAuthenticator {
            authResultDeferred?.complete(false)
        }

        // Await the Authenticate from Parental Control
        return authResultDeferred?.await() == true
    }