@glassly/bluetooth-sdk 0.2.9-dev.455 → 0.2.9-dev.457

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 CHANGED
@@ -152,7 +152,11 @@ reordering rows just because RSSI metadata arrives later.
152
152
 
153
153
  ## Glassly SDK Usage Analytics
154
154
 
155
- The SDK sends three usage events to Glassly's PostHog project by default so
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 public analytics
191
- write token, not a private PostHog personal API key. Apps do not configure the
192
- analytics destination; these SDK usage events are always sent to Glassly's
193
- PostHog project unless analytics are disabled.
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
- if (!activeConfig.isReady) return
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 DEFAULT_POSTHOG_API_KEY,
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
- private const val DEFAULT_POSTHOG_API_KEY = "phc_FCweXVAxVgU7wZK4Fk3okOx4RmyNqVHJf62YpZSfJt5"
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.455"
7
- const val RELEASE_SET_ID: String = "glassly-0.2.9-dev.455"
8
- const val SOURCE_COMMIT: String = "7bd960d32d0f32eea9f4444057191ccdc107e419"
6
+ const val RELEASE_IDENTITY: String = "0.2.9-dev.457"
7
+ const val RELEASE_SET_ID: String = "glassly-0.2.9-dev.457"
8
+ const val SOURCE_COMMIT: String = "34a2e7617f4b338e75ad7fe99f2ab972d47fe0e6"
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.455",
5
- "releaseSetId": "glassly-0.2.9-dev.455",
6
- "sourceCommit": "7bd960d32d0f32eea9f4444057191ccdc107e419",
4
+ "releaseIdentity": "0.2.9-dev.457",
5
+ "releaseSetId": "glassly-0.2.9-dev.457",
6
+ "sourceCommit": "34a2e7617f4b338e75ad7fe99f2ab972d47fe0e6",
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.455\",\n \"releaseSetId\": \"glassly-0.2.9-dev.455\",\n \"sourceCommit\": \"7bd960d32d0f32eea9f4444057191ccdc107e419\",\n \"otaManifestUrl\": null,\n \"otaManifestSha256\": null\n})\n"]}
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.457\",\n \"releaseSetId\": \"glassly-0.2.9-dev.457\",\n \"sourceCommit\": \"34a2e7617f4b338e75ad7fe99f2ab972d47fe0e6\",\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.455"
14
+ private static let swiftPackageSdkVersion = "0.2.9-dev.457"
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.455"
7
- static let releaseSetId = "glassly-0.2.9-dev.455"
8
- static let sourceCommit = "7bd960d32d0f32eea9f4444057191ccdc107e419"
6
+ static let releaseIdentity = "0.2.9-dev.457"
7
+ static let releaseSetId = "glassly-0.2.9-dev.457"
8
+ static let sourceCommit = "34a2e7617f4b338e75ad7fe99f2ab972d47fe0e6"
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
- private static let defaultPostHogApiKey = "phc_FCweXVAxVgU7wZK4Fk3okOx4RmyNqVHJf62YpZSfJt5"
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": Self.defaultPostHogApiKey,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/bluetooth-sdk",
3
- "version": "0.2.9-dev.455",
3
+ "version": "0.2.9-dev.457",
4
4
  "description": "SDK for communicating with smart glasses",
5
5
  "main": "build/index.js",
6
6
  "react-native": "src/index.ts",
@@ -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.455",
16
- "releaseSetId": "glassly-0.2.9-dev.455",
17
- "sourceCommit": "7bd960d32d0f32eea9f4444057191ccdc107e419",
15
+ "releaseIdentity": "0.2.9-dev.457",
16
+ "releaseSetId": "glassly-0.2.9-dev.457",
17
+ "sourceCommit": "34a2e7617f4b338e75ad7fe99f2ab972d47fe0e6",
18
18
  "otaManifestUrl": null,
19
19
  "otaManifestSha256": null
20
20
  })