Skip to content

Commit e6c3e6d

Browse files
committed
feat(firebase_analytics): restrict logInAppPurchase to iOS
1 parent 426f1da commit e6c3e6d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/firebase_analytics/firebase_analytics/lib/firebase_analytics.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import 'dart:io';
6+
57
import 'package:firebase_analytics_platform_interface/firebase_analytics_platform_interface.dart';
68
import 'package:firebase_core/firebase_core.dart';
79
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'

packages/firebase_analytics/firebase_analytics/lib/src/firebase_analytics.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,9 @@ class FirebaseAnalytics extends FirebasePluginPlatform {
12231223
bool? subscription,
12241224
num? value,
12251225
}) {
1226+
if (!Platform.isIOS) {
1227+
throw UnimplementedError('logInAppPurchase() is only supported on iOS.');
1228+
}
12261229
return _delegate.logEvent(
12271230
name: 'in_app_purchase',
12281231
parameters: filterOutNulls(<String, Object?>{

packages/firebase_analytics/firebase_analytics_web/lib/firebase_analytics_web.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ class FirebaseAnalyticsWeb extends FirebaseAnalyticsPlatform {
7070
Map<String, Object?>? parameters,
7171
AnalyticsCallOptions? callOptions,
7272
}) async {
73-
if (name == 'in_app_purchase') {
74-
throw UnimplementedError('in_app_purchase() is not supported on Web.');
75-
}
7673
return convertWebExceptions(() {
7774
return _delegate.logEvent(
7875
name: name,

0 commit comments

Comments
 (0)