Skip to content

AdServices: Rename postAdServicesTokenIfNeeded() to postAdServicesTokenOncePerInstallIfNeeded()#2968

Merged
joshdholtz merged 2 commits into
mainfrom
rename-postAdServicesTokenIfNeeded-for-clarity
Aug 7, 2023
Merged

AdServices: Rename postAdServicesTokenIfNeeded() to postAdServicesTokenOncePerInstallIfNeeded()#2968
joshdholtz merged 2 commits into
mainfrom
rename-postAdServicesTokenIfNeeded-for-clarity

Conversation

@joshdholtz

@joshdholtz joshdholtz commented Aug 4, 2023

Copy link
Copy Markdown
Member

Motivation

It was not clear what postAdServicesTokenIfNeeded() was doing for anybody unfamiliar with our codebase or AdServices. This method is in applicationWillEnterForeground and without digging into any of the implementation, it looks like it could send the attribution token every time the app enters the foreground.

The behavior was actually only sending it once per install (as it should) so the method rename reflects that.

Description

Renames postAdServicesTokenIfNeeded() to postAdServicesTokenOncePerInstallIfNeeded()

@joshdholtz joshdholtz requested review from a team and aboedo August 4, 2023 15:43
@joshdholtz joshdholtz added the pr:fix A bug fix label Aug 4, 2023

@NachoSoto NachoSoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think postAdServicesTokenOncePerInstallIfNeeded (without only) is a bit clearer, but this is good too.

@NachoSoto NachoSoto added refactor and removed pr:fix A bug fix labels Aug 4, 2023
@NachoSoto

Copy link
Copy Markdown
Contributor

Did you mean to make this a "fix"? I changed it to refactor 😇

@codecov

codecov Bot commented Aug 4, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2968 (16506ee) into main (f4fa4d2) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2968      +/-   ##
==========================================
- Coverage   86.60%   86.57%   -0.04%     
==========================================
  Files         217      217              
  Lines       15517    15517              
==========================================
- Hits        13439    13434       -5     
- Misses       2078     2083       +5     
Files Changed Coverage Δ
Sources/Attribution/AttributionPoster.swift 93.29% <100.00%> (ø)
Sources/Purchasing/Purchases/Attribution.swift 93.44% <100.00%> (ø)
Sources/Purchasing/Purchases/Purchases.swift 75.94% <100.00%> (ø)

... and 3 files with indirect coverage changes

@joshdholtz joshdholtz changed the title AdServices: Rename postAdServicesTokenIfNeeded() to postAdServicesTokenOnlyOncePerInstallIfNeeded() AdServices: Rename postAdServicesTokenIfNeeded() to postAdServicesTokenOncePerInstallIfNeeded() Aug 4, 2023
@joshdholtz joshdholtz merged commit 375cd97 into main Aug 7, 2023
@joshdholtz joshdholtz deleted the rename-postAdServicesTokenIfNeeded-for-clarity branch August 7, 2023 15:06
NachoSoto added a commit that referenced this pull request Aug 9, 2023
_This release is compatible with Xcode 15 beta 6 and visionOS beta 3_

