Iterable / swift-sdk

Iterable's iOS SDK. Receive and track pushes to Iterable from your iOS app.
https://iterable.com/
MIT License
86 stars 67 forks source link

[MOB - 6583] - No Offline Components when Online-Only #664

Closed Ayyanchira closed 11 months ago

Ayyanchira commented 11 months ago

🔹 Jira Ticket(s)

✏️ Description

  1. Turned the default value to false instead of true. Only once the response comes back as true, the value will be set to true. Subsequent launches will respect whats stored after that. There will not be a toggling happening every now and then. Once the response from server is received as true, its stored in the sdk.
  2. Create RequestHandler initializes both online and offline request Handler irrespective of the feature enabled or disabled. Added lazy var for offlineprocessor and initializing offline componenents only when offlineMode is true.

This change will make sure that components like TaskSchedular and HealthMonitor will not be even initialized unless offlineMode is true. However, this change does not engage offlineMode immediately after the response is received as true as creation of request handler has already passed and only a fresh launch of app can then go through offline request processor.

Additional changes are needed to make sure offlineMode when accessed, initializes its component and not when requestHandler is initialized. That will keep the offline component encapsulated within offline flow.