Create a class called RepeatingTimer that uses DispatchSource, moving all the logic from the BTAnalyticsService class. This way, we can reuse the same logic wherever needed. This class ensures it can be properly deallocated from memory or the implementation of pause/resume functionality. Also, RepeatingTimer aims to fix an intermittent crash.
Steps to reproduce the crash:
Xcode 15.4iOS 17.2Simulator iPhone 14
This branch was created where the APIClient and PaymentClient are instantiated almost at the same time, based on a potential implementation by the merchants. The steps to reproduce the crash are to tokenize and then cancel (crash is very intermittent, so you'll need to run the application multiple times and follow the tokenization process repeatedly).
Update: This branch includes the changes from the branch that reproduces the crash, as well as the changes from this branch.
Summary of changes
RepeatingTimer
that usesDispatchSource
, moving all the logic from theBTAnalyticsService
class. This way, we can reuse the same logic wherever needed. This class ensures it can be properly deallocated from memory or the implementation of pause/resume functionality. Also,RepeatingTimer
aims to fix an intermittent crash.Steps to reproduce the crash:
Xcode 15.4
iOS 17.2
Simulator iPhone 14
This branch was created where the
APIClient
andPaymentClient
are instantiated almost at the same time, based on a potential implementation by the merchants. The steps to reproduce the crash are totokenize
and thencancel
(crash is very intermittent, so you'll need to run the application multiple times and follow the tokenization process repeatedly).Update: This branch includes the changes from the branch that reproduces the crash, as well as the changes from this branch.
Checklist
Authors