-
public class AegisInboxAegisInbox — persistent message-center client for Android.
Mirrors the TypeScript AegisInbox contract (libs/web-sdk/src/inbox/). Fetches the contact's inbox page from /v1/in-app/inbox at startup, persists a cached copy in SharedPreferences so the drawer has something to render before the network round-trip completes, and exposes read/dismiss/read-all mutations.
NOTE: This is a scaffold that compiles and mirrors the wire contract. It has NOT been exercised against a real device or instrumentation test harness — callers integrating it into a production app should:
Run the instrumentation tests in src/androidTest/
Wire AegisInbox into a Compose drawer and verify cold start, mark-read, and pagination flows
Confirm the SharedPreferences cache survives process death
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classAegisInbox.InboxEntrypublic interfaceAegisInbox.Listener
-
Field Summary
Fields Modifier and Type Field Description private final LongDEFAULT_KEEPALIVE_SECONDSprivate final LongMIN_KEEPALIVE_SECONDSpublic final static AegisInboxINSTANCE
-
Method Summary
Modifier and Type Method Description final Unitinitialize(Context context, String apiHost, String writeKey, String contactId, String organizationId, String propertyId)Configure the client. final Function0<Unit>addListener(AegisInbox.Listener listener)final List<AegisInbox.InboxEntry>getEntries()final IntegergetUnreadCount()final <ERROR CLASS>refresh()Fetch /v1/in-app/inbox. final UnitmarkRead(String messageId)final Unitdismiss(String messageId)final UnitupdateContactId(String contactId)final Unitdestroy()final UnitstartKeepalive(Long intervalSeconds)Start the keepalive loop. final UnitstopKeepalive()Stop the keepalive loop. final LonggetDEFAULT_KEEPALIVE_SECONDS()Default poll interval (seconds). final LonggetMIN_KEEPALIVE_SECONDS()Minimum poll interval (seconds). -
-
Method Detail
-
initialize
final Unit initialize(Context context, String apiHost, String writeKey, String contactId, String organizationId, String propertyId)
Configure the client. Reads the cached state from prefs so the UI can render immediately; schedules a background refresh.
-
addListener
final Function0<Unit> addListener(AegisInbox.Listener listener)
-
getEntries
final List<AegisInbox.InboxEntry> getEntries()
-
getUnreadCount
final Integer getUnreadCount()
-
refresh
final <ERROR CLASS> refresh()
Fetch /v1/in-app/inbox. Fails open — on error we keep the cached view so the drawer never goes blank.
-
updateContactId
final Unit updateContactId(String contactId)
-
startKeepalive
final Unit startKeepalive(Long intervalSeconds)
Start the keepalive loop. Polls
/v1/in-app/inboxeveryintervalSecondswhile the process is alive; also refreshes immediately on every app-foreground via ProcessLifecycleOwner.Idempotent: a second call cancels the first job before starting the new one.
-
stopKeepalive
final Unit stopKeepalive()
Stop the keepalive loop. Called on logout / reset / inbox-disable.
-
getDEFAULT_KEEPALIVE_SECONDS
final Long getDEFAULT_KEEPALIVE_SECONDS()
Default poll interval (seconds). Mirrors iOS + CleverTap cadence.
-
getMIN_KEEPALIVE_SECONDS
final Long getMIN_KEEPALIVE_SECONDS()
Minimum poll interval (seconds). Clamp guards against pathological configs running the inbox endpoint hot.
-
-
-
-