Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Problem ASA Custom Onboarding Linked Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Feb 28, 2024
1 parent 388b50a commit 0091827
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@ public class BrowserViewController: UIViewController {
func logSecureContentState(tab: Tab, path: KVOConstants? = nil, details: String? = nil) {
var text = """
Tab URL: \(tab.url?.absoluteString ?? "Empty Tab URL")
Tab VebView URL: \(tab.webView?.url?.absoluteString ?? "Empty Webview URL")
Tab WebView URL: \(tab.webView?.url?.absoluteString ?? "Empty Webview URL")
Secure State: \(tab.secureContentState.rawValue)
"""

Expand Down
16 changes: 11 additions & 5 deletions Sources/Onboarding/Welcome/WelcomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,24 +407,30 @@ public class WelcomeViewController: UIViewController {
let attributionManager = controller.attributionManager

Task { @MainActor in
var featureLinkType: FeatureLinkageType?

do {
if controller.p3aUtilities.isP3AEnabled {
switch attributionManager.activeFetureLinkageLogic {
case .campaingId:
let featureType = try await attributionManager.handleSearchAdsFeatureLinkage()
attributionManager.adFeatureLinkage = featureType
featureLinkType = featureType
case .reporting:
// Handle API calls and send linkage type
let featureType = try await controller.attributionManager.handleAdsReportingFeatureLinkage()
attributionManager.adFeatureLinkage = featureType
featureLinkType = featureType
}
} else {
// p3a consent is not given
attributionManager.setupReferralCodeAndPingServer()
}

controller.calloutView.isLoading = false
close()
close() {
if let featureType = featureLinkType {
attributionManager.adFeatureLinkage = featureType
}
}
} catch FeatureLinkageError.executionTimeout(let attributionData) {
// Time out occurred while executing ad reports lookup
// Ad Campaign Lookup is successful so dau server should be pinged
Expand Down Expand Up @@ -471,7 +477,7 @@ public class WelcomeViewController: UIViewController {
animateToP3aState()
}

private func close() {
private func close(completion: (() -> Void)? = nil) {
var presenting: UIViewController = self
while true {
if let presentingController = presenting.presentingViewController {
Expand All @@ -488,7 +494,7 @@ public class WelcomeViewController: UIViewController {
}

Preferences.Onboarding.basicOnboardingProgress.value = OnboardingProgress.newTabPage.rawValue
presenting.dismiss(animated: false, completion: nil)
presenting.dismiss(animated: false, completion: completion)
}
}

Expand Down

0 comments on commit 0091827

Please sign in to comment.