Skip to content

fix: In app improvements#980

Draft
mahmoud-elmorabea wants to merge 4 commits intomainfrom
in-app-improvements
Draft

fix: In app improvements#980
mahmoud-elmorabea wants to merge 4 commits intomainfrom
in-app-improvements

Conversation

@mahmoud-elmorabea
Copy link
Contributor

@mahmoud-elmorabea mahmoud-elmorabea commented Jan 21, 2026

This PR solves two issues

Issue: In-App Messaging Fails After clearIdentify()

The issue affects Android and iOS

What Happens
clearIdentify publishes a "reset" event, then generates a new anonymous ID
In-app messaging receives the reset event and clears both userId and anonymousIdThe new anonymous ID is never communicated to in-app messagingAPI requests fail with 400 because no user token is available

Root Cause
Event ordering problem: The reset event is published before the new anonymous ID is generated, and no follow-up event notifies in-app messaging about the new anonymous ID.

Expected vs Actual
Expected: After reset, in-app messaging should use the new anonymous IDActual: In-app messaging has no user token at all, causing 400 errors

The issue only affects the session where the user was identified and then cleared. Once app is killed and re-launched, anonymous messages work again.

Problem: Polling Timer Continues Running in Background

This only affects iOS.

Problem: The polling timer for fetching in-app messages doesn't stop when the app goes to background—it only skips the actual network fetch.
Location: Gist.swift - setupPollingAndFetch() method (line 235) and fetchUserMessages() method (line 262)

What happens:
When polling is active, a repeating Timer.scheduledTimer fires every N seconds
If the user backgrounds the app, the timer continues firing
Each timer fire wakes the main thread, checks applicationState != .background, logs a skip message, and returnsThe timer never actually stops until the app is terminated or SSE takes over

Root cause: The Gist class has no lifecycle observers (background/foreground) to pause and resume the polling timer. It only performs a runtime check inside fetchUserMessages() to skip the work.
Impact:
Unnecessary CPU/battery drain from repeated timer fires in background
Log spam: "Application in background, skipping queue check" logged every poll interval
Potential timer drift/coalescing issues when iOS manages background app state
Inconsistent with SseLifecycleManager which properly stops SSE connections on backgroundContrast with SSE: The SseLifecycleManager correctly observes didEnterBackgroundNotification and willEnterForegroundNotification to stop/start the SSE connection, but the polling timer in Gist lacks equivalent handling


Note

Medium Risk
Touches in-app messaging state/reset flow and iOS app-lifecycle timer behavior; mistakes could cause missed message fetches or incorrect identity usage, but changes are localized and guarded.

Overview
Fixes in-app messaging after clearIdentify() by extending ResetEvent with an optional newAnonymousId, publishing it from the DataPipeline reset hook, and re-seeding Gist’s anonymous identity after reset when provided.

Improves iOS in-app polling efficiency by adding foreground/background lifecycle observers to pause/resume the polling timer, and adds a background-state guard when scheduling the timer to avoid race conditions (SSE still takes precedence when active).

Written by Cursor Bugbot for commit 8106cb7. This will update automatically on new commits. Configure here.

@mahmoud-elmorabea mahmoud-elmorabea self-assigned this Jan 21, 2026
@github-actions
Copy link

github-actions bot commented Jan 21, 2026

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps.
It's recommended to always download the latest builds to test this PR accurately.

@github-actions
Copy link

github-actions bot commented Jan 21, 2026

SDK binary size reports 📊

