melos format

This commit is contained in:
2026-04-07 17:07:47 +02:00
parent 42ec003b05
commit 29887818f9
20 changed files with 117 additions and 142 deletions

View File

@@ -31,24 +31,15 @@ class TreezorTokenInterceptor extends Interceptor {
if (message != null && message.contains('Treezor Token Expired')) {
_handling = true;
_onTokenExpired();
Future.delayed(
const Duration(seconds: 2),
() => _handling = false,
);
Future.delayed(const Duration(seconds: 2), () => _handling = false);
} else if (err.response?.statusCode == 500) {
_handling = true;
_onTokenExpired();
Future.delayed(
const Duration(seconds: 2),
() => _handling = false,
);
Future.delayed(const Duration(seconds: 2), () => _handling = false);
} else if (err.response?.statusCode == 401) {
_handling = true;
_onUnauthorized();
Future.delayed(
const Duration(seconds: 2),
() => _handling = false,
);
Future.delayed(const Duration(seconds: 2), () => _handling = false);
}
} else if (err.response?.statusCode == 401) {
_handling = true;

View File

@@ -32,7 +32,10 @@ class DebugTrackingClient implements TrackingClient {
}
@override
Future<void> trackScreenView(String screenName, [Map<String, Object>? parameters]) async {
Future<void> trackScreenView(
String screenName, [
Map<String, Object>? parameters,
]) async {
debugPrint('[Tracking][debug] screen_view $screenName params=$parameters');
}
}

View File

@@ -40,11 +40,10 @@ class FirebaseTrackingClient implements TrackingClient {
Future<void> trackScreenView(
String screenName, [
Map<String, Object>? parameters,
]) =>
_analytics.logScreenView(
screenName: screenName,
parameters: _withConsent(parameters),
);
]) => _analytics.logScreenView(
screenName: screenName,
parameters: _withConsent(parameters),
);
Map<String, Object> _withConsent(Map<String, Object>? parameters) => {
'consent_status': _hasConsent.toString(),

View File

@@ -15,8 +15,7 @@ mixin AuthTracking on Tracking {
Future<void> legacyAuth2faRequested() =>
trackEvent('${_prefix}_2fa_requested');
Future<void> legacyAuth2faVerified() =>
trackEvent('${_prefix}_2fa_verified');
Future<void> legacyAuth2faVerified() => trackEvent('${_prefix}_2fa_verified');
Future<void> legacyAuth2faFailure(String reason) =>
trackEvent('${_prefix}_2fa_failure', {'reason': reason});

View File

@@ -3,12 +3,8 @@ import 'package:sf_tracking/src/tracking.dart';
const _prefix = 'legacy_control_panel';
mixin ControlPanelTracking on Tracking {
Future<void> legacyControlPanelDeviceSelected({
required int totalDevices,
}) =>
trackEvent('${_prefix}_device_selected', {
'total_devices': totalDevices,
});
Future<void> legacyControlPanelDeviceSelected({required int totalDevices}) =>
trackEvent('${_prefix}_device_selected', {'total_devices': totalDevices});
Future<void> legacyControlPanelPositionsRefreshed() =>
trackEvent('${_prefix}_positions_refreshed');

View File

@@ -8,31 +8,25 @@ mixin DeviceSetupTracking on Tracking {
Future<void> legacyDeviceSetupStepCompleted({
required String step,
required int durationSeconds,
}) =>
trackEvent('${_prefix}_step_completed', {
'step': step,
'duration_seconds': durationSeconds,
});
}) => trackEvent('${_prefix}_step_completed', {
'step': step,
'duration_seconds': durationSeconds,
});
Future<void> legacyDeviceSetupCompleted({
required String childGender,
required String relationType,
required int childAgeYears,
}) =>
trackEvent('${_prefix}_completed', {
'child_gender': childGender,
'relation_type': relationType,
'child_age_years': childAgeYears,
});
}) => trackEvent('${_prefix}_completed', {
'child_gender': childGender,
'relation_type': relationType,
'child_age_years': childAgeYears,
});
Future<void> legacyDeviceSetupFailed({
required String atStep,
required String reason,
}) =>
trackEvent('${_prefix}_failed', {
'at_step': atStep,
'reason': reason,
});
}) => trackEvent('${_prefix}_failed', {'at_step': atStep, 'reason': reason});
Future<void> legacyDeviceSetupCancelled(String atStep) =>
trackEvent('${_prefix}_cancelled', {'at_step': atStep});

