amplify-swift icon indicating copy to clipboard operation
amplify-swift copied to clipboard

feat(Analytics): Adding cross-platform support

Open sebaland opened this issue 3 years ago • 0 comments

Description of changes:

Adding support for cross-platform builds to Analytics:

  • Implementing a Combine-free alternative to the State Machine implementation that is used for Session Tracking.
  • Renaming UIActivityTracker to just ActivityTracker, supporting tracking for both mobile and desktop apps
    • Defaulting the background tracking timeout on macOS to .infinite, i.e. no timeout at all.
  • Following what JS does and after agreeing with Flutter, we will only be recording session start and stop events for desktop apps. This change is done in SessionClient, so that ActivityTracker does not have this business logic.
  • Using the new DeviceInfo struct to retrieve information about the device. Renamed the old Device protocol to a more fitting EndpointInformation and kept it around for testing purposes.

Check points: (check or cross out if not relevant)

  • [ ] ~Added new tests to cover change, if needed~
  • [X] Build succeeds with all target using Swift Package Manager
  • [X] All unit tests pass
  • [ ] ~All integration tests pass~
  • [X] Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • [ ] ~Documentation update for the change if required~
  • [X] PR title conforms to conventional commit style
  • [X] ~If breaking change, documentation/changelog update with migration instructions~

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

sebaland avatar Aug 12 '22 15:08 sebaland