SDK binary size of this PR
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  17.0%   175Ki  17.0%   175Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/autogenerated/AutoMockable.generated.swift
   5.1%  52.9Ki   5.1%  52.9Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/autogenerated/AutoMockable.generated.swift
   2.7%  28.3Ki   2.7%  28.3Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/autogenerated/AutoMockable.generated.swift
   2.6%  26.4Ki   2.6%  26.4Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/InAppMessageManager.swift
   2.2%  23.1Ki   2.2%  23.1Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/DataPipelineImplementation.swift
   2.2%  22.6Ki   2.2%  22.6Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Communication/Event.swift
   2.2%  22.5Ki   2.2%  22.5Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/SseConnectionManager.swift
   2.0%  21.0Ki   2.0%  21.0Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Migration/autogenerated/AutoMockable.generated.swift
   2.0%  20.6Ki   2.0%  20.6Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/AnonymousMessageManager.swift
   1.9%  19.7Ki   1.9%  19.7Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/autogenerated/AutoDependencyInjection.generated.swift
   1.8%  18.7Ki   1.8%  18.7Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/QueueStorage.swift
   1.7%  17.4Ki   1.7%  17.4Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/InAppMessageState.swift
   1.7%  17.2Ki   1.7%  17.2Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/InAppMessageMiddleware.swift
   1.6%  16.3Ki   1.6%  16.3Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/EngineWeb/AnyEncodable.swift
   1.5%  15.7Ki   1.5%  15.7Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPushAPN/autogenerated/AutoMockable.generated.swift
   1.3%  13.9Ki   1.3%  13.9Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Type/PushNotification.swift
   1.3%  13.8Ki   1.3%  13.8Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/autogenerated/AutoDependencyInjection.generated.swift
   1.1%  11.8Ki   1.1%  11.8Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/SseService.swift
   1.1%  11.4Ki   1.1%  11.4Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Communication/EventStorage.swift
   1.1%  11.0Ki   1.1%  11.0Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Communication/EventBusHandler.swift
   1.0%  10.6Ki   1.0%  10.6Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/SseEventParser.swift
   1.0%  10.3Ki   1.0%  10.3Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/DataPipeline.swift
   1.0%  10.1Ki   1.0%  10.1Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Gist.swift
   1.0%  10.0Ki   1.0%  10.0Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Integration/CioProviderAgnosticAppDelegate.swift
   1.0%  9.82Ki   1.0%  9.82Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/UserNotificationsFramework/Wrappers.swift
   0.9%  9.75Ki   0.9%  9.75Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Utilities/SseLifecycleManager.swift
   0.9%  9.72Ki   0.9%  9.72Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/PushHandling/PushEventHandlerProxy.swift
   0.9%  9.71Ki   0.9%  9.71Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/MessageManager.swift
   0.9%  9.37Ki   0.9%  9.37Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/JsonAdapter.swift
   0.8%  8.71Ki   0.8%  8.71Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/EngineWeb/EngineWeb.swift
   0.8%  8.38Ki   0.8%  8.38Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/SseRetryHelper.swift
   0.8%  8.37Ki   0.8%  8.37Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/CustomerIOInstance.swift
   0.8%  8.03Ki   0.8%  8.03Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Type/QueueTaskMetadata.swift
   0.8%  7.87Ki   0.8%  7.87Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Utilities/URLComponents.swift
   0.8%  7.81Ki   0.8%  7.81Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Communication/EventBus.swift
   0.7%  7.65Ki   0.7%  7.65Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/Request/TrackDeliveryEventRequestBody.swift
   0.7%  7.52Ki   0.7%  7.52Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/Log.swift
   0.7%  7.35Ki   0.7%  7.35Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/KeyValueStorage.swift
   0.7%  7.24Ki   0.7%  7.24Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/QueueManager.swift
   0.7%  7.15Ki   0.7%  7.15Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/autogenerated/AutoDependencyInjection.generated.swift
   0.7%  7.09Ki   0.7%  7.09Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Views/UIKitInline.swift
   0.7%  7.06Ki   0.7%  7.06Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Migration/DataPipelineMigrationAssistant.swift
   0.7%  6.96Ki   0.7%  6.96Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/RichPush/RichPushHttpClient.swift
   0.7%  6.73Ki   0.7%  6.73Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Views/GistInlineInAppMessageView.swift
   0.6%  6.64Ki   0.6%  6.64Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Plugins/AutoTrackingScreenViews.swift
   0.6%  6.43Ki   0.6%  6.43Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/Models/Message.swift
   0.6%  6.32Ki   0.6%  6.32Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/ModalViewManager.swift
   0.6%  6.06Ki   0.6%  6.06Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/InAppMessageReducer.swift
   0.6%  5.87Ki   0.6%  5.87Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/DIManager.swift
   0.6%  5.77Ki   0.6%  5.77Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Store/PushHistory.swift
   0.6%  5.75Ki   0.6%  5.75Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/RichPush/MessagingPush+RichPush.swift
   0.6%  5.71Ki   0.6%  5.71Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/InAppMessageAction.swift
   0.5%  5.15Ki   0.5%  5.15Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Type/QueueTask.swift
   0.5%  5.08Ki   0.5%  5.08Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Views/SwiftUIInline.swift
   0.5%  4.89Ki   0.5%  4.89Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/Response/ErrorMessageResponse.swift
   0.5%  4.87Ki   0.5%  4.87Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/HeartbeatTimer.swift
   0.5%  4.84Ki   0.5%  4.84Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Config/SDKConfigBuilder.swift
   0.5%  4.73Ki   0.5%  4.73Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/autogenerated/AutoMockable.generated.swift
   0.5%  4.72Ki   0.5%  4.72Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Migration/TrackEventMigrationType.swift
   0.4%  4.53Ki   0.4%  4.53Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/AsyncOperation.swift
   0.4%  4.32Ki   0.4%  4.32Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/MessagingPush.swift
   0.4%  4.12Ki   0.4%  4.12Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Views/InlineMessageBridgeView.swift
   0.4%  4.07Ki   0.4%  4.07Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Queue.swift
   0.4%  4.05Ki   0.4%  4.05Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Config/MessagingPushConfigBuilder.swift
   0.4%  3.92Ki   0.4%  3.92Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/Request/MetricRequest.swift
   0.4%  3.86Ki   0.4%  3.86Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/HttpRequestRunner.swift
   0.4%  3.84Ki   0.4%  3.84Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/PushHandling/iOSPushEventListener.swift
   0.3%  3.54Ki   0.3%  3.54Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/GistDelegate.swift
   0.3%  3.48Ki   0.3%  3.48Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Plugins/DataPipelinePublishedEvents.swift
   0.3%  3.32Ki   0.3%  3.32Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Views/GistModalViewController.swift
   0.3%  3.31Ki   0.3%  3.31Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/StringExtensions.swift
   0.3%  3.31Ki   0.3%  3.31Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/Atomic.swift
   0.3%  3.29Ki   0.3%  3.29Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Module/ModuleTopLevelObject.swift
   0.3%  3.27Ki   0.3%  3.27Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Communication/EventMemoryStorage.swift
   0.3%  3.25Ki   0.3%  3.25Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Plugins/DeviceContexualAttributes.swift
   0.3%  3.22Ki   0.3%  3.22Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/EngineWeb/EngineWebConfiguration.swift
   0.3%  3.21Ki   0.3%  3.21Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/MessageTracking.swift
   0.3%  3.09Ki   0.3%  3.09Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/ModalMessageManager.swift
   0.3%  3.05Ki   0.3%  3.05Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/StringAnyEncodable.swift
   0.3%  3.00Ki   0.3%  3.00Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/InlineMessageManager.swift
   0.3%  2.97Ki   0.3%  2.97Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/GistQueueNetwork.swift
   0.3%  2.97Ki   0.3%  2.97Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/MessagingPushImplementation.swift
   0.3%  2.92Ki   0.3%  2.92Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/FileStorage.swift
   0.3%  2.73Ki   0.3%  2.73Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Plugins/Context.swift
   0.3%  2.70Ki   0.3%  2.70Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/DeviceInfo.swift
   0.3%  2.70Ki   0.3%  2.70Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Util/DeviceAttributesProvider.swift
   0.3%  2.58Ki   0.3%  2.58Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/BaseNetwork.swift
   0.2%  2.57Ki   0.2%  2.57Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/HttpRequestError.swift
   0.2%  2.57Ki   0.2%  2.57Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/MessagingInAppImplementation.swift
   0.2%  2.54Ki   0.2%  2.54Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/HttpRequestParams.swift
   0.2%  2.44Ki   0.2%  2.44Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Task Data/DeletePushNotificationQueueTaskData.swift
   0.2%  2.26Ki   0.2%  2.26Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/Core/Subscription.swift
   0.2%  2.25Ki   0.2%  2.25Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/EngineWeb/EngineEventHandler.swift
   0.2%  2.21Ki   0.2%  2.21Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPushAPN/Integration/CioAppDelegateAPN.swift
   0.2%  2.20Ki   0.2%  2.20Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Util/PushNotificationLogger.swift
   0.2%  2.11Ki   0.2%  2.11Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/RichPush/RichPushDeliveryTracker.swift
   0.2%  2.09Ki   0.2%  2.09Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/UserNotificationsFramework/UserNotificationsFrameworkAdapter.swift
   0.2%  2.08Ki   0.2%  2.08Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/LockManager.swift
   0.2%  2.06Ki   0.2%  2.06Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/SdkCommonLoggerLogger.swift
   0.2%  2.04Ki   0.2%  2.04Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/SystemLogger.swift
   0.2%  1.94Ki   0.2%  1.94Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Task Data/IdentifyProfileQueueTaskData.swift
   0.2%  1.89Ki   0.2%  1.89Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Util/DictionarySanitizer.swift
   0.2%  1.82Ki   0.2%  1.82Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Type/QueueTaskRunResults.swift
   0.2%  1.81Ki   0.2%  1.81Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/autogenerated/AutoDependencyInjection.generated.swift
   0.2%  1.78Ki   0.2%  1.78Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/CustomerIO+Events.swift
   0.2%  1.67Ki   0.2%  1.67Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/MessagingInApp.swift
   0.2%  1.66Ki   0.2%  1.66Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Task Data/RegisterPushNotificationQueueTaskData.swift
   0.2%  1.60Ki   0.2%  1.60Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/DictionaryExtension.swift
   0.1%  1.52Ki   0.1%  1.52Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/PushHandling/PushClickHandler.swift
   0.1%  1.47Ki   0.1%  1.47Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Util/DataPipelinesLogger.swift
   0.1%  1.44Ki   0.1%  1.44Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Task Data/TrackEventQueueTaskData.swift
   0.1%  1.43Ki   0.1%  1.43Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/PushHandling/ManualPushHandling+UserNotifications.swift
   0.1%  1.38Ki   0.1%  1.38Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/DateExtensions.swift
   0.1%  1.37Ki   0.1%  1.37Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Extensions/GistExtensions.swift
   0.1%  1.37Ki   0.1%  1.37Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Utilities/UIColor+Hex.swift
   0.1%  1.37Ki   0.1%  1.37Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Views/GistView.swift
   0.1%  1.30Ki   0.1%  1.30Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/Models/UserQueueResponse.swift
   0.1%  1.29Ki   0.1%  1.29Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Config/MessagingInAppConfigBuilder.swift
   0.1%  1.29Ki   0.1%  1.29Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/RichPush/RichPushRequest.swift
   0.1%  1.21Ki   0.1%  1.21Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/SdkClient.swift
   0.1%  1.21Ki   0.1%  1.21Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/ThreadUtil.swift
   0.1%  1.21Ki   0.1%  1.21Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/UIKitWrapper.swift
   0.1%  1.14Ki   0.1%  1.14Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/Request/PushMetric.swift
   0.1%  1.10Ki   0.1%  1.10Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/Mocks.swift
   0.1%  1.05Ki   0.1%  1.05Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/CustomerIO+Segment.swift
   0.1%  1.04Ki   0.1%  1.04Ki    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/CustomerIO.swift
   0.1%    1024   0.1%    1024    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/DeviceExtension.swift
   0.1%    1008   0.1%    1008    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Store/GlobalDataStore.swift
   0.1%    1008   0.1%    1008    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Config/DataPipelineConfigOptions.swift
   0.1%     984   0.1%     984    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/Request/InAppMetric.swift
   0.1%     952   0.1%     952    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/CIOApiEndpoint.swift
   0.1%     876   0.1%     876    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/UserAgentUtil.swift
   0.1%     868   0.1%     868    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Type/ScreenView.swift
   0.1%     852   0.1%     852    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Type/QueueTaskType.swift
   0.1%     796   0.1%     796    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPushAPN/MessagingPushAPN+PushConfigs.swift
   0.1%     792   0.1%     792    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/AnyEncodable.swift
   0.1%     756   0.1%     756    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Store/SdkConfig.swift
   0.1%     708   0.1%     708    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Type/CustomerIOParsedPushPayload.swift
   0.1%     684   0.1%     684    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPushAPN/MessagingPush+APN.swift
   0.1%     672   0.1%     672    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPushAPN/MessagingPushAPN.swift
   0.1%     636   0.1%     636    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Type/InAppMessage.swift
   0.1%     612   0.1%     612    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/DeepLinkUtil.swift
   0.1%     580   0.1%     580    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Utilities/Environment.swift
   0.1%     548   0.1%     548    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Config/MessagingPushConfigOptions.swift
   0.1%     544   0.1%     544    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/Request/EmptyRequestBody.swift
   0.0%     528   0.0%     528    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/Utilities/HTTPMethod.swift
   0.0%     508   0.0%     508    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/UIKitExtensions.swift
   0.0%     508   0.0%     508    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/KeyValueStorageKey.swift
   0.0%     504   0.0%     504    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Type/Region.swift
   0.0%     488   0.0%     488    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Background Queue/Type/QueueStatus.swift
   0.0%     468   0.0%     468    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Plugins/ScreenFilterPlugin.swift
   0.0%     460   0.0%     460    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Utilities/Encodable.swift
   0.0%     452   0.0%     452    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/Endpoints/LogEndpoint.swift
   0.0%     440   0.0%     440    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Store/ProfileStore.swift
   0.0%     432   0.0%     432    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/RingBuffer.swift
   0.0%     416   0.0%     416    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/Utilities/ElapsedTimer.swift
   0.0%     392   0.0%     392    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Plugins/Logger.swift
   0.0%     384   0.0%     384    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/Core/Store.swift
   0.0%     380   0.0%     380    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/ArrayExtensions.swift
   0.0%     380   0.0%     380    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/Core/StoreSubscriber.swift
   0.0%     348   0.0%     348    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Managers/LogManager.swift
   0.0%     244   0.0%     244    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/DIGraphShared.swift
   0.0%     236   0.0%     236    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/RetryDecision.swift
   0.0%     228   0.0%     228    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SessionManager.swift
   0.0%     220   0.0%     220    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/Util/NotificationCenterWrapper.swift
   0.0%     208   0.0%     208    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/Sleeper.swift
   0.0%     196   0.0%     196    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/RichPush/RichPushRequestHandler.swift
   0.0%     180   0.0%     180    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/DeviceMetricsGrabber.swift
   0.0%     180   0.0%     180    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Extensions/LoggerExtensions.swift
   0.0%     164   0.0%     164    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Store/QueueInventoryMemoryStore.swift
   0.0%     148   0.0%     148    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingPush/PushHandling/AutomaticPushClickHandling.swift
   0.0%     144   0.0%     144    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/Endpoints/QueueEndpoint.swift
   0.0%     140   0.0%     140    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/Lock.swift
   0.0%     128   0.0%     128    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/Timer.swift
   0.0%     120   0.0%     120    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/DataExtensions.swift
   0.0%     116   0.0%     116    /Users/runner/work/customerio-ios/customerio-ios/Sources/DataPipeline/Plugins/CustomerIODestination.swift
   0.0%     116   0.0%     116    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/Aliases.swift
   0.0%     104   0.0%     104    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Utilities/ApplicationStateProvider.swift
   0.0%      84   0.0%      84    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Service/DownloadFileType.swift
   0.0%      84   0.0%      84    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/Endpoints/Utilities/GistNetworkRequestError.swift
   0.0%      84   0.0%      84    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/SSE/SseConnectionState.swift
   0.0%      68   0.0%      68    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/Network/NetworkSettings.swift
   0.0%      44   0.0%      44    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Config/MessagingInAppConfigOptions.swift
   0.0%      36   0.0%      36    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/DateUtil.swift
   0.0%      36   0.0%      36    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/Time.swift
   0.0%      32   0.0%      32    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Util/SingleScheduleTimer.swift
   0.0%      32   0.0%      32    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/Gist/EngineWeb/EngineWebProvider.swift
   0.0%      32   0.0%      32    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/InAppMessageStore.swift
   0.0%      28   0.0%      28    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Version.swift
   0.0%      12   0.0%      12    /Users/runner/work/customerio-ios/customerio-ios/Sources/MessagingInApp/State/Core/Synchronized.swift
   0.0%       8   0.0%       8    /Users/runner/work/customerio-ios/customerio-ios/Sources/Common/Extensions/ErrorExtension.swift
 100.0%  1.01Mi 100.0%  1.01Mi    TOTAL
