package xyz.r0r5chach.dermy_app.fragments

import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import kotlinx.coroutines.DelicateCoroutinesApi
import xyz.r0r5chach.dermy_app.R


@DelicateCoroutinesApi
class SettingsFragment : PreferenceFragmentCompat() {
    override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
        setPreferencesFromResource(R.xml.preferences, rootKey)

        findPreference<Preference>("disclaimer")
            ?.setOnPreferenceClickListener {
               val dialog = AlertDialog.Builder(requireContext())

                dialog
                    .setMessage(R.string.disclaimer)
                    .setTitle("Disclaimer")
                    .setNeutralButton("Ok") { window, _ -> window.dismiss() }
                    .create().show()
                true
            }

    }
    //TODO: Backup data
    //TODO: Recover Account
}
