Skip to content

Commit

Permalink
feat(analytics)!: [DRGO-1247] Ramin/update for flutter 3.24 (#838)
Browse files Browse the repository at this point in the history
Co-authored-by: mobile-apps-deriv <[email protected]>
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ramin-deriv <[email protected]>
  • Loading branch information
4 people authored Oct 10, 2024
1 parent d8d4edd commit cfdf2d8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
22 changes: 9 additions & 13 deletions packages/analytics/example/lib/pages/rudderstack.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:analytics/sdk/rudderstack/models/user_info.dart';
import 'package:analytics/sdk/rudderstack/sdk/deriv_rudderstack_sdk.dart';
import 'package:flutter/material.dart';

Expand All @@ -15,8 +16,6 @@ class _RudderStackState extends State<RudderStack> {
@override
void initState() {
super.initState();


}

@override
Expand Down Expand Up @@ -65,8 +64,8 @@ class _RudderStackState extends State<RudderStack> {
onTap: () async {
await DerivRudderstack()
.setContext(token: 'xxx-xxxx-xxxx-xxxxx-xxxx-test');
final bool result =
await DerivRudderstack().identify(userId: '998');
final bool result = await DerivRudderstack()
.identify(userInfo: UserInfo(userId: 988));
_showSnackBar(context, result);
},
),
Expand All @@ -81,9 +80,8 @@ class _RudderStackState extends State<RudderStack> {
)),
),
onTap: () async {
final bool result = await DerivRudderstack().track(
eventName: 'Application Opened'
);
final bool result = await DerivRudderstack()
.track(eventName: 'Application Opened');

_showSnackBar(context, result);
}),
Expand All @@ -98,9 +96,8 @@ class _RudderStackState extends State<RudderStack> {
)),
),
onTap: () async {
final bool result = await DerivRudderstack().screen(
screenName: 'main'
);
final bool result =
await DerivRudderstack().screen(screenName: 'main');

_showSnackBar(context, result);
}),
Expand All @@ -115,9 +112,8 @@ class _RudderStackState extends State<RudderStack> {
)),
),
onTap: () async {
final bool result = await DerivRudderstack().group(
groupId: 'Group-id-test'
);
final bool result =
await DerivRudderstack().group(groupId: 'Group-id-test');
_showSnackBar(context, result);
}),
InkWell(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,10 @@ class DerivFirebaseAnalytics implements BaseAnalytics<FirebaseConfiguration> {
/// Logs a custom Flutter Analytics event with the given [name] and event [parameters].
Future<bool> logEvent({
required String name,
Map<String, dynamic>? parameters,
Map<String, Object>? parameters,
}) async =>
_execute(() async {
await _firebaseAnalytics.logEvent(
name: name,
parameters: parameters,
);
await _firebaseAnalytics.logEvent(name: name, parameters: parameters);
});

/// Sets the user ID property.
Expand Down
4 changes: 2 additions & 2 deletions packages/analytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ environment:

dependencies:

firebase_analytics: ^10.6.2
firebase_core: ^2.20.0
firebase_core: ^3.5.0
firebase_analytics: ^11.3.2
rudder_sdk_flutter: ^2.6.0
datadog_flutter_plugin: ^1.6.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ void main() {

await derivFirebaseAnalytics.setCurrentScreen(screenName: screenName);

verify(() =>
mockFirebaseAnalytics.logScreenView(screenName: screenName))
verify(() => mockFirebaseAnalytics.logScreenView(screenName: screenName))
.called(1);
});

Expand Down Expand Up @@ -75,7 +74,7 @@ void main() {

test('should call logEvent with correct parameters', () async {
const String name = 'test_name';
const Map<String, dynamic> params = <String, dynamic>{};
const Map<String, Object> params = <String, Object>{};

when(() => mockFirebaseAnalytics.logEvent(
name: name,
Expand Down

0 comments on commit cfdf2d8

Please sign in to comment.