Class ContextExtKt
-
- All Implemented Interfaces:
public final class ContextExtKt
-
-
Method Summary
Modifier and Type Method Description final static List<String>getTrackers(AdContext $self, String type)Extension function to retrieve tracking URLs for a specific tracker type from AdContext. final static List<String>getTrackers(List<TrackingInfo> $self, String type)Extension function to retrieve tracking URLs for a specific tracker type from a list of TrackingInfo. final static BooleanisAdExpired(AdContext $self)Extension function to check if an ad has expired based on its time-to-live configuration. final static LonggetExpiryTimeStampInMillis(AdContext $self)Extension function to calculate the expiry timestamp in milliseconds for an ad. final static BooleanisVideoAd(AdContext $self)Extension function to check if an ad contains video content. final static BooleanisLoadedImpression(AdContext $self)Extension function to check if an ad uses loaded impression tracking. -
-
Method Detail
-
getTrackers
final static List<String> getTrackers(AdContext $self, String type)
Extension function to retrieve tracking URLs for a specific tracker type from AdContext.
This function first attempts to get trackers from the legacy trackingEvents structure, and if none are found, falls back to the newer trackingInfo structure. This ensures backward compatibility while supporting the updated tracking system.
- Parameters:
type- The tracker type annotation from TrackerType to filter trackers.- Returns:
A list of tracking URL strings for the specified tracker type.
-
getTrackers
final static List<String> getTrackers(List<TrackingInfo> $self, String type)
Extension function to retrieve tracking URLs for a specific tracker type from a list of TrackingInfo.
This function processes multiple tracking info objects and extracts URLs for the specified tracker type. It handles both direct URLs and InMobi extension URLs that need to be prefixed with the base URL.
- Parameters:
type- The tracker type annotation from TrackerType to filter trackers.- Returns:
A list of tracking URL strings for the specified tracker type.
-
isAdExpired
final static Boolean isAdExpired(AdContext $self)
Extension function to check if an ad has expired based on its time-to-live configuration.
This function determines ad expiry by comparing the current time with either the explicit expiry timestamp or a calculated expiry based on insertion time and TTL. Supports both explicit expiry timestamps and calculated expiry based on cache TTL.
- Returns:
trueif the ad has expired and should not be shown,falseotherwise.
-
getExpiryTimeStampInMillis
final static Long getExpiryTimeStampInMillis(AdContext $self)
Extension function to calculate the expiry timestamp in milliseconds for an ad.
This function checks if the ad has an explicit expiry timestamp. If it does, it returns that. If not, it calculates the expiry timestamp by adding the time-to-live (TTL) from the cache configuration to the insertion timestamp. This allows for flexible handling of ad expiry based on either explicit timestamps or TTL configurations.
- Returns:
The expiry timestamp in milliseconds for the ad.
-
isVideoAd
final static Boolean isVideoAd(AdContext $self)
Extension function to check if an ad contains video content.
This function examines the ad's creative type metadata to determine if it contains video content, which is useful for applying video-specific handling and configuration.
- Returns:
trueif the ad is a video ad,falseotherwise.
-
isLoadedImpression
final static Boolean isLoadedImpression(AdContext $self)
Extension function to check if an ad uses loaded impression tracking.
This function checks the viewability configuration to determine if the ad uses loaded impression type, which affects when and how impression events are tracked and reported.
- Returns:
trueif the ad uses loaded impression tracking,falseotherwise.
-
-
-
-