View File

@@ -29,11 +29,10 @@ mixin DeviceTracking on Tracking {
Future<void> legacyDeviceVolumeControlChanged({
required String type,
required int level,
}) =>
trackEvent('${_prefix}_volume_control_changed', {
'type': type,
'level': level,
});
}) => trackEvent('${_prefix}_volume_control_changed', {
'type': type,
'level': level,
});
Future<void> legacyDeviceBackgroundImageChanged() =>
trackEvent('${_prefix}_background_image_changed');
@@ -44,20 +43,18 @@ mixin DeviceTracking on Tracking {
Future<void> legacyDeviceScheduledActivityAdded({
required int weekDay,
required String period,
}) =>
trackEvent('${_prefix}_scheduled_activity_added', {
'week_day': weekDay,
'period': period,
});
}) => trackEvent('${_prefix}_scheduled_activity_added', {
'week_day': weekDay,
'period': period,
});
Future<void> legacyDeviceScheduledActivityUpdated({
required int weekDay,
required String period,
}) =>
trackEvent('${_prefix}_scheduled_activity_updated', {
'week_day': weekDay,
'period': period,
});
}) => trackEvent('${_prefix}_scheduled_activity_updated', {
'week_day': weekDay,
'period': period,
});
Future<void> legacyDeviceScheduledActivityRemoved() =>
trackEvent('${_prefix}_scheduled_activity_removed');
@@ -65,10 +62,10 @@ mixin DeviceTracking on Tracking {
Future<void> legacyDeviceRewardsGranted({required int amount}) =>
trackEvent('${_prefix}_rewards_granted', {'amount': amount});
Future<void> legacyDeviceActivityPedometerToggled(bool enabled) =>
trackEvent('${_prefix}_activity_pedometer_toggled', {
'enabled': enabled.toString(),
});
Future<void> legacyDeviceActivityPedometerToggled(bool enabled) => trackEvent(
'${_prefix}_activity_pedometer_toggled',
{'enabled': enabled.toString()},
);
Future<void> legacyDeviceActivityMeterTimeRangeChanged(String range) =>
trackEvent('${_prefix}_activity_meter_time_range_changed', {
@@ -90,12 +87,11 @@ mixin DeviceTracking on Tracking {
required String range,
required int totalDurationSeconds,
required String topAppName,
}) =>
trackEvent('${_prefix}_apps_use_time_range_changed', {
'range': range,
'total_duration_seconds': totalDurationSeconds,
'top_app_name': topAppName,
});
}) => trackEvent('${_prefix}_apps_use_time_range_changed', {
'range': range,
'total_duration_seconds': totalDurationSeconds,
'top_app_name': topAppName,
});
Future<void> legacyDeviceCallHistoryFilterChanged(String filter) =>
trackEvent('${_prefix}_call_history_filter_changed', {'filter': filter});

View File

