Skip to content

Commit

Permalink
[MBL 873] Implement TriggerThirdPartyEvent Mutation (#1835)
Browse files Browse the repository at this point in the history
* rename FacebookCAPIEventName to ThirdPartyEventInputName

* replace .triggerCapiEventInput calls with .triggerThirdPartyEventInput

* cleanup TriggerCapiEventInput related files and references

* cleanup mutation calls

* include required OS version in extInfo at correct index

according to CAPI docs all values are required and must be in the given indexed order.

* rename input name

* add platformVersion computed property to NSBundleType

* refactor mutation calls
  • Loading branch information
scottkicks committed Jul 25, 2023
1 parent 61ffb8b commit 91d3abe
Show file tree
Hide file tree
Showing 18 changed files with 118 additions and 229 deletions.
28 changes: 4 additions & 24 deletions Kickstarter.xcodeproj/project.pbxproj
Expand Up @@ -475,7 +475,7 @@
6008633729B9025F00B87B39 /* GraphUserEmailTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6008633529B9023300B87B39 /* GraphUserEmailTests.swift */; };
6008633F29BF750700B87B39 /* MockAppTrackingTransparency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6008633E29BF750700B87B39 /* MockAppTrackingTransparency.swift */; };
6018626629A9194600EA2842 /* AppTrackingTransparency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6018626529A9194600EA2842 /* AppTrackingTransparency.swift */; };
6018626829A91B8C00EA2842 /* FacebookCAPIEventName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6018626729A91B8C00EA2842 /* FacebookCAPIEventName.swift */; };
6018626829A91B8C00EA2842 /* ThirdPartyEventInputName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6018626729A91B8C00EA2842 /* ThirdPartyEventInputName.swift */; };
606754BD28CF91D60033CD5E /* FacebookCore in Frameworks */ = {isa = PBXBuildFile; productRef = 606754BC28CF91D60033CD5E /* FacebookCore */; };
606754BF28CF91DD0033CD5E /* FacebookLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 606754BE28CF91DD0033CD5E /* FacebookLogin */; };
6067BCE9293E49AC0036ABB1 /* FacebookResetPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6067BCE7293E48140036ABB1 /* FacebookResetPasswordViewController.swift */; };
Expand All @@ -486,11 +486,6 @@
606C45F529FACD78001BA067 /* RemoteConfigFeature+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606C45F429FACD78001BA067 /* RemoteConfigFeature+Helpers.swift */; };
606C45F829FACD9F001BA067 /* RemoteConfigFeature+HelpersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606C45F629FACD94001BA067 /* RemoteConfigFeature+HelpersTests.swift */; };
606C45FA29FACE17001BA067 /* MockRemoteConfigClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606C45F929FACE17001BA067 /* MockRemoteConfigClient.swift */; };
606F215C299D3FA900BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInputTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606F215A299D3EF800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInputTests.swift */; };
606F215E299D414800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606F215D299D414800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInput.swift */; };
606F2166299D456D00BA5CDF /* TriggerCapiEvent.graphql in Sources */ = {isa = PBXBuildFile; fileRef = 606F2165299D456D00BA5CDF /* TriggerCapiEvent.graphql */; };
606F2168299D45F900BA5CDF /* TriggerCapiEventInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606F2167299D45F900BA5CDF /* TriggerCapiEventInput.swift */; };
606F216B299E8D8500BA5CDF /* TriggerCapiEventInputTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606F2169299E8C9F00BA5CDF /* TriggerCapiEventInputTests.swift */; };
6078106B2A0419130050D4F7 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 6078106A2A0419130050D4F7 /* FirebaseCrashlytics */; };
6078106D2A0419170050D4F7 /* FirebasePerformance in Frameworks */ = {isa = PBXBuildFile; productRef = 6078106C2A0419170050D4F7 /* FirebasePerformance */; };
6078106F2A04191C0050D4F7 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 6078106E2A04191C0050D4F7 /* FirebaseAnalytics */; };
Expand Down Expand Up @@ -2056,7 +2051,7 @@
6008633529B9023300B87B39 /* GraphUserEmailTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphUserEmailTests.swift; sourceTree = "<group>"; };
6008633E29BF750700B87B39 /* MockAppTrackingTransparency.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockAppTrackingTransparency.swift; sourceTree = "<group>"; };
6018626529A9194600EA2842 /* AppTrackingTransparency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTrackingTransparency.swift; sourceTree = "<group>"; };
6018626729A91B8C00EA2842 /* FacebookCAPIEventName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacebookCAPIEventName.swift; sourceTree = "<group>"; };
6018626729A91B8C00EA2842 /* ThirdPartyEventInputName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPartyEventInputName.swift; sourceTree = "<group>"; };
6067BCE7293E48140036ABB1 /* FacebookResetPasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacebookResetPasswordViewController.swift; sourceTree = "<group>"; };
6067BCEA293E49CB0036ABB1 /* FacebookResetPasswordViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacebookResetPasswordViewModel.swift; sourceTree = "<group>"; };
6067BCEF293FC10E0036ABB1 /* FacebookResetPasswordViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacebookResetPasswordViewModelTests.swift; sourceTree = "<group>"; };
Expand All @@ -2065,11 +2060,6 @@
606C45F429FACD78001BA067 /* RemoteConfigFeature+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RemoteConfigFeature+Helpers.swift"; sourceTree = "<group>"; };
606C45F629FACD94001BA067 /* RemoteConfigFeature+HelpersTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RemoteConfigFeature+HelpersTests.swift"; sourceTree = "<group>"; };
606C45F929FACE17001BA067 /* MockRemoteConfigClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRemoteConfigClient.swift; sourceTree = "<group>"; };
606F215A299D3EF800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInputTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphAPI.TriggerCapiEventInput+TriggerCapiEventInputTests.swift"; sourceTree = "<group>"; };
606F215D299D414800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphAPI.TriggerCapiEventInput+TriggerCapiEventInput.swift"; sourceTree = "<group>"; };
606F2165299D456D00BA5CDF /* TriggerCapiEvent.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = TriggerCapiEvent.graphql; sourceTree = "<group>"; };
606F2167299D45F900BA5CDF /* TriggerCapiEventInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TriggerCapiEventInput.swift; sourceTree = "<group>"; };
606F2169299E8C9F00BA5CDF /* TriggerCapiEventInputTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TriggerCapiEventInputTests.swift; sourceTree = "<group>"; };
608E7A5128ABD5E700289E92 /* SetYourPasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetYourPasswordViewController.swift; sourceTree = "<group>"; };
608E7A5428ABE27400289E92 /* SetYourPasswordViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetYourPasswordViewModel.swift; sourceTree = "<group>"; };
6093098C2A6054CB004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5775,7 +5765,6 @@
06261602273B0E1500389981 /* PostComment.graphql */,
062868E526B999EF00EC5052 /* DeletePaymentSource.graphql */,
47D7D09526C2EA5200D2BAB5 /* SignInWithApple.graphql */,
606F2165299D456D00BA5CDF /* TriggerCapiEvent.graphql */,
609309942A6055A5004297AF /* TriggerThirdPartyEvent.graphql */,
8AC3E0F4269F48A400168BF8 /* UpdateBacking.graphql */,
06643F3926A5FF1C002C5997 /* UpdateUserAccount.graphql */,
Expand Down Expand Up @@ -5889,7 +5878,7 @@
children = (
8A788F25263C80C500A89DAE /* Vendor */,
6018626529A9194600EA2842 /* AppTrackingTransparency.swift */,
6018626729A91B8C00EA2842 /* FacebookCAPIEventName.swift */,
6018626729A91B8C00EA2842 /* ThirdPartyEventInputName.swift */,
8A23203025B0ECF700B940C3 /* IdentifyingTrackingClient.swift */,
8A213CE8239EAEA400BBB4C7 /* KSRAnalytics.swift */,
8A4B8E812639F8C700D92E4E /* KSRAnalyticsIdentityData.swift */,
Expand Down Expand Up @@ -5995,8 +5984,6 @@
06962F8E273B3DF200FB0B3D /* GraphAPI.PostCommentInput+PostCommentInputTests.swift */,
47D7D09726C2ECB300D2BAB5 /* GraphAPI.SignInWithAppleInput+SignInWithAppleInput.swift */,
47D7D09B26C2FA5F00D2BAB5 /* GraphAPI.SignInWithAppleInput+SignInWithAppleInputTests.swift */,
606F215D299D414800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInput.swift */,
606F215A299D3EF800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInputTests.swift */,
6093098C2A6054CB004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInput.swift */,
6093098E2A6054D8004297AF /* GraphAPI.TriggerThirdPartyEventInput+TriggerThirdPartyEventInputTests.swift */,
8AC3E10C269F4D4000168BF8 /* GraphAPI.UpdateBackingInput+UpdateBackingInput.swift */,
Expand Down Expand Up @@ -7089,8 +7076,6 @@
47A662F826AF7745001CE7B1 /* WatchProjectInputTests.swift */,
D6F5C6102437E12300C1A79D /* SignInWithAppleInput.swift */,
77C0818D245CBA1B004ABE88 /* SignInWithAppleInputTests.swift */,
606F2167299D45F900BA5CDF /* TriggerCapiEventInput.swift */,
606F2169299E8C9F00BA5CDF /* TriggerCapiEventInputTests.swift */,
609309902A60555F004297AF /* TriggerThirdPartyEventInput.swift */,
609309922A605563004297AF /* TriggerThirdPartyEventInputTests.swift */,
4753C76E264DAFD300BB10B6 /* PostCommentInput.swift */,
Expand Down Expand Up @@ -7828,7 +7813,7 @@
D66850A1236CA44C00EE9AC2 /* ProjectPamphletCreatorHeaderCellViewModel.swift in Sources */,
A75C81201D210C4700B5AD03 /* UpdateActivityItemProvider.swift in Sources */,
9D7536CF1D78D88D00A7623B /* SurveyResponseViewModel.swift in Sources */,
6018626829A91B8C00EA2842 /* FacebookCAPIEventName.swift in Sources */,
6018626829A91B8C00EA2842 /* ThirdPartyEventInputName.swift in Sources */,
A710573B1DC2B2DF00A69552 /* SharedFunctions.swift in Sources */,
A7DC83961C9DBBE700BB2B44 /* RefTag.swift in Sources */,
D6089E8F209106CD0032CC99 /* PushNotificationDialog.swift in Sources */,
Expand Down Expand Up @@ -8664,7 +8649,6 @@
D01589811EEB2ED7006E7684 /* Update.swift in Sources */,
8AC3E00726961E6400168BF8 /* Reward+RewardFragment.swift in Sources */,
378CA24622C4449F004E3C86 /* CountryLenses.swift in Sources */,
606F215E299D414800BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInput.swift in Sources */,
476A2A6425DEED2600EB6A56 /* PerimeterXTypes.swift in Sources */,
D0158A161EEB30A2006E7684 /* ItemTemplates.swift in Sources */,
D63BBD33217F9CDE007E01F0 /* GraphCreditCardTemplate.swift in Sources */,
Expand Down Expand Up @@ -8783,7 +8767,6 @@
D01588E51EEB2ED7006E7684 /* Location.swift in Sources */,
8A15571D2693B29600017845 /* Comment+CommentFragment.swift in Sources */,
6008633429B8FBD700B87B39 /* GraphUserEmail.swift in Sources */,
606F2168299D45F900BA5CDF /* TriggerCapiEventInput.swift in Sources */,
06232D442795EC4300A81755 /* ExternalSourceViewElement.swift in Sources */,
8A67DDB624DCB7D500B4AB10 /* Constants.swift in Sources */,
D01588A11EEB2ED7006E7684 /* MessageThreadLenses.swift in Sources */,
Expand Down Expand Up @@ -8847,7 +8830,6 @@
D01589931EEB2ED7006E7684 /* User.swift in Sources */,
D0158A271EEB30A2006E7684 /* ShippingRuleTemplates.swift in Sources */,
06566375270BAA7C00CE7EDF /* Project+FetchProjectRewardsByIdQueryData.swift in Sources */,
606F2166299D456D00BA5CDF /* TriggerCapiEvent.graphql in Sources */,
8AF34C782342D6A5000B211D /* Encodable+Dictionary.swift in Sources */,
77E44B7421823A56006446B8 /* ChangePasswordInput.swift in Sources */,
06B3605F26E15A5E006CB9E4 /* Project+FetchProjectQueryData.swift in Sources */,
Expand Down Expand Up @@ -8958,7 +8940,6 @@
06D00FAB26EFA95300E11E38 /* UserFragmentTemplate.swift in Sources */,
77DB532A2215D0AA0078991C /* UserCreditCardsTests.swift in Sources */,
D01589A21EEB2ED7006E7684 /* ServiceTypeTests.swift in Sources */,
606F215C299D3FA900BA5CDF /* GraphAPI.TriggerCapiEventInput+TriggerCapiEventInputTests.swift in Sources */,
D0D10C0F1EEB4550005EBAD0 /* LocationTests.swift in Sources */,
194C002E2A68447200621DC3 /* TriggerThirdPartyEventInputTests.swift in Sources */,
06032A8E26CEB3E50013AAB9 /* CommentFragmentTemplate.swift in Sources */,
Expand Down Expand Up @@ -9029,7 +9010,6 @@
77FA1AF32445FB810035D659 /* GraphUserTests.swift in Sources */,
066C0AE926CC20490048F4D8 /* SignInWithAppleMutationTemplate.swift in Sources */,
D0D10C021EEB4550005EBAD0 /* ActivityTests.swift in Sources */,
606F216B299E8D8500BA5CDF /* TriggerCapiEventInputTests.swift in Sources */,
06032A9026CEC3290013AAB9 /* FetchUpdateCommentsQueryTemplate.swift in Sources */,
D01589A81EEB306D006E7684 /* EncodableTests.swift in Sources */,
D0D10C111EEB4550005EBAD0 /* MessageThreadTests.swift in Sources */,
Expand Down
17 changes: 0 additions & 17 deletions KsApi/MockService.swift
Expand Up @@ -38,8 +38,6 @@

fileprivate let deletePaymentMethodResult: Result<DeletePaymentMethodEnvelope, ErrorEnvelope>?

fileprivate let triggerCapiEventResult: Result<EmptyResponseEnvelope, ErrorEnvelope>?

fileprivate let triggerThirdPartyEventResult: Result<EmptyResponseEnvelope, ErrorEnvelope>?

fileprivate let facebookConnectResponse: User?
Expand Down Expand Up @@ -224,7 +222,6 @@
changeCurrencyResult: Result<EmptyResponseEnvelope, ErrorEnvelope>? = nil,
changePaymentMethodResult: Result<ChangePaymentMethodEnvelope, ErrorEnvelope>? = nil,
deletePaymentMethodResult: Result<DeletePaymentMethodEnvelope, ErrorEnvelope>? = nil,
triggerCapiEventResult: Result<EmptyResponseEnvelope, ErrorEnvelope>? = nil,
triggerThirdPartyEventResult: Result<EmptyResponseEnvelope, ErrorEnvelope>? = nil,
clearUserUnseenActivityResult: Result<ClearUserUnseenActivityEnvelope, ErrorEnvelope>? = nil,
facebookConnectResponse: User? = nil,
Expand Down Expand Up @@ -345,8 +342,6 @@
self.changePaymentMethodResult = changePaymentMethodResult
self.deletePaymentMethodResult = deletePaymentMethodResult

self.triggerCapiEventResult = triggerCapiEventResult

self.triggerThirdPartyEventResult = triggerThirdPartyEventResult

self.facebookConnectResponse = facebookConnectResponse
Expand Down Expand Up @@ -1598,18 +1593,6 @@
return client.performWithResult(mutation: mutation, result: self.deletePaymentMethodResult)
}

