lytics / ios-sdk

MIT License
0 stars 0 forks source link

Event Queue #17

Closed mgacy closed 1 year ago

mgacy commented 1 year ago

Adds an EventQueue, EventPipeline, stubs DataUploadRequestBuilder, and makes public Lytics methods @inlinable. This adds a minimal StreamEvent protocol to which Event, IdentityEvent, and ConsentEvent all conform.

EventQueue manages a Dictionary<String: [any StreamEvent]>. When it is time to flush, the queue calls DataUploadRequestBuilder to encode the events and create the corresponding requests. It then passes those requests to an upload closure.

This adds the @inlinable attribute to the public methods to enable the compiler to optimize calls to them across module boundaries. EventPipeline helps to contain the corresponding proliferation of @usableFromInline types and members.

Finally this adds additional types for testing support. To keep the size of this PR manageable, these tests are included in #18

This closes #19