@@ -24,25 +24,25 @@ mixin LocationTracking on Tracking {
Future<void> legacyLocationHistoryLoaded() =>
trackEvent('${_prefix}_history_loaded');
Future<void> legacyLocationFrequencyUpdated(int seconds) =>
trackEvent('${_prefix}_frequency_updated', {
'frequency_seconds': seconds,
});
Future<void> legacyLocationFrequencyUpdated(int seconds) => trackEvent(
'${_prefix}_frequency_updated',
{'frequency_seconds': seconds},
);
Future<void> legacyLocationMapGeofencesToggled(bool visible) =>
trackEvent('${_prefix}_map_geofences_toggled', {
'visible': visible.toString(),
});
Future<void> legacyLocationMapGeofencesToggled(bool visible) => trackEvent(
'${_prefix}_map_geofences_toggled',
{'visible': visible.toString()},
);
Future<void> legacyLocationMapFrequentPlacesToggled(bool visible) =>
trackEvent('${_prefix}_map_frequent_places_toggled', {
'visible': visible.toString(),
});
Future<void> legacyLocationMapRouteTrailToggled(bool visible) =>
trackEvent('${_prefix}_map_route_trail_toggled', {
'visible': visible.toString(),
});
Future<void> legacyLocationMapRouteTrailToggled(bool visible) => trackEvent(
'${_prefix}_map_route_trail_toggled',
{'visible': visible.toString()},
);
Future<void> legacyLocationPlaceCreationStarted(String mode) =>
trackEvent('${_prefix}_place_creation_started', {'mode': mode});
@@ -53,20 +53,18 @@ mixin LocationTracking on Tracking {
Future<void> legacyLocationRadiusConfirmed({
required double radius,
required bool isEditing,
}) =>
trackEvent('${_prefix}_radius_confirmed', {
'radius': radius,
'is_editing': isEditing.toString(),
});
}) => trackEvent('${_prefix}_radius_confirmed', {
'radius': radius,
'is_editing': isEditing.toString(),
});
Future<void> legacyLocationPlaceCreationCancelled({
required String mode,
required String atStep,
}) =>
trackEvent('${_prefix}_place_creation_cancelled', {
'mode': mode,
'at_step': atStep,
});
}) => trackEvent('${_prefix}_place_creation_cancelled', {
'mode': mode,
'at_step': atStep,
});
Future<void> legacyLocationGeofenceSelected() =>
trackEvent('${_prefix}_geofence_selected');
@@ -92,15 +90,15 @@ mixin LocationTracking on Tracking {
Future<void> legacyLocationHistoryPositionDismissed() =>
trackEvent('${_prefix}_history_position_dismissed');
Future<void> legacyLocationFollowingToggled(bool enabled) =>
trackEvent('${_prefix}_following_toggled', {
'enabled': enabled.toString(),
});
Future<void> legacyLocationFollowingToggled(bool enabled) => trackEvent(
'${_prefix}_following_toggled',
{'enabled': enabled.toString()},
);
Future<void> legacyLocationMapActionsExpanded(bool expanded) =>
trackEvent('${_prefix}_map_actions_expanded', {
'expanded': expanded.toString(),
});
Future<void> legacyLocationMapActionsExpanded(bool expanded) => trackEvent(
'${_prefix}_map_actions_expanded',
{'expanded': expanded.toString()},
);
Future<void> legacyLocationMapZoomed(double zoom) =>
trackEvent('${_prefix}_map_zoomed', {'zoom': zoom});

View File

@@ -20,17 +20,15 @@ mixin SettingsTracking on Tracking {
Future<void> legacySettingsBlockPhoneContactAdded({
required int totalCount,
}) =>
trackEvent('${_prefix}_block_phone_contact_added', {
'total_count': totalCount,
});
}) => trackEvent('${_prefix}_block_phone_contact_added', {
'total_count': totalCount,
});
Future<void> legacySettingsBlockPhoneContactRemoved({
required int totalCount,
}) =>
trackEvent('${_prefix}_block_phone_contact_removed', {
'total_count': totalCount,
});
}) => trackEvent('${_prefix}_block_phone_contact_removed', {
'total_count': totalCount,
});
Future<void> legacySettingsDisableFunctionsChanged() =>
trackEvent('${_prefix}_disable_functions_changed');
@@ -51,11 +49,10 @@ mixin SettingsTracking on Tracking {
Future<void> legacySettingsAlertsConfigured({
required int alertCount,
required String alertsEnabled,
}) =>
trackEvent('${_prefix}_alerts_configured', {
'alert_count': alertCount,
'alerts_enabled': alertsEnabled,
});
}) => trackEvent('${_prefix}_alerts_configured', {
'alert_count': alertCount,
'alerts_enabled': alertsEnabled,
});
Future<void> legacySettingsTimezoneChanged(String timezone) =>
trackEvent('${_prefix}_timezone_changed', {'timezone': timezone});