### Bugfixes
* `visionOS`: support for `Xcode 15 beta 6` (#2989) via NachoSoto
(@NachoSoto)
* `CachingProductsManager`: avoid crash when caching different products
with same identifier (#2979) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: disambiguate transactions from the queue
(#2890) via NachoSoto (@NachoSoto)
### Performance Improvements
* `StoreKit2TransactionListener`: handle transactions asynchronously
(#2910) via NachoSoto (@NachoSoto)
### Other Changes
* `Atomic`: avoid race conditions modifying dictionaries (#2981) via
NachoSoto (@NachoSoto)
* `Logging`: avoid logging "updating offerings" when request is cached
(#2904) via NachoSoto (@NachoSoto)
* `StoreKit2TransactionListener`: converted into an `actor` (#2909) via
NachoSoto (@NachoSoto)
* `Integration Tests`: added more observer mode tests (#2905) via
NachoSoto (@NachoSoto)
* Created `PostedTransactionCache` (#2911) via NachoSoto (@NachoSoto)
* `IntroEligibility`: changed products to `Set<String>` (#2976) via
NachoSoto (@NachoSoto)
* `AdServices`: Rename `postAdServicesTokenIfNeeded()` to
`postAdServicesTokenOncePerInstallIfNeeded()` (#2968) via Josh Holtz
(@joshdholtz)
* `SK1StoreProduct`: changed `productType` warning to debug (#2957) via
NachoSoto (@NachoSoto)
* `PrivacyInfo.xcprivacy`: added `UserDefaults` to access API types
(#2913) via NachoSoto (@NachoSoto)
* `Integration Tests`: new test to verify that SK1 purchases don't leave
SK2 unfinished transactions (#2906) via NachoSoto (@NachoSoto)
* `Logging`: log entire cache key with verbose logs (#2888) via
NachoSoto (@NachoSoto)
* `StoreProduct`: added test covering warning log (#2897) via NachoSoto
(@NachoSoto)
* `CustomEntitlementComputation`: use custom API key (#2879) via Toni
Rico (@tonidero)
* `CachingProductsManager`: removed duplicate log and added tests
(#2898) via NachoSoto (@NachoSoto)
* `Xcode 15 beta 5`: fixed test compilation (#2885) via NachoSoto
(@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
…esTokenOncePerInstallIfNeeded()` (#2968)

### Motivation

It was not clear what `postAdServicesTokenIfNeeded()` was doing for
anybody unfamiliar with our codebase or AdServices. This method is in
`applicationWillEnterForeground` and without digging into any of the
implementation, it looks like it could send the attribution token every
time the app enters the foreground.

The behavior was actually only sending it once per install (as it
should) so the method rename reflects that.

### Description
Renames `postAdServicesTokenIfNeeded()` to
`postAdServicesTokenOncePerInstallIfNeeded()`
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
_This release is compatible with Xcode 15 beta 6 and visionOS beta 3_

### Bugfixes
* `visionOS`: support for `Xcode 15 beta 6` (#2989) via NachoSoto
(@NachoSoto)
* `CachingProductsManager`: avoid crash when caching different products
with same identifier (#2979) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: disambiguate transactions from the queue
(#2890) via NachoSoto (@NachoSoto)
### Performance Improvements
* `StoreKit2TransactionListener`: handle transactions asynchronously
(#2910) via NachoSoto (@NachoSoto)
### Other Changes
* `Atomic`: avoid race conditions modifying dictionaries (#2981) via
NachoSoto (@NachoSoto)
* `Logging`: avoid logging "updating offerings" when request is cached
(#2904) via NachoSoto (@NachoSoto)
* `StoreKit2TransactionListener`: converted into an `actor` (#2909) via
NachoSoto (@NachoSoto)
* `Integration Tests`: added more observer mode tests (#2905) via
NachoSoto (@NachoSoto)
* Created `PostedTransactionCache` (#2911) via NachoSoto (@NachoSoto)
* `IntroEligibility`: changed products to `Set<String>` (#2976) via
NachoSoto (@NachoSoto)
* `AdServices`: Rename `postAdServicesTokenIfNeeded()` to
`postAdServicesTokenOncePerInstallIfNeeded()` (#2968) via Josh Holtz
(@joshdholtz)
* `SK1StoreProduct`: changed `productType` warning to debug (#2957) via
NachoSoto (@NachoSoto)
* `PrivacyInfo.xcprivacy`: added `UserDefaults` to access API types
(#2913) via NachoSoto (@NachoSoto)
* `Integration Tests`: new test to verify that SK1 purchases don't leave
SK2 unfinished transactions (#2906) via NachoSoto (@NachoSoto)
* `Logging`: log entire cache key with verbose logs (#2888) via
NachoSoto (@NachoSoto)
* `StoreProduct`: added test covering warning log (#2897) via NachoSoto
(@NachoSoto)
* `CustomEntitlementComputation`: use custom API key (#2879) via Toni
Rico (@tonidero)
* `CachingProductsManager`: removed duplicate log and added tests
(#2898) via NachoSoto (@NachoSoto)
* `Xcode 15 beta 5`: fixed test compilation (#2885) via NachoSoto
(@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants