Skip to content

How to reinitialize our variable delegated by Pin. #1

@edinofricaniago

Description

@edinofricaniago

I have a problem with Pin, when use it in my class Application with OkHttp interceptor.

  • Everytime my application calling request and need a token where I'm saving it with Pin.
  • When i change token from another class, the variable token in my class Application doesn't get update, it like just normal variable.
  • I'm trying to debug my application and suggest this the problem why Pin never update my token in class Application.
  • When I remove isRead = true from this code, My application run with properly.
    override fun getValue(thisRef: Any, property: KProperty<*>): T {
    if (!isRead) {
    bufferValue = readPin(property)
    isRead = true
    }
    return bufferValue
    }

override fun getValue(thisRef: Any, property: KProperty<*>): T? {
if (!isRead) {
bufferValue = readPin(property)
isRead = true
}
return bufferValue
}

  • I know you want cut the time cost from read SharedPreference but in My case, I need it without isRead = true.
  • Maybe you can fix it and update with optional paratemer isReread or otherway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions