adobe / aepsdk-core-ios

Adobe Experience Platform Mobile Core SDK in Swift
Apache License 2.0
23 stars 39 forks source link

implement app state detection #229

Closed shalehaha closed 2 years ago

shalehaha commented 3 years ago

similar thing as the current ADBSystemNotificationHandler, but should make it cleaner.

nporter-adbe commented 3 years ago

@shalehaha where will this be used?

shalehaha commented 3 years ago

the cp metric in Analytics request

nporter-adbe commented 3 years ago

Talked with the team implementing Analytics and since we are in Swift/native code it might be overkill to have a dedicated service to read the app state. For now, we are deferring this service in favor of just reading the app state directly [[UIApplication sharedApplication] applicationState].

shalehaha commented 3 years ago

@nporter-adbe it works for now, but I guess eventually we might still want to provide something in Services where we listen for the notifications. We can wait to see how Analytics will be implementing it.

  1. [[UIApplication sharedApplication] applicationState] needs to run on the main thread, it might be not easy for an extension to run it on the main thread, and after that switch back to the extension thread (Semaphore can be used here, but not elegent). Also, it is not a good practice to keep bothering the main thread unless necessary.
  2. Watch doesn't support this API, so we will need to use Macros to maintain the code in the future.
praveek commented 2 years ago

This functionality is currently not needed by other extensions. We can reopen this if needed.