Commit Graph
32 Commits
Author SHA1 Message Date
Michael Haney e403d965d5 Fix a couple of race conditions and module import of a private header (#5187)
* Fix a couple of race conditions and module import of a private header

The header and API in question should be considered hidden. An alternative would be expose the API in the private header .

A race condition existed in the upload package itself--it should hand copies of itself and not self to prevent asynchronous mutation whilst a different queue is also executing an asynchronous mutation. One alternative would be to create mutable an immutable variants of the package. This could manifest as an EXC_BAD_ACCESS in GDTCCTPrioritizer.m

* Assert that the IMP is present, because there shouldn't be a silent failure
2020-03-25 11:10:56 -07:00
Michael Haney 4e900ca551 Address GDT test issues (#5186)
* Address GDT test issues

1. Fixes the event  generator such that derived event fileURL will now be non-nil
2. Removes reachability check for integration tests since being locally connected via LAN but not connected to the internet would cause the test disabling check to pass. Instead, we attempt an actual NSURLRequest to a WAN target and set the value based on the success of that request.

* Create GDT's directory on first usage
2020-03-24 17:35:33 -07:00
Michael Haney ea3521d263 Only delete events when package was successfully delivered (#5172)
* Only delete events when package was successfully delivered

* Add unit test to check that retrying a package delivery doesn't delete an event file
2020-03-23 14:11:40 -07:00
Michael Haney aeb4def61d Libraries should save state if a completion block is requested (#5147)
* Libraries should save state if a completion block is requested

Currently, the onComplete block of sendXEvent:onComplete: is invoked when the event bytes are written to disk. However, if the app crashes before a lifecycle event occurs (trigger GDTCORStorage to serialize to disk), that event if effectively lost because the metadata has all been lost. This change triggers the saving of state of GDTCORStorage and prioritizers (if they implement it) if an onComplete block has been given.

* Remove flaky check

* Update GDTCORStorage.m
2020-03-18 15:00:37 -07:00
Michael Haney 27847eea38 Refactor event fileURLs to be derived (#5137)
* Refactor event fileURLs to be derived

Apparently, since iOS 8, it's possible for the app's bundle to change directories as often as every launch. This is a mechanism that's hopefully slightly more robust against that, as data is supposed to carry over, the UUID component of the app's absolute directory might just change.

* Convert a couple of tests, actually use a non-absolute URL in GDTCOREvent

* Make sure to use the event fileURL property as the source of truth.

Add some additional logs and improve the integration test

* Fix KVC not working for the removed property
2020-03-18 08:09:18 -07:00
Michael Haney 4ee3288747 Fix deprecation warnings by consolidating coding calls (#5131)
* Fix deprecation warnings by consolidating coding calls

Fixes #5086

* Fix all NSSecureCoding references

* Fix changed API usage
2020-03-17 19:06:05 -07:00
Michael Haney 9e758c09f4 Don't attempt to create data if the event's fileURL is nil. (#5088)
* Don't attempt to create data if the event's fileURL is nil.

This could be because of changes to NSCoding w.r.t. transitioning from GDTCORStoredEvent to GDTCOREvent.

* Attempt to address sudden analyzer issues

* Don't pass nil to a function that requires non-nil arguments.

* Change error code to the new GDTCORMCEFileReadError
2020-03-12 15:02:41 -07:00
Michael Haney eae70b5845 Fix assertions not printing correctlty (#5026) 2020-03-06 09:10:46 -08:00
Michael Haney 1cca0bcd8c Make GDTCORReachability a public API for support libraries (#4969) 2020-02-25 11:39:27 -08:00
Doudou Nan 4149226e7b Wrap SCNetworkReachabilityFlags and fix Catalyst warning (#4965)
* wrap apis and fix catalyst warning

* styled

* add watchos

* letters change
2020-02-25 11:14:41 -08:00
Doudou Nan 88028e20ad Fix radioacesstechnology api deprecated for ios 12.0 or newer (#4960)
* update radio access technology for ios 13

* set version check to 12.0

* styled

* change empty check of dict
2020-02-24 11:42:37 -08:00
Michael Haney 65dafbb199 Fix an import to be non-public (#4959) 2020-02-24 10:09:08 -08:00
Doudou Nan 65def8187d Generate network_connection_info and add tests (#4944)
* Populate network_connection_info and add test

* Wrap build-in api in GDTCORPlatform and other changes

* Set GDT_VERBOSE_LOGGING back to 0

* Add several check points for nil value

* tiny change import of nanopbhelper.m

* comments and typos
2020-02-21 15:48:50 -08:00
Doudou Nan a7eaac44d4 Use callback flags in reachability instead of the initial flags (#4949)
* Use callback flags in reachability instead of the initial flags

* styled
2020-02-21 09:56:18 -08:00
Doudou Nan d69c642277 Delete GDTCORStoredEvent, modify apis and tests (#4880)
* Delete GDTCORStoredEvent, modify apis and tests

* styled

* Delete GDTCORDataFuture

* header changes

* add writeToURL in COREvent

* Remove dataObjectTransportBytes property in COREvent

* Set fileURL in COREvent nullable

* Change method writeToURL private and modify comments

* Modify encoding keys in GDTCORStorage and GDTCORUploadPackage

* comments and headers changes

* testMigration passed without fileURL

* Regression test passed with retrieving fileURL

* styled and added fileURL NOTNIL assert in test

* Modify backwords compatibility of GDTCORStoredEvent decoding

* Comments changes

* Add GDTCOREvent translation mapping in UploadPackage
2020-02-18 16:09:07 -08:00
Michael Haney 2e9bc30b98 Fixes appWillTerminate not running on GDTStorage's queue (#4879)
* Fixes appWillTerminate not running on GDTStorage's queue

Fixes #4546

Thanks @plu for the test case!

* Use the correct lifecycle event.

* Additional comments.
2020-02-10 13:28:27 -08:00
Michael Haney f138a75a33 Add a storage completion handler to the event transport pipeline (#4794) 2020-02-03 08:15:31 -08:00
Michael Haney 1a47804d0e Consolidate the CCT, FLL, and new CSH backends (#4779)
* Consolidate the CCT, FLL, and new CSH backends

The same object will now manage all 3 backends

* Update comment
2020-01-30 11:29:16 -08:00
Michael Haney ade283450d Change GDTCORUploader and GDTCORPrioritizer APIs (#4766)
from readyToUploaderWithConditions: to readyToUploadTarget:conditions: in order to allow the same object to act as an uploader for multiple targets.

similarly, uploadPackageWithConditions: to uploadPackageWithTarget:conditions:

Deletes support and tests for the FLL backend,  since it's being rolled into the CCT uploader and prioritizer objects.
2020-01-28 17:59:42 -08:00
Michael Haney 0dea8a64c3 Add extensive debug logging (#4704)
* Add extensive debug logging

This is to help adopters understand what the state of the library is

* Fix variable type
2020-01-20 14:50:44 -08:00
Chen Liang e4456c011b Enables Firebase Messaging push notification function on watch only and independent watch app (#4016) 2019-12-23 16:45:19 -08:00
Michael Haney 842439bea9 Fix a public import of a private header (#4378) 2019-11-21 14:55:12 -08:00
Michael Haney efbf9bdf1d Send diagnostic data to the FLL backend instead of the CCT backend (#4196)
* Send diagnostic data to the FLL backend instead of the CCT backend

* Handle FLL redirects and set the User-Agent

The podspec now surfaces the SDK version.

* Add unit tests for handling redirects
2019-11-15 01:30:19 -08:00
Michael Haney 8c0ab30279 Address issues found by repeated tsan runs (#4202) 2019-10-31 11:25:37 -07:00
Michael Haney 3943cb16f9 Fix sanitizer issues (#4043)
Fixes #4039
Fixes #4027
2019-10-10 13:30:34 -07:00
Michael Haney aef5c36bd4 Fix threading issue with ivar access in GDTCORUploadCoordinator (#4023)
* Make mph-gdtsqlite run travis (#3861)

* Put upload coordinator encoding and decoding on the queue

* Fix main-thread access in the test app

* Remove accidental change to travis.yml
2019-10-09 10:37:22 -07:00
Ryan Wilson 4c4ba12b60 Fix main thread crashing issue, reenable tests. (#3974)
* Fix main thread crashing issue, reenable tests.

* Added log, extra check for event generation to prevent early exit.

* Temporarily run cron tests for travis.

* Revert travis.yml update

* Change property to atomic based on review comments.
2019-10-02 15:10:28 -04:00
Ryan Wilson 03ecafd06d Refactor GDT Backgrounding (#3896)
* Fix missing `runningInBackground` flags.

* Attempt at fixing background issues with GDT.

* Add missing deprecated implementation.

* Transfer extra call to background call.

* Style

* Further review comments.

* Fix testing.

* Refactored FLLIntegrationTest.

This does a few things - split the tests into a specific multithreaded
test and a recursive run without crashing.

It also adds a notification for the upload to post how many events were
uploaded. This should be a bit more reliable and helps the overall
validation during the "run without crashing" test.

* Removed extra log.

* Fix flag for Catalyst.

* Disable currently non-functional test.

* Further review comments.

* Migrate CCT tests to match FLL.

* Revert accidental partial change.

* Clarify comment for starting the background tasks.

* Review feedback, changelog additions and bug numbers.
2019-10-02 10:40:45 -04:00
Paul Beusterien 4a8ee3de60 Fix Catalyst define checks (#3958) 2019-09-30 16:37:21 -07:00
Paul Beusterien 22928dd30e Fix ubsan issues in GDT (#3910) 2019-09-23 15:41:58 -07:00
Michael Haney 2dde2e2aa7 Add support for FLL (#3867)
All data format is with regard to CCT, so renaming wasn't very necessary except in tests.

- Ensures that test event generation creates files, not uses existing ones
- Implements prioritizer and uploader for FLL server
  - Main diff from CCT is needing gzipped data and api key
- With the sqlite refactor, this will be more consolidated
2019-09-18 01:11:02 -07:00
Michael Haney 18e2721c1d Rename GDT core libraries to GDTCOR (#3808) 2019-09-09 15:21:29 -07:00