Skip to content

Commit

Permalink
Merge pull request #135 from Hywan/fix-rust-sdk-use-entries-with-dyna…
Browse files Browse the repository at this point in the history
…mic-adapters

feat(rust): Replace `Entries` by `EntriesWithDynamicAdapters`
  • Loading branch information
kegsay authored Oct 7, 2024
2 parents 87719af + 6adb907 commit 9fff69a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion internal/api/rust/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ type RustClient struct {
FFIClient *matrix_sdk_ffi.Client
syncService *matrix_sdk_ffi.SyncService
roomsListener *RoomsListener
entriesController *matrix_sdk_ffi.RoomListDynamicEntriesController
entriesAdapters *matrix_sdk_ffi.RoomListEntriesWithDynamicAdaptersResult
allRooms *matrix_sdk_ffi.RoomList
rooms map[string]*RustRoomInfo
roomsMu *sync.RWMutex
Expand Down Expand Up @@ -302,6 +304,14 @@ func (c *RustClient) Close(t ct.TestLike) {
}
}
c.roomsMu.Unlock()
if c.entriesController != nil {
c.entriesController.Destroy()
c.entriesController = nil
}
if c.entriesAdapters != nil {
c.entriesAdapters.Destroy()
c.entriesAdapters = nil
}
c.FFIClient.Destroy()
c.FFIClient = nil
if c.notifClient != nil {
Expand Down Expand Up @@ -407,7 +417,11 @@ func (c *RustClient) StartSyncing(t ct.TestLike) (stopSyncing func(), err error)
}
}
}()
c.allRooms.Entries(allRoomsListener)
entriesAdapters := c.allRooms.EntriesWithDynamicAdapters(1000, allRoomsListener)
entriesController := entriesAdapters.Controller()
entriesController.SetFilter(matrix_sdk_ffi.RoomListEntriesDynamicFilterKindNonLeft{})
c.entriesController = entriesController
c.entriesAdapters = entriesAdapters

isSyncing := false

Expand Down

0 comments on commit 9fff69a

Please sign in to comment.