Skip to content

Commit

Permalink
fix: mixpanel events properties
Browse files Browse the repository at this point in the history
  • Loading branch information
matisiekpl committed Jan 20, 2025
1 parent 80aa797 commit 90e004c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
14 changes: 10 additions & 4 deletions lib/bloc/edit/edit_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,23 @@ class EditCubit extends Cubit<EditState> {
var s = state;
if (s is EditInProgress) {
if (s.aed.id == 0) {
await pointsRepository.insertDefibrillator(s.aed);
analytics.event(name: saveInsertEvent);
if (!Platform.environment.containsKey('FLUTTER_TEST')) {
mixpanel.track(saveInsertEvent, properties: {'aed': s.aed.id});
mixpanel.track(saveInsertEvent, properties: {
'aed_id': s.aed.id,
'aed_node_url': osmNodePrefix + s.aed.id.toString()
});
}
await pointsRepository.insertDefibrillator(s.aed);
} else {
await pointsRepository.updateDefibrillator(s.aed);
analytics.event(name: saveUpdateEvent);
if (!Platform.environment.containsKey('FLUTTER_TEST')) {
mixpanel.track(saveUpdateEvent, properties: {'aed': s.aed.id});
mixpanel.track(saveUpdateEvent, properties: {
'aed_id': s.aed.id,
'aed_node_url': osmNodePrefix + s.aed.id.toString()
});
}
await pointsRepository.updateDefibrillator(s.aed);
}
emit(EditReady(enabled: false, cursor: state.cursor));
return s.aed;
Expand Down
1 change: 1 addition & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final rome = LatLng(41.902782, 12.496366);

const valhalla = 'https://sa.tt.com.pl/valhalla2Move/raw_route.php';
const plausible = 'https://analytics.enteam.pl';
const osmNodePrefix = 'https://www.openstreetmap.org/node/';
const iosUserAgent =
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Mobile/15E148 Safari/604.1';
const androidUserAgent =
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/edit/edit_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'package:aed_map/bloc/edit/edit_cubit.dart';
import 'package:aed_map/bloc/edit/edit_state.dart';
import 'package:aed_map/constants.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -131,8 +132,7 @@ class EditForm extends StatelessWidget {
leading: const Icon(CupertinoIcons.cube_box),
title: Text(appLocalizations.viewOpenStreetMapNode),
onPressed: (context) {
launchUrl(Uri.parse(
'https://www.openstreetmap.org/node/${state.aed.id}'));
launchUrl(Uri.parse('$osmNodePrefix${state.aed.id}'));
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.41+41
version: 1.0.42+42

environment:
sdk: ^3.5.3
Expand Down

0 comments on commit 90e004c

Please sign in to comment.