1.修复漏洞:BaseDao 中的 SQL 注入
2.移除ACCESS_MOCK_LOCATION 权限 3.MMKV启用AES-256加密保存
This commit is contained in:
@@ -15,84 +15,90 @@ object MMKVUtil {
|
||||
MMKV.initialize(application)
|
||||
}
|
||||
|
||||
fun getMMKV(): MMKV {
|
||||
return MMKV.defaultMMKV(MMKV.SINGLE_PROCESS_MODE, Utils.SECRET_KEY, true)
|
||||
}
|
||||
|
||||
fun putBoolean(@MMKVKey key: String, value: Boolean) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getBoolean(@MMKVKey key: String, defaultValue: Boolean = false): Boolean {
|
||||
return MMKV.defaultMMKV().decodeBool(key, defaultValue)
|
||||
return getMMKV().decodeBool(key, defaultValue)
|
||||
}
|
||||
|
||||
fun putString(@MMKVKey key: String, value: String) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getString(@MMKVKey key: String, defaultValue: String = ""): String {
|
||||
return MMKV.defaultMMKV().decodeString(key, defaultValue)!!
|
||||
return getMMKV().decodeString(key, defaultValue)!!
|
||||
}
|
||||
|
||||
fun putInt(@MMKVKey key: String, value: Int) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getInt(@MMKVKey key: String, defaultValue: Int = 0): Int {
|
||||
return MMKV.defaultMMKV().decodeInt(key, defaultValue)
|
||||
return getMMKV().decodeInt(key, defaultValue)
|
||||
}
|
||||
|
||||
fun putFloat(@MMKVKey key: String, value: Float) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getFloat(@MMKVKey key: String, defaultValue: Float = 0F): Float {
|
||||
return MMKV.defaultMMKV().decodeFloat(key, defaultValue)
|
||||
return getMMKV().decodeFloat(key, defaultValue)
|
||||
}
|
||||
|
||||
fun putLong(@MMKVKey key: String, value: Long) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getLong(@MMKVKey key: String, defaultValue: Long = 0L): Long {
|
||||
return MMKV.defaultMMKV().decodeLong(key, defaultValue)
|
||||
return getMMKV().decodeLong(key, defaultValue)
|
||||
}
|
||||
|
||||
fun putDouble(@MMKVKey key: String, value: Double) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getDouble(@MMKVKey key: String, defaultValue: Double = 0.0): Double {
|
||||
return MMKV.defaultMMKV().decodeDouble(key, defaultValue)
|
||||
return getMMKV().decodeDouble(key, defaultValue)
|
||||
}
|
||||
|
||||
fun putByteArray(@MMKVKey key: String, value: ByteArray) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getByteArray(@MMKVKey key: String, defaultValue: ByteArray = ByteArray(0)): ByteArray {
|
||||
return MMKV.defaultMMKV().decodeBytes(key, defaultValue)!!
|
||||
return getMMKV().decodeBytes(key, defaultValue)!!
|
||||
}
|
||||
|
||||
fun putStringSet(@MMKVKey key: String, value: Set<String>) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
fun getStringSet(@MMKVKey key: String,
|
||||
defaultValue: Set<String> = mutableSetOf()): Set<String> {
|
||||
return MMKV.defaultMMKV().decodeStringSet(key, defaultValue)!!
|
||||
fun getStringSet(
|
||||
@MMKVKey key: String,
|
||||
defaultValue: Set<String> = mutableSetOf()
|
||||
): Set<String> {
|
||||
return getMMKV().decodeStringSet(key, defaultValue)!!
|
||||
}
|
||||
|
||||
fun putParcelable(@MMKVKey key: String, value: Parcelable) {
|
||||
MMKV.defaultMMKV().encode(key, value)
|
||||
getMMKV().encode(key, value)
|
||||
}
|
||||
|
||||
//清空所有sp
|
||||
fun clearAll() {
|
||||
//正式测试标识不清空
|
||||
val debugIp = getBoolean(MMKVKey.DebugIp, true)
|
||||
MMKV.defaultMMKV().clearAll()
|
||||
getMMKV().clearAll()
|
||||
putBoolean(MMKVKey.DebugIp, debugIp)
|
||||
}
|
||||
|
||||
inline fun <reified T : Parcelable> getParcelable(@MMKVKey key: String): T? {
|
||||
return MMKV.defaultMMKV().decodeParcelable(key, T::class.java)
|
||||
return getMMKV().decodeParcelable(key, T::class.java)
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ class Utils {
|
||||
|
||||
//HTTP请求加密key
|
||||
var SECRET_KEY = ""
|
||||
val CARD_RSA_KEY="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAofuJbnkwyF7SWg3eRadSYT+ttfHN+CUmCzH0WW1EWTUQOG+01Nv8ux+UJUlxbZA2X7959Et/+VKE03+4OY0/26dlgkROMlXCUnzsucuaoHW+9whGi6xklRZrDLi22QBae/8XV1YDEU2vfYXtcvwf66J0t+bRIhGytQUZvUrL7OEaAHvwJU0QwCy3wQGWcCgSkPpDruIe4ar19iZMleE+BdPGIfKfVdPvWFls63g1eMFECb8F9zN6ydGTCvlqvx/4gfDuFQnF+JuTSre8euSpTRTQn/Q0s3K6KiROVcAYCqDW6cKxNUr2ha1C9ZFxMws9C0qhx5wYzfSlIjFthPC1qwIDAQAB"
|
||||
const val DATE_FORMAT_PATTERN_CN = "yyyy-MM-dd"
|
||||
const val DATE_FORMAT_PATTERN_CN2 = "yyyy-MM-dd HH:mm:ss"
|
||||
const val DATE_FORMAT_PATTERN_CN3 = "yyyy/MM/dd HH:mm:ss"
|
||||
|
||||
Reference in New Issue
Block a user