Skip to content

Commit

Permalink
Merge branch 'main' into guard-segment-behind-consent
Browse files Browse the repository at this point in the history
  • Loading branch information
scottkicks authored Mar 8, 2023
2 parents 4384b20 + 2733127 commit 827ce82
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
1 change: 1 addition & 0 deletions Kickstarter-iOS/AppDelegateViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ public final class AppDelegateViewModel: AppDelegateViewModelType, AppDelegateVi
.ksr_delay(.seconds(1), on: AppEnvironment.current.scheduler)
.map { _ -> ATTrackingAuthorizationStatus in
guard featureConsentManagementDialogEnabled() else { return .notDetermined }

return AppTrackingTransparency().authorizationStatus()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ final class PledgePaymentMethodsViewController: UIViewController {
}

self.viewModel.outputs.notifyFacebookCAPIUserEmail
.observeForUI()
.observeValues { [weak self] email in
guard let strongSelf = self else { return }

Expand Down
2 changes: 1 addition & 1 deletion Library/ViewModels/PledgePaymentMethodsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public final class PledgePaymentMethodsViewModel: PledgePaymentMethodsViewModelT
.observeValues { projectSignal, userEmail in
let (project, _) = projectSignal

guard featureFacebookConversionsAPIEnabled(), project.sendMetaCapiEvents == true,
guard featureFacebookConversionsAPIEnabled(), project.sendMetaCapiEvents,
let externalId = AppTrackingTransparency().advertisingIdentifier() else { return }

_ = AppEnvironment
Expand Down
16 changes: 3 additions & 13 deletions Library/ViewModels/ProjectPageViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,23 +342,13 @@ public final class ProjectPageViewModel: ProjectPageViewModelType, ProjectPageVi
}

// FB CAPI
let graphUser = self.viewDidAppearAnimatedProperty.signal.ignoreValues()
.switchMap { _ in
AppEnvironment.current.apiService
.fetchGraphUser(withStoredCards: false)
.ksr_delay(AppEnvironment.current.apiDelayInterval, on: AppEnvironment.current.scheduler)
.materialize()
}

trackFreshProjectAndRefTagViewed
.combineLatest(with: graphUser)
.observeValues { projectAndRefTag, graphUser in
.observeValues { projectAndRefTag in
let (project, _) = projectAndRefTag

guard featureFacebookConversionsAPIEnabled(), project.sendMetaCapiEvents,
let externalId = AppTrackingTransparency().advertisingIdentifier() else { return }

let userEmail = graphUser.value?.me.email
let externalId = AppTrackingTransparency.advertisingIdentifier() else { return }

_ = AppEnvironment
.current
Expand All @@ -368,7 +358,7 @@ public final class ProjectPageViewModel: ProjectPageViewModelType, ProjectPageVi
projectId: "\(project.id)",
eventName: FacebookCAPIEventName.ProjectPageViewed.rawValue,
externalId: externalId,
userEmail: userEmail,
userEmail: nil,
appData: .init(extinfo: ["i2"]),
customData: .init(currency: nil, value: nil)
)
Expand Down
16 changes: 3 additions & 13 deletions Library/ViewModels/RewardsCollectionViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,23 +230,13 @@ public final class RewardsCollectionViewModel: RewardsCollectionViewModelType,
}

// FB CAPI
let graphUser = self.viewDidAppearProperty.signal.ignoreValues()
.switchMap { _ in
AppEnvironment.current.apiService
.fetchGraphUser(withStoredCards: false)
.ksr_delay(AppEnvironment.current.apiDelayInterval, on: AppEnvironment.current.scheduler)
.materialize()
}

_ = Signal.combineLatest(project, self.viewDidAppearProperty.signal.ignoreValues())
.combineLatest(with: graphUser)
.observeValues { projectAndRefTag, graphUser in
.observeValues { projectAndRefTag in
let (project, _) = projectAndRefTag

guard featureFacebookConversionsAPIEnabled(), project.sendMetaCapiEvents,
let externalId = AppTrackingTransparency().advertisingIdentifier() else { return }

let userEmail = graphUser.value?.me.email
let externalId = AppTrackingTransparency.advertisingIdentifier() else { return }

_ = AppEnvironment
.current
Expand All @@ -256,7 +246,7 @@ public final class RewardsCollectionViewModel: RewardsCollectionViewModelType,
projectId: "\(project.id)",
eventName: FacebookCAPIEventName.RewardSelectionViewed.rawValue,
externalId: externalId,
userEmail: userEmail,
userEmail: nil,
appData: .init(extinfo: ["i2"]),
customData: .init(currency: nil, value: nil)
)
Expand Down

0 comments on commit 827ce82

Please sign in to comment.