From b2a61db40ed3ad53270248a37b43e467c77ca720 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 14 Sep 2022 17:06:34 +0200 Subject: [PATCH] ADD documentation --- README.md | 34 +++++++++++++------ .../collector/AccessibilityCollector.kt | 2 +- .../q42stats/library/util/ApiFormatUtil.kt | 4 +-- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6d90231..03f4b49 100644 --- a/README.md +++ b/README.md @@ -107,24 +107,36 @@ bool | Specifically checks whether com.samsung.android.app.talkback.talkbackserv ### System -| Key | Value | Notes | -|-|-|-| -| `applicationId` | String | identifier for the app for which data is collected, as set in the app's Manifest. iOS: bundleId | nl.hema.mobiel | -| `defaultLanguage`| en, nl, ... | -| `sdkVersion` | int | 29 for Android 10. [See this list](https://source.android.com/setup/start/build-numbers) -|`manufacturer`|String|eg. `samsung`| -|`modelName`|String| May be a marketing name, but more often an internal code name. eg. `SM-G980F` for a particular variant of a Samsung Galaxy S10| - +| Key | Value | Notes | |-|-|-| | `applicationId` | String | identifier for the app for which data +is collected, as set in the app's Manifest. iOS: bundleId | nl.hema.mobiel | | `defaultLanguage`| +en, nl, ... | | `sdkVersion` | int | 29 for Android +10. [See this list](https://source.android.com/setup/start/build-numbers) +|`manufacturer`|String|eg. `samsung`| |`modelName`|String| May be a marketing name, but more often +an internal code name. eg. `SM-G980F` for a particular variant of a Samsung Galaxy S10| ## Development +All classes and functions that are not used by implementing apps should have `internal` visibility. + +Since this a library, all errors should be caught so that implementing apps don't crash. During +development, you can use the debug flavors to allow the sample app to crash in cause of an +Exception (see `handleException()`). When testing, use the release variants to make sure that +exceptions don't crash the implementing apps. + +Catch Throwable; not Exception. Since Throwabl is the superclass of Exception, this will make the +lib more resilient to crashes. + ### Setup -1. Get the API key from [The Api project](https://github.com/Q42/accessibility-pipeline/tree/main/api). Use this key in the next step. -2. Create a file called `secrets.properties` in the root of the project (not in the app folder). Contents: + +1. Get the API key + from [The Api project](https://github.com/Q42/accessibility-pipeline/tree/main/api). Use this key + in the next step. +2. Create a file called `secrets.properties` in the root of the project (not in the app folder). + Contents: ``` apikey="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ``` - Note that this file will be ignored by git. + Note that this file will be ignored by git. 3. Change the SampleApplication to construct a Q42Stats object for a real firestore collection. ### Publishing diff --git a/q42stats/src/main/java/com/q42/q42stats/library/collector/AccessibilityCollector.kt b/q42stats/src/main/java/com/q42/q42stats/library/collector/AccessibilityCollector.kt index 5f254fc..c616bfa 100644 --- a/q42stats/src/main/java/com/q42/q42stats/library/collector/AccessibilityCollector.kt +++ b/q42stats/src/main/java/com/q42/q42stats/library/collector/AccessibilityCollector.kt @@ -124,7 +124,7 @@ internal object AccessibilityCollector { name, 0 ) == 1 - } catch (e: Exception) { + } catch (e: Throwable) { Q42StatsLogger.e(TAG, "Could not read system int $name. Returning null", e) null } diff --git a/q42stats/src/main/java/com/q42/q42stats/library/util/ApiFormatUtil.kt b/q42stats/src/main/java/com/q42/q42stats/library/util/ApiFormatUtil.kt index b6f36fe..5d72983 100644 --- a/q42stats/src/main/java/com/q42/q42stats/library/util/ApiFormatUtil.kt +++ b/q42stats/src/main/java/com/q42/q42stats/library/util/ApiFormatUtil.kt @@ -8,10 +8,10 @@ import java.io.Serializable * a different hash, not being equal in comparisons etc. */ internal fun Map.toQ42StatsApiFormat(): Map { - val fireStoreMap = this.mapValues { entry -> + val q42StatsMap = this.mapValues { entry -> mapFieldValue(entry) } - return fireStoreMap + return q42StatsMap } @Suppress("UNCHECKED_CAST")