Skydoves Chamber Versions Save

βš–οΈ A lightweight Android lifecycle-aware and thread-safe pipeline for communicating between components with custom scopes.

1.0.3

3 years ago

πŸŽ‰ Released a new version 1.0.3! πŸŽ‰

What's New?

  • Added PropertyObserver annotation that used to observe value changes by ChamberProperty that has the same key value. This annotation only works with a method that in a scoped class. A method that is annotated with PropertyObserver will be invoked, whenever the value changes and receives the value as a parameter. The method must have one parameter and the type must same as the generic of the ChamberProperty.
@UserScope // custom scope
class MainActivityViewModel : ViewModel() {

  @ShareProperty(key = UserScope.nickname)
  var username = ChamberProperty("skydoves")

  @PropertyObserver(key = UserScope.nickname)
  fun usernameObserver(value: String) {
    Log.d("MainActivityViewModel", "usernameObserver: $value")
  }
}

Here is an example of usages in an Activity.

@UserScope
class MainActivity : AppCompatActivity() {

  @ShareProperty(key = UserScope.nickname)
  private var username = chamberProperty("skydoves")

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    shareLifecycle()

    username.observe { Log.d("SecondActivity", "observed data: $it") }

    username.value = "skydoves on SecondActivity"
  }

  @PropertyObserver(key = UserScope.nickname)
  fun nickNameObserver(nickname: String) {
    Log.d("MainActivity", "nickNameObserver: $nickname")
  }
}
  • Renamed autoClear to clearOnDestroy. (52cf96bc)
  • Prevented exposing some internal functionalities to outside.
  • Refactored internal codes.

1.0.2

3 years ago

πŸŽ‰ Released a new version 1.0.2! πŸŽ‰

What's New?

61701682-86756780-ad79-11e9-9520-f6ed9003204a
  • Migrated to maven central repository.
  • Changed store() getter in the Chamber object to internal.
  • Changed receiver on observer function as a non-nullable generic type.
  • Removed unused dependencies internally.

1.0.1

4 years ago

implemented autoClear option for clear the value on the local storage when lifecycle state is onDestroy.

  • autoClear(value: Boolean) method on the ChamberField.
  • autoClear option on the @ShareProperty annotation. The default value is false.

1.0.0

4 years ago

πŸŽ‰πŸŽ‰published first release version 1.0.0 πŸŽ‰πŸŽ‰