handleDeepLink method
Resolves the provided uri to extract DeepLinkData.
It first attempts to resolve the URL via the LinkForty backend to get full campaign metadata. If the network request fails or the SDK is not configured for server-side resolution, it falls back to parsing the URL locally.
Implementation
Future<void> handleDeepLink(Uri uri) async {
LinkFortyLogger.log('Handling deep link: $uri');
final localData = URLParser.parseDeepLink(uri);
final resolvedData =
(_networkManager != null && _fingerprintCollector != null)
? await _resolveUrl(uri, fallback: localData)
: localData;
final callbacks = List<DeepLinkCallback>.from(_deepLinkCallbacks);
if (resolvedData != null) {
// Pin last-click attribution to this direct (re-engagement) open;
// supersedes any prior context. Organic/unresolved opens are a no-op.
await _attributionContext?.recordDeepLinkOpen(
linkId: resolvedData.linkId,
);
LinkFortyLogger.log('Parsed deep link: $resolvedData');
} else {
LinkFortyLogger.log('Failed to parse deep link URL');
}
for (final callback in callbacks) {
callback(uri, resolvedData);
}
}