View File

@@ -8,9 +8,8 @@ mixin SupportTracking on Tracking {
Future<void> legacySupportContactInitiated({
required String channel,
required String country,
}) =>
trackEvent('${_prefix}_contact_initiated', {
'channel': channel,
'country': country,
});
}) => trackEvent('${_prefix}_contact_initiated', {
'channel': channel,
'country': country,
});
}

View File

@@ -1,5 +1,8 @@
/// Minimal interface for components that only need to log screen views
/// (typically navigation observers). Implemented by `SfTrackingRepository`.
abstract class NavigationTracking {
Future<void> trackScreenView({required String screenName, Map<String, Object>? parameters});
Future<void> trackScreenView({
required String screenName,
Map<String, Object>? parameters,
});
}

View File

@@ -39,7 +39,8 @@ class SfRouterListener {
_tracking
.trackScreenView(screenName: screenName)
.catchError(
(Object error) => debugPrint('[SfRouterListener] $screenName failed: $error'),
(Object error) =>
debugPrint('[SfRouterListener] $screenName failed: $error'),
);
}

View File

@@ -53,8 +53,10 @@ class SfTrackingRepository extends Tracking
}
@override
Future<void> setAnalyticsStatus({bool enabled = true}) =>
_broadcast('setAnalyticsStatus', (c) => c.setAnalyticsStatus(enabled: enabled));
Future<void> setAnalyticsStatus({bool enabled = true}) => _broadcast(
'setAnalyticsStatus',
(c) => c.setAnalyticsStatus(enabled: enabled),
);
@override
Future<void> setConsentStatus(bool hasConsent) =>
@@ -65,8 +67,10 @@ class SfTrackingRepository extends Tracking
_broadcast('setUserId', (c) => c.setUserId(userId));
@override
Future<void> setUserProperty(String name, String value) =>
_broadcast('setUserProperty($name)', (c) => c.setUserProperty(name, value));
Future<void> setUserProperty(String name, String value) => _broadcast(
'setUserProperty($name)',
(c) => c.setUserProperty(name, value),
);
@protected
@override

View File

@@ -23,9 +23,9 @@ class UserInfoTrackingListener {
await _tracking.setUserProperty('user_language', language);
await _tracking.setUserProperty(
'user_signup_date',
DateTime.fromMillisecondsSinceEpoch(createdAtMillis)
.toUtc()
.toIso8601String(),
DateTime.fromMillisecondsSinceEpoch(
createdAtMillis,
).toUtc().toIso8601String(),
);
await _tracking.setUserProperty('user_has_phone', hasPhone.toString());
await _tracking.setUserProperty('user_has_api_key', hasApiKey.toString());

View File

@@ -37,8 +37,10 @@ class _RecordingClient implements TrackingClient {
}
@override
Future<void> trackScreenView(String screenName,
[Map<String, Object>? parameters]) async {
Future<void> trackScreenView(
String screenName, [
Map<String, Object>? parameters,
]) async {
screenViews.add(screenName);
}
}
@@ -71,8 +73,10 @@ class _BrokenClient implements TrackingClient {
}
@override
Future<void> trackScreenView(String screenName,
[Map<String, Object>? parameters]) async {
Future<void> trackScreenView(
String screenName, [
Map<String, Object>? parameters,
]) async {
throw StateError('boom');
}
}