From 2594734d0e347ce654d0efabef63094b19287140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Tue, 30 Jan 2024 10:12:56 +0100 Subject: [PATCH] Address PR comments --- .../core/tracker/PlatformContext.kt | 1 + .../snowplowanalytics/core/tracker/Tracker.kt | 2 + .../tracker/PlatformContextRetriever.kt | 82 ++++++++++++++----- 3 files changed, 64 insertions(+), 21 deletions(-) diff --git a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/PlatformContext.kt b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/PlatformContext.kt index fa8396383..31de79bda 100644 --- a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/PlatformContext.kt +++ b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/PlatformContext.kt @@ -32,6 +32,7 @@ import com.snowplowanalytics.snowplow.tracker.PlatformContextRetriever * @param deviceInfoMonitor Device monitor for fetching platform information * @param properties List of properties of the platform context to track * @param retriever Overrides for retrieving property values + * @param context Android context */ class PlatformContext( private val platformDictUpdateFrequency: Long = 1000, diff --git a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Tracker.kt b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Tracker.kt index 86760fc8e..779e38743 100755 --- a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Tracker.kt +++ b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/Tracker.kt @@ -52,6 +52,8 @@ import java.util.concurrent.atomic.AtomicBoolean * @param emitter Emitter to which events will be sent * @param namespace Identifier for the Tracker instance * @param appId Application ID + * @param platformContextProperties List of properties of the platform context to track + * @param platformContextRetriever Overrides for retrieving property values * @param context The Android application context * @param builder A closure to set Tracker configuration */ diff --git a/snowplow-tracker/src/main/java/com/snowplowanalytics/snowplow/tracker/PlatformContextRetriever.kt b/snowplow-tracker/src/main/java/com/snowplowanalytics/snowplow/tracker/PlatformContextRetriever.kt index 1787a2865..aec635395 100644 --- a/snowplow-tracker/src/main/java/com/snowplowanalytics/snowplow/tracker/PlatformContextRetriever.kt +++ b/snowplow-tracker/src/main/java/com/snowplowanalytics/snowplow/tracker/PlatformContextRetriever.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2023 Snowplow Analytics Ltd. All rights reserved. + * Copyright (c) 2015-present Snowplow Analytics Ltd. All rights reserved. * * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. @@ -16,63 +16,103 @@ package com.snowplowanalytics.snowplow.tracker * Overrides for the values for properties of the platform context. */ data class PlatformContextRetriever( - /// Operating system type (e.g., ios, tvos, watchos, osx, android) + /** + * Operating system type (e.g., ios, tvos, watchos, osx, android). + */ var osType: (() -> String)? = null, - /// The current version of the operating system + /* + * The current version of the operating system. + */ var osVersion: (() -> String)? = null, - /// The manufacturer of the product/hardware + /** + * The manufacturer of the product/hardware. + */ var deviceVendor: (() -> String)? = null, - /// The end-user-visible name for the end product + /** + * The end-user-visible name for the end product. + */ var deviceModel: (() -> String)? = null, - /// The carrier of the SIM inserted in the device + /** + * The carrier of the SIM inserted in the device. + */ var carrier: (() -> String?)? = null, - /// Type of network the device is connected to + /** + * Type of network the device is connected to. + */ var networkType: (() -> String?)? = null, - /// Radio access technology that the device is using + /** + * Radio access technology that the device is using. + */ var networkTechnology: (() -> String?)? = null, - /// Advertising identifier on Android + /** + * Advertising identifier on Android. + */ var androidIdfa: (() -> String?)? = null, - /// Bytes of storage remaining + /** + * Bytes of storage remaining. + */ var availableStorage: (() -> Long?)? = null, - /// Total size of storage in bytes + /** + * Total size of storage in bytes. + */ var totalStorage: (() -> Long?)? = null, - /// Total physical system memory in bytes + /** + * Total physical system memory in bytes. + */ var physicalMemory: (() -> Long?)? = null, - /// Available memory on the system in bytes (Android only) + /** + * Available memory on the system in bytes (Android only). + */ var systemAvailableMemory: (() -> Long?)? = null, - /// Remaining battery level as an integer percentage of total battery capacity + /** + * Remaining battery level as an integer percentage of total battery capacity. + */ var batteryLevel: (() -> Int?)? = null, - /// Battery state for the device + /** + * Battery state for the device + */ var batteryState: (() -> String?)? = null, - /// A Boolean indicating whether the device orientation is portrait (either upright or upside down) + /** + * A Boolean indicating whether the device orientation is portrait (either upright or upside down). + */ var isPortrait: (() -> Boolean?)? = null, - /// Screen resolution in pixels. Arrives in the form of WIDTHxHEIGHT (e.g., 1200x900). Doesn't change when device orientation changes + /** + * Screen resolution in pixels. Arrives in the form of WIDTHxHEIGHT (e.g., 1200x900). Doesn't change when device orientation changes. + */ var resolution: (() -> String?)? = null, - /// Scale factor used to convert logical coordinates to device coordinates of the screen (uses UIScreen.scale on iOS) + /** + * Scale factor used to convert logical coordinates to device coordinates of the screen (uses UIScreen.scale on iOS). + */ var scale: (() -> Float?)? = null, - /// System language currently used on the device (ISO 639) + /** + * System language currently used on the device (ISO 639). + */ var language: (() -> String)? = null, - /// Android vendor ID scoped to the set of apps published under the same Google Play developer account (see https://developer.android.com/training/articles/app-set-id) + /** + * Android vendor ID scoped to the set of apps published under the same Google Play developer account (see https://developer.android.com/training/articles/app-set-id). + */ var appSetId: (() -> String)? = null, - /// Scope of the `appSetId`. Can be scoped to the app or to a developer account on an app store (all apps from the same developer on the same device will have the same ID) + /** + * Scope of the `appSetId`. Can be scoped to the app or to a developer account on an app store (all apps from the same developer on the same device will have the same ID). + */ var appSetIdScope: (() -> String)? = null )