parse-community / Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
https://parseplatform.org
MIT License
306 stars 69 forks source link

feat: allow any dimension value for ParseAnalytics #341

Closed cbaker6 closed 2 years ago

cbaker6 commented 2 years ago

New Pull Request Checklist

Issue Description

Dimension values currently can only be String type. This use to be the requirement for the original Parse Server, but some analytics adapters can support types other than String. The Swift Client should allow any type of dimension value.

Also the developer should be responsible for requesting tracking authorization when sending analytics to other companies instead of the SDK.

Related issue: #n/a

Approach

Let the OS and developer decide if app tracking authorization is required when using ParseAnalytics. ParseAnalytics can now take any Codable value in its' dimensions instead of just strings. Added a new property date to ParseAnalytics. The at property will be deprecated in ParseSwift 5.0.0, so developers should switch to date. ParseAnalytics can now be properly decoded after encoding with a JSONEncoder. This is useful if ParseAnalytics type need to be stored locally and sent to the server later.

TODOs before merging

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this pull request!

codecov[bot] commented 2 years ago

Codecov Report

Merging #341 (4caeb51) into main (5307210) will decrease coverage by 0.02%. The diff coverage is 96.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #341      +/-   ##
==========================================
- Coverage   85.19%   85.16%   -0.03%     
==========================================
  Files         114      114              
  Lines       12208    12195      -13     
==========================================
- Hits        10400    10386      -14     
- Misses       1808     1809       +1     
Impacted Files Coverage Δ
Sources/ParseSwift/Coding/ParseEncoder.swift 74.91% <ø> (ø)
...es/ParseSwift/LiveQuery/ParseLiveQuery+async.swift 72.72% <ø> (ø)
.../ParseSwift/LiveQuery/ParseLiveQuery+combine.swift 72.72% <ø> (ø)
Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift 72.92% <ø> (-0.60%) :arrow_down:
Sources/ParseSwift/Types/ParseACL.swift 89.91% <50.00%> (+2.25%) :arrow_up:
Sources/ParseSwift/Objects/ParseRole.swift 100.00% <100.00%> (ø)
...ources/ParseSwift/Types/ParseAnalytics+async.swift 90.47% <100.00%> (+0.47%) :arrow_up:
Sources/ParseSwift/Types/ParseAnalytics.swift 97.12% <100.00%> (-0.33%) :arrow_down:
Sources/ParseSwift/Objects/ParseUser.swift 83.00% <0.00%> (-0.18%) :arrow_down:
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5307210...4caeb51. Read the comment docs.