Git Product home page Git Product logo

Comments (7)

liangjingkanji avatar liangjingkanji commented on June 15, 2024 1

已经计划提供Hook接口回调来配置加密/解密数据了
并且计划使用kotlin-serialization来序列化/反序列化来解决Parcelable/Serializable增删字段导致的一系列问题

from serialize.

liangjingkanji avatar liangjingkanji commented on June 15, 2024

mmkv本身就支持全局配置

from serialize.

nEdAy avatar nEdAy commented on June 15, 2024

@liangjingkanji 没找到 API 呀,目前看只能对某个 by serial() 设置它使用的 kv
我的需求是 可针对一个类下 所有 by serial() 等字段 配置它使用的 kv(业务字段、加密密钥)这样

类似这样写?
efc9b6a

from serialize.

liangjingkanji avatar liangjingkanji commented on June 15, 2024

Serialize默认使用的MMKV.default(), 你可以直接使用MMKV来加密. 如果只是针对某个类那这是不支持的(只能为每个字段配置MMKV对象)

from serialize.

liangjingkanji avatar liangjingkanji commented on June 15, 2024

2.0.0版本已经支持实现SerializeHook接口自定义序列化

from serialize.

liangjingkanji avatar liangjingkanji commented on June 15, 2024

现在支持全局配置mmkv

Serialize.mmkv = MMKV.defaultMMKV()

单例配置

@SerializeConfig(mmapID = "app_config") // 指定mmapID可以避免重命名当前类名或者改变包名导致无法读取旧值
object AppConfig {
    var userId: String by serialLazy(name="user_id") // 指定name可以避免重命名当前字段导致无法读取旧值
}

from serialize.

nEdAy avatar nEdAy commented on June 15, 2024

现在支持全局配置mmkv

Serialize.mmkv = MMKV.defaultMMKV()

单例配置

@SerializeConfig(mmapID = "app_config") // 指定mmapID可以避免重命名当前类名或者改变包名导致无法读取旧值
object AppConfig {
    var userId: String by serialLazy(name="user_id") // 指定name可以避免重命名当前字段导致无法读取旧值
}

这应该是我需要的,感谢东哥

from serialize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.