package club.clubk.ktag.apps.sharedservices

import android.content.SharedPreferences

/** Reads a String preference and converts it to Int, falling back to [default]. */
fun SharedPreferences.getIntPref(key: String, default: String): Int =
    getString(key, default)?.toIntOrNull() ?: default.toInt()

/** Reads a String preference and converts it to Long, falling back to [default]. */
fun SharedPreferences.getLongPref(key: String, default: String): Long =
    getString(key, default)?.toLongOrNull() ?: default.toLong()