internal func triggerCapiEventInput(input: TriggerCapiEventInput)
-> SignalProducer<EmptyResponseEnvelope, ErrorEnvelope> {
guard let client = self.apolloClient else {
return .empty
}

let mutation = GraphAPI
.TriggerCapiEventMutation(input: GraphAPI.TriggerCapiEventInput.from(input))

return client.performWithResult(mutation: mutation, result: self.triggerCapiEventResult)
}

internal func triggerThirdPartyEventInput(input: TriggerThirdPartyEventInput) -> ReactiveSwift
.SignalProducer<EmptyResponseEnvelope, ErrorEnvelope> {
guard let client = self.apolloClient else {
Expand Down
10 changes: 0 additions & 10 deletions KsApi/Service.swift
Expand Up @@ -106,16 +106,6 @@ public struct Service: ServiceType {
.flatMap(CreatePaymentSourceEnvelope.producer(from:))
}

public func triggerCapiEventInput(input: TriggerCapiEventInput)
-> SignalProducer<EmptyResponseEnvelope, ErrorEnvelope> {
return GraphQL.shared.client
.perform(mutation: GraphAPI
.TriggerCapiEventMutation(input: GraphAPI.TriggerCapiEventInput.from(input)))
.flatMap { _ in
SignalProducer(value: EmptyResponseEnvelope())
}
}

public func triggerThirdPartyEventInput(input: TriggerThirdPartyEventInput)
-> SignalProducer<EmptyResponseEnvelope, ErrorEnvelope> {
return GraphQL.shared.client
Expand Down
4 changes: 0 additions & 4 deletions KsApi/ServiceType.swift
Expand Up @@ -47,10 +47,6 @@ public protocol ServiceType {
func addImage(file fileURL: URL, toDraft draft: UpdateDraft)
-> SignalProducer<UpdateDraft.Image, ErrorEnvelope>

/// Sends facebook ad data relevant to the user
func triggerCapiEventInput(input: TriggerCapiEventInput)
-> SignalProducer<EmptyResponseEnvelope, ErrorEnvelope>

/// Sends facebook ad data and/or google analytics data relevant to the user
func triggerThirdPartyEventInput(input: TriggerThirdPartyEventInput)
-> SignalProducer<EmptyResponseEnvelope, ErrorEnvelope>
Expand Down

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions KsApi/mutations/TriggerCapiEvent.graphql

This file was deleted.

37 changes: 0 additions & 37 deletions KsApi/mutations/inputs/TriggerCapiEventInput.swift

This file was deleted.

29 changes: 0 additions & 29 deletions KsApi/mutations/inputs/TriggerCapiEventInputTests.swift

This file was deleted.

0 comments on commit 91d3abe

Please sign in to comment.