supabase-community / supabase-kt

A Kotlin Multiplatform Client for Supabase.
https://supabase.com/docs/reference/kotlin/introduction
MIT License
421 stars 38 forks source link

Improve base realtime `postgres`, `presence` and `broadcast` flow methods #697

Closed jan-tennert closed 3 months ago

jan-tennert commented 3 months ago

What kind of change does this PR introduce?

Internal refactor

What is the current behavior?

The base postgresChangeFlow and broadcastFlow implementation shouldn't be outside the RealtimeChannel class as they are essentially calling internal methods. Them being inline also makes it impossible to mock.

What is the new behavior?

Basically nothing changes for the public API except the presenceChangeFlow being moved up to be a member function of RealtimeChannel. Internally, postgresChangeFlow and broadcastFlow now call a internal non-inline variant which actually implements the logic.