Filtering enabled (source_filter); omitted file = 2.08Mi, vm = 2.18Mi of entries

SDK binary size diff report vs. main branch
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL
Filtering enabled (source_filter); omitted file = 2.09Mi, vm = 2.19Mi of entries

@mahmoud-elmorabea mahmoud-elmorabea marked this pull request as ready for review February 2, 2026 06:19
@mahmoud-elmorabea mahmoud-elmorabea requested a review from a team as a code owner February 2, 2026 06:19
@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 88.73239% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.14%. Comparing base (c8345c5) to head (e66d0a4).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
Sources/MessagingInApp/Gist/Gist.swift 91.22% 5 Missing ⚠️
.../MessagingInApp/MessagingInAppImplementation.swift 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #980      +/-   ##
==========================================
- Coverage   68.33%   68.14%   -0.19%     
==========================================
  Files         182      182              
  Lines        9420     9524     +104     
==========================================
+ Hits         6437     6490      +53     
- Misses       2983     3034      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Copy link
Contributor

@mrehan27 mrehan27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Just two things before we merge, CI is failing and needs to be fixed if relevant (or may be rerun). And there's no test coverage for the new code, I believe we should add tests for both Reset Event and Lifecycle handling before merging.

// Pass the new anonymous ID with the reset event so in-app messaging
// can continue fetching messages for the anonymous user after reset.
let newAnonymousId = analytics?.anonymousId
eventBusHandler.postEvent(ResetEvent(newAnonymousId: newAnonymousId))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also add a test to verify this?

// MARK: - App Lifecycle & SSE State Handling

private extension Gist {
func setupLifecycleObservers() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some tests for these?

if state.shouldUseSse {
logger.logWithModuleTag("Gist: SSE enabled for identified user - stopping polling timer", level: .info)
invalidateTimer()
} else if !state.useSse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this might be outside the scope of this PR and coming from earlier changes, but looking through the code here, shouldUseSse and useSse flags are quite confusing. It would be nice to refactor them to more descriptive names in a separate PR so the expectations are clearer for callers like this one.

@mahmoud-elmorabea mahmoud-elmorabea marked this pull request as draft February 16, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants