@glassly/bluetooth-sdk 0.2.9-dev.456 → 0.2.9-dev.458
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkAnalytics.kt +7 -4
- package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedReleaseMetadata.kt +3 -3
- package/build/generated/releaseMetadata.js +3 -3
- package/build/generated/releaseMetadata.js.map +1 -1
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +3 -3
- package/ios/Source/internal/BluetoothSdkAnalytics.swift +6 -4
- package/package.json +1 -1
- package/src/generated/releaseMetadata.ts +3 -3
package/README.md
CHANGED
|
@@ -152,7 +152,11 @@ reordering rows just because RSSI metadata arrives later.
|
|
|
152
152
|
|
|
153
153
|
## Glassly SDK Usage Analytics
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
Usage analytics are currently turned off: the SDK ships without a PostHog key
|
|
156
|
+
and sends none of the events below. The configuration options still work, so
|
|
157
|
+
apps that already opt out need no changes when analytics return.
|
|
158
|
+
|
|
159
|
+
When enabled, the SDK sends three usage events to Glassly's PostHog project so
|
|
156
160
|
Glassly can understand SDK adoption, successful glasses connections, and
|
|
157
161
|
enterprise device deployments:
|
|
158
162
|
|
|
@@ -187,10 +191,10 @@ Native Android apps can pass `BluetoothSdkAnalyticsConfig.disabled()` in
|
|
|
187
191
|
Native iOS apps can pass `.disabled` in `BluetoothSDKConfiguration` or set
|
|
188
192
|
`BluetoothSdkAnalyticsDisabled` to `true` in `Info.plist`.
|
|
189
193
|
|
|
190
|
-
Glassly's PostHog project API key is embedded in the SDK as a
|
|
191
|
-
write token, not a private PostHog personal API key. Apps do
|
|
192
|
-
analytics destination; these SDK usage events are always sent
|
|
193
|
-
PostHog project unless
|
|
194
|
+
When enabled, Glassly's PostHog project API key is embedded in the SDK as a
|
|
195
|
+
public analytics write token, not a private PostHog personal API key. Apps do
|
|
196
|
+
not configure the analytics destination; these SDK usage events are always sent
|
|
197
|
+
to Glassly's PostHog project unless the app disables them.
|
|
194
198
|
|
|
195
199
|
Captured properties include `event_source`, `sdk_platform`, `sdk_surface`,
|
|
196
200
|
`sdk_version`, `app_identifier` (the Android package or iOS bundle identifier),
|
|
@@ -118,7 +118,8 @@ internal class BluetoothSdkAnalytics(
|
|
|
118
118
|
eventProperties: Map<String, Any>,
|
|
119
119
|
) {
|
|
120
120
|
val activeConfig = config
|
|
121
|
-
|
|
121
|
+
val apiKey = POSTHOG_API_KEY
|
|
122
|
+
if (!activeConfig.isReady || apiKey == null) return
|
|
122
123
|
|
|
123
124
|
try {
|
|
124
125
|
// Payload construction stays on the executor: distinctId() reads
|
|
@@ -128,7 +129,7 @@ internal class BluetoothSdkAnalytics(
|
|
|
128
129
|
val payload =
|
|
129
130
|
JSONObject(
|
|
130
131
|
mapOf(
|
|
131
|
-
"api_key" to
|
|
132
|
+
"api_key" to apiKey,
|
|
132
133
|
"event" to eventName,
|
|
133
134
|
"distinct_id" to distinctId(),
|
|
134
135
|
"properties" to baseProperties(activeConfig) + eventProperties,
|
|
@@ -184,7 +185,9 @@ internal class BluetoothSdkAnalytics(
|
|
|
184
185
|
internal const val META_ANALYTICS_DISABLED = "com.glassly.bluetoothsdk.analytics.disabled"
|
|
185
186
|
private const val PREFS_NAME = "glassly_bluetooth_sdk_analytics"
|
|
186
187
|
private const val PREFS_DISTINCT_ID = "distinct_id"
|
|
187
|
-
|
|
188
|
+
// TODO: set Glassly's own PostHog project key. Until then analytics stays
|
|
189
|
+
// off; the key inherited from upstream belonged to Mentra's project.
|
|
190
|
+
internal val POSTHOG_API_KEY: String? = null
|
|
188
191
|
private const val DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com"
|
|
189
192
|
}
|
|
190
193
|
}
|
|
@@ -205,7 +208,7 @@ private fun BluetoothSdkAnalyticsRuntimeConfig.resolvedForApp(context: Context):
|
|
|
205
208
|
val disabledByApp = metadata?.getBoolean(BluetoothSdkAnalytics.META_ANALYTICS_DISABLED, false) == true
|
|
206
209
|
|
|
207
210
|
return copy(
|
|
208
|
-
enabled = enabled && !disabledByApp,
|
|
211
|
+
enabled = enabled && !disabledByApp && BluetoothSdkAnalytics.POSTHOG_API_KEY != null,
|
|
209
212
|
)
|
|
210
213
|
}
|
|
211
214
|
|
|
@@ -3,9 +3,9 @@ package com.glassly.bluetoothsdk
|
|
|
3
3
|
/** Generated by release CI. Do not edit in a release checkout. */
|
|
4
4
|
internal object GeneratedReleaseMetadata {
|
|
5
5
|
const val FAMILY_BASE_VERSION: String = "0.2.9"
|
|
6
|
-
const val RELEASE_IDENTITY: String = "0.2.9-dev.
|
|
7
|
-
const val RELEASE_SET_ID: String = "glassly-0.2.9-dev.
|
|
8
|
-
const val SOURCE_COMMIT: String = "
|
|
6
|
+
const val RELEASE_IDENTITY: String = "0.2.9-dev.458"
|
|
7
|
+
const val RELEASE_SET_ID: String = "glassly-0.2.9-dev.458"
|
|
8
|
+
const val SOURCE_COMMIT: String = "9df4bc8a0ae8775a6daf69242824f0f86805c1f2"
|
|
9
9
|
const val OTA_MANIFEST_URL: String = ""
|
|
10
10
|
const val OTA_MANIFEST_SHA256: String = ""
|
|
11
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const BLUETOOTH_SDK_RELEASE_METADATA = Object.freeze({
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"familyBaseVersion": "0.2.9",
|
|
4
|
-
"releaseIdentity": "0.2.9-dev.
|
|
5
|
-
"releaseSetId": "glassly-0.2.9-dev.
|
|
6
|
-
"sourceCommit": "
|
|
4
|
+
"releaseIdentity": "0.2.9-dev.458",
|
|
5
|
+
"releaseSetId": "glassly-0.2.9-dev.458",
|
|
6
|
+
"sourceCommit": "9df4bc8a0ae8775a6daf69242824f0f86805c1f2",
|
|
7
7
|
"otaManifestUrl": null,
|
|
8
8
|
"otaManifestSha256": null
|
|
9
9
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,8BAA8B,GAA0C,MAAM,CAAC,MAAM,CAAC;IACjG,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,eAAe;IAClC,cAAc,EAAE,uBAAuB;IACvC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;CAC1B,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface BluetoothSdkReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"0.2.9\",\n \"releaseIdentity\": \"0.2.9-dev.
|
|
1
|
+
{"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,8BAA8B,GAA0C,MAAM,CAAC,MAAM,CAAC;IACjG,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,eAAe;IAClC,cAAc,EAAE,uBAAuB;IACvC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;CAC1B,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface BluetoothSdkReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"0.2.9\",\n \"releaseIdentity\": \"0.2.9-dev.458\",\n \"releaseSetId\": \"glassly-0.2.9-dev.458\",\n \"sourceCommit\": \"9df4bc8a0ae8775a6daf69242824f0f86805c1f2\",\n \"otaManifestUrl\": null,\n \"otaManifestSha256\": null\n})\n"]}
|
|
@@ -11,7 +11,7 @@ enum BluetoothSdkDefaults {
|
|
|
11
11
|
static let voiceActivityDetectionEnabled = false
|
|
12
12
|
static let loudnessGateEnabled = true
|
|
13
13
|
private static let infoSdkVersionKey = "BluetoothSdkVersion"
|
|
14
|
-
private static let swiftPackageSdkVersion = "0.2.9-dev.
|
|
14
|
+
private static let swiftPackageSdkVersion = "0.2.9-dev.458"
|
|
15
15
|
private static let swiftPackageSdkVersionPlaceholder = "__GLASSLY" + "_BLUETOOTH_SDK_VERSION__"
|
|
16
16
|
|
|
17
17
|
private static func normalizedSdkVersion(_ value: String?) -> String? {
|
|
@@ -3,9 +3,9 @@ import Foundation
|
|
|
3
3
|
/// Generated by release CI. Do not edit in a release checkout.
|
|
4
4
|
enum GeneratedReleaseMetadata {
|
|
5
5
|
static let familyBaseVersion = "0.2.9"
|
|
6
|
-
static let releaseIdentity = "0.2.9-dev.
|
|
7
|
-
static let releaseSetId = "glassly-0.2.9-dev.
|
|
8
|
-
static let sourceCommit = "
|
|
6
|
+
static let releaseIdentity = "0.2.9-dev.458"
|
|
7
|
+
static let releaseSetId = "glassly-0.2.9-dev.458"
|
|
8
|
+
static let sourceCommit = "9df4bc8a0ae8775a6daf69242824f0f86805c1f2"
|
|
9
9
|
static let otaManifestUrl = ""
|
|
10
10
|
static let otaManifestSha256 = ""
|
|
11
11
|
}
|
|
@@ -32,7 +32,9 @@ public struct BluetoothSdkAnalyticsConfiguration {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
final class BluetoothSdkAnalytics {
|
|
35
|
-
|
|
35
|
+
// TODO: set Glassly's own PostHog project key. Until then analytics stays
|
|
36
|
+
// off; the key inherited from upstream belonged to Mentra's project.
|
|
37
|
+
static let postHogApiKey: String? = nil
|
|
36
38
|
private static let defaultPostHogHost = "https://us.i.posthog.com"
|
|
37
39
|
private let stateQueue = DispatchQueue(label: "com.glassly.bluetoothsdk.analytics.state")
|
|
38
40
|
private let transportQueue = DispatchQueue(label: "com.glassly.bluetoothsdk.analytics.transport")
|
|
@@ -120,11 +122,11 @@ final class BluetoothSdkAnalytics {
|
|
|
120
122
|
properties: [String: Any],
|
|
121
123
|
configuration activeConfiguration: BluetoothSdkAnalyticsConfiguration
|
|
122
124
|
) {
|
|
123
|
-
guard activeConfiguration.isReady else { return }
|
|
125
|
+
guard activeConfiguration.isReady, let apiKey = Self.postHogApiKey else { return }
|
|
124
126
|
|
|
125
127
|
transportQueue.async {
|
|
126
128
|
let payload: [String: Any] = [
|
|
127
|
-
"api_key":
|
|
129
|
+
"api_key": apiKey,
|
|
128
130
|
"event": event,
|
|
129
131
|
"distinct_id": self.distinctId(),
|
|
130
132
|
"properties": self.baseProperties(configuration: activeConfiguration).merging(properties) { _, new in new },
|
|
@@ -192,7 +194,7 @@ private extension BluetoothSdkAnalyticsConfiguration {
|
|
|
192
194
|
let disabledByApp = Bundle.main.object(forInfoDictionaryKey: "BluetoothSdkAnalyticsDisabled") as? Bool == true
|
|
193
195
|
|
|
194
196
|
return BluetoothSdkAnalyticsConfiguration(
|
|
195
|
-
enabled: enabled && !disabledByApp,
|
|
197
|
+
enabled: enabled && !disabledByApp && BluetoothSdkAnalytics.postHogApiKey != nil,
|
|
196
198
|
surface: surface
|
|
197
199
|
)
|
|
198
200
|
}
|
package/package.json
CHANGED
|
@@ -12,9 +12,9 @@ export interface BluetoothSdkReleaseMetadata {
|
|
|
12
12
|
export const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({
|
|
13
13
|
"schemaVersion": 1,
|
|
14
14
|
"familyBaseVersion": "0.2.9",
|
|
15
|
-
"releaseIdentity": "0.2.9-dev.
|
|
16
|
-
"releaseSetId": "glassly-0.2.9-dev.
|
|
17
|
-
"sourceCommit": "
|
|
15
|
+
"releaseIdentity": "0.2.9-dev.458",
|
|
16
|
+
"releaseSetId": "glassly-0.2.9-dev.458",
|
|
17
|
+
"sourceCommit": "9df4bc8a0ae8775a6daf69242824f0f86805c1f2",
|
|
18
18
|
"otaManifestUrl": null,
|
|
19
19
|
"otaManifestSha256": null
|
|
20
20
|
})
|