Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/lib/providers/device_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ class DeviceProvider extends ChangeNotifier implements IDeviceServiceSubsciption

void onDeviceDisconnected() async {
Logger.debug('onDisconnected inside: $connectedDevice');

final String trackFirmware = [connectedDevice?.firmwareRevision, pairedDevice?.firmwareRevision, SharedPreferencesUtil().btDevice.firmwareRevision].firstWhere((v) => v != null && v.isNotEmpty && v != 'Unknown', orElse: () => 'Unknown');

_havingNewFirmware = false;
setConnectedDevice(null);
setisDeviceStorageSupport();
Expand All @@ -300,7 +303,7 @@ class DeviceProvider extends ChangeNotifier implements IDeviceServiceSubsciption
body: 'Please reconnect to continue using your Omi.',
);
});
MixpanelManager().deviceDisconnected();
MixpanelManager().deviceDisconnected(firmwareRevision: trackFirmware);

// Retired 1s to prevent the race condition made by standby power of ble device
Future.delayed(const Duration(seconds: 1), () {
Expand Down
4 changes: 3 additions & 1 deletion app/lib/utils/analytics/mixpanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ class MixpanelManager {
..._preferences.btDevice.toJson(),
});

void deviceDisconnected() => track('Device Disconnected');
void deviceDisconnected({String? firmwareRevision}) => track('Device Disconnected', properties: {
if (firmwareRevision != null) 'firmware_revision': firmwareRevision,
});

void memoriesPageCategoryOpened(MemoryCategory category) =>
track('Fact Page Category Opened', properties: {'category': category.toString().split('.').last});
Expand Down