Skip to content

Commit f6d9f8e

Browse files
committed
No surveys returned for opted out users
1 parent 681f712 commit f6d9f8e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkgs/unified_analytics/lib/src/analytics.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ abstract class Analytics {
150150
/// run or when the message has been updated
151151
String get getConsentMessage;
152152

153-
/// Returns true if it is OK to send an analytics message. Do not cache,
153+
/// Returns true if it is OK to send an analytics message. Do not cache,
154154
/// as this depends on factors that can change, such as the configuration
155155
/// file contents.
156156
bool get okToSend;
@@ -382,8 +382,9 @@ class AnalyticsImpl implements Analytics {
382382
@override
383383
Future<List<Survey>> fetchAvailableSurveys() async {
384384
final List<Survey> surveysToShow = [];
385-
final LogFileStats? logFileStats = _logHandler.logFileStats();
385+
if (!okToSend) return surveysToShow;
386386

387+
final LogFileStats? logFileStats = _logHandler.logFileStats();
387388
if (logFileStats == null) return [];
388389

389390
for (final Survey survey in await _surveyHandler.fetchSurveyList()) {

0 commit comments

Comments
 (0)