[go: nahoru, domu]

[iOS] Add campaign token to StoreKit VC for Save to Photos

This CL sets the SKStoreProductParameterCampaignToken used by StoreKit
when Save to Photos presents the StoreKit VC with the Photos app so the
number of times the Photos app is installed from Chrome can be counted.

Fixed: 1493955
Change-Id: I2bb161c4c98b5911807e542f0511f0c8d7fead66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4952501
Commit-Queue: Quentin Pubert <qpubert@google.com>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1212636}
diff --git a/ios/chrome/browser/ui/save_to_photos/save_to_photos_mediator.mm b/ios/chrome/browser/ui/save_to_photos/save_to_photos_mediator.mm
index ba8a6619..afdd0db 100644
--- a/ios/chrome/browser/ui/save_to_photos/save_to_photos_mediator.mm
+++ b/ios/chrome/browser/ui/save_to_photos/save_to_photos_mediator.mm
@@ -27,13 +27,6 @@
 
 namespace {
 
-NSString* const kGooglePhotosAppProductIdentifier = @"962194608";
-
-NSString* const kGooglePhotosRecentlyAddedURLString =
-    @"https://photos.google.com/search/_tra_?obfsgid=";
-
-NSString* const kGooglePhotosAppURLScheme = @"googlephotos";
-
 NSURL* GetGooglePhotosAppURL() {
   NSURLComponents* photosAppURLComponents = [[NSURLComponents alloc] init];
   photosAppURLComponents.scheme = kGooglePhotosAppURLScheme;
@@ -59,6 +52,15 @@
 
 }  // namespace
 
+NSString* const kGooglePhotosAppProductIdentifier = @"962194608";
+
+NSString* const kGooglePhotosStoreKitCampaignToken = @"chrome-x-photos";
+
+NSString* const kGooglePhotosRecentlyAddedURLString =
+    @"https://photos.google.com/search/_tra_?obfsgid=";
+
+NSString* const kGooglePhotosAppURLScheme = @"googlephotos";
+
 @implementation SaveToPhotosMediator {
   PhotosService* _photosService;
   PrefService* _prefService;
@@ -406,7 +408,8 @@
   // If the Photos app is not installed, show StoreKit.
   if (![UIApplication.sharedApplication canOpenURL:GetGooglePhotosAppURL()]) {
     [self.delegate
-        showStoreKitWithProductIdentifier:kGooglePhotosAppProductIdentifier];
+        showStoreKitWithProductIdentifier:kGooglePhotosAppProductIdentifier
+                            campaignToken:kGooglePhotosStoreKitCampaignToken];
     return;
   }