amplitude / Amplitude-Kotlin

Amplitude Kotlin SDK
MIT License
27 stars 10 forks source link

fix: restore previous session data on app opening #87

Closed falconandy closed 1 year ago

falconandy commented 1 year ago

Summary

  1. Current session restore logic didn't work correctly due to Kotlin initialization order (property initializes, init blocks, child/parent inheritance). The logic is extracted to a separate init block.
  2. Added a test for the session restore logic.
  3. Session-specific code is moved from coroutines to let it be executed synchronously and avoid possible data-race issues.
  4. Some unnecessary code is removed (including previousSessionId property)
  5. Fixed bug in InMemoryStorage - contains was used instead of containsKey

Checklist

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 1.4.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket: