Skip to content

Releases: skydoves/Chamber

1.0.3

15 May 03:09
b324008
Compare
Choose a tag to compare

🎉 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. (52cf96b)
  • Prevented exposing some internal functionalities to outside.
  • Refactored internal codes.

1.0.2

13 May 11:41
0411c55
Compare
Choose a tag to compare

🎉 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

07 Aug 08:39
ced7f98
Compare
Choose a tag to compare

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

23 Jul 10:00
e23db8d
Compare
Choose a tag to compare

🎉🎉published first release version 1.0.0 🎉🎉