From e7aa17747d213670cae997d182e8d6dc08189aae Mon Sep 17 00:00:00 2001 From: xiaoweii Date: Wed, 25 Oct 2023 15:02:57 +0800 Subject: [PATCH] feat: add readme --- .gitignore | 1 + .pubignore | 9 + CHANGELOG.md | 4 +- README.md | 188 +++++++++++++++++- android/build.gradle | 4 +- android/settings.gradle | 2 +- android/src/main/AndroidManifest.xml | 2 +- .../ClickstreamFlutterPlugin.kt | 16 +- .../ClickstreamFlutterPluginTest.kt | 2 +- .../plugin_integration_test.dart | 12 +- example/ios/Podfile.lock | 14 +- example/lib/main.dart | 45 ++--- example/pubspec.lock | 4 +- example/pubspec.yaml | 2 +- example/test/widget_test.dart | 4 +- ios/Assets/.gitkeep | 0 ios/Assets/amplifyconfiguration.json | 15 -- ios/Classes/ClickstreamFlutterPlugin.swift | 7 + ios/amplifyconfiguration.json | 15 -- ....podspec => clickstream_analytics.podspec} | 8 +- ...lutter.dart => clickstream_analytics.dart} | 5 +- ...clickstream_analytics_method_channel.dart} | 8 +- ...kstream_analytics_platform_interface.dart} | 5 +- pubspec.yaml | 10 +- ...ickstream_flutter_method_channel_test.dart | 6 +- test/clickstream_flutter_test.dart | 9 +- 26 files changed, 283 insertions(+), 114 deletions(-) create mode 100644 .pubignore rename android/src/main/kotlin/software/aws/solution/{clickstream_flutter => clickstream_analytics}/ClickstreamFlutterPlugin.kt (94%) rename android/src/test/kotlin/software/aws/solution/{clickstream_flutter => clickstream_analytics}/ClickstreamFlutterPluginTest.kt (94%) delete mode 100644 ios/Assets/.gitkeep delete mode 100644 ios/Assets/amplifyconfiguration.json delete mode 100644 ios/amplifyconfiguration.json rename ios/{clickstream_flutter.podspec => clickstream_analytics.podspec} (74%) rename lib/{clickstream_flutter.dart => clickstream_analytics.dart} (94%) rename lib/{clickstream_flutter_method_channel.dart => clickstream_analytics_method_channel.dart} (86%) rename lib/{clickstream_flutter_platform_interface.dart => clickstream_analytics_platform_interface.dart} (92%) diff --git a/.gitignore b/.gitignore index 96486fd..383c7b1 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ migrate_working_dir/ .dart_tool/ .packages build/ +coverage/ diff --git a/.pubignore b/.pubignore new file mode 100644 index 0000000..b88d1de --- /dev/null +++ b/.pubignore @@ -0,0 +1,9 @@ +*.iml +test +coverage +build +android/src/test +ios/Clickstream/* +!ios/Clickstream/Sources +example/integration_test +example/test \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 41cc7d8..8be37fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.1 +## 0.1.0 -* TODO: Describe initial release. +* feat: add basic android and swift SDK APIs. diff --git a/README.md b/README.md index 2b94624..fcf130d 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,182 @@ -# clickstream_flutter +# AWS Solution Clickstream Analytics SDK for Flutter -clickstream flutter SDK +## Introduction -## Getting Started +Clickstream Flutter SDK can help you easily collect and report events from browser to AWS. This SDK is part of an AWS solution - [Clickstream Analytics on AWS](https://github.com/awslabs/clickstream-analytics-on-aws), which provisions data pipeline to ingest and process event data into AWS services such as S3, Redshift. -This project is a starting point for a Flutter -[plug-in package](https://flutter.dev/developing-packages/), -a specialized package that includes platform-specific implementation code for -Android and/or iOS. +The SDK relies on the [Clickstream Android SDK](https://github.com/awslabs/clickstream-android) and [Clickstream Swift SDK](https://github.com/awslabs/clickstream-swift). Therefore, flutter SDK also supports automatically collect common user events and attributes (e.g., session start, first open) In addition, we've added easy-to-use APIs to simplify data collection in Flutter apps. -For help getting started with Flutter development, view the -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. \ No newline at end of file +## Integrate SDK + +### Include SDK + +```bash +flutter pub add clickstream_analytics +``` + +After complete, rebuild your Flutter application: + +```bash +flutter run +``` + +### Initialize the SDK + +Copy your configuration code from your clickstream solution web console, the configuration code should look like as follows. You can also manually add this code snippet and replace the values of appId and endpoint after you registered app to a data pipeline in the Clickstream Analytics solution console. + +```dart +import 'package:clickstream_analytics/clickstream_analytics.dart'; + +final analytics = ClickstreamAnalytics(); +analytics.init({ + appId: "your appId", + endpoint: "https://example.com/collect" +}); +``` + +Please noteļ¼š + +1. Your `appId` and `endpoint` are already set up in it. +2. We only need to initialize the SDK once after the application starts. It is recommended to do it in the main function of your App. +3. We can use `bool result = await analytics.init()` to get the boolean value of the initialization result. + +### Start using + +#### Record event + +Add the following code where you need to record event. + +```dart +import 'package:clickstream_analytics/clickstream_analytics.dart'; + +final analytics = ClickstreamAnalytics(); + +// record event with attributes +analytics.record(name: 'button_click', attributes: { + "event_category": "shoes", + "currency": "CNY", + "value": 279.9 +}); + +//record event with name +analytics.record(name: "button_click"); +``` + +#### Login and logout + +```dart +/// when user login success. +analytics.setUserId("userId"); + +/// when user logout +analytics.setUserId(null); +``` + +#### Add user attribute + +```dart +analytics.setUserAttributes({ + "userName":"carl", + "userAge": 22 +}); +``` + +When opening for the first time after integrating the SDK, you need to manually set the user attributes once, and current login user's attributes will be cached in native disk, so the next time browser open you don't need to set all user's attribute again, of course you can use the same api `analytics.setUserAttributes()` to update the current user's attribute when it changes. + +#### Add global attribute + +```dart +analytics.addGlobalAttributes({ + "_traffic_source_medium": "Search engine", + "_traffic_source_name": "Summer promotion", + "level": 10 +}); +``` + +It is recommended to set global attributes after each SDK initialization, global attributes will be included in all events that occur after it is set. + +#### Other configurations + +In addition to the required `appId` and `endpoint`, you can configure other information to get more customized usage: + +```dart +final analytics = ClickstreamAnalytics(); +analytics.init( + appId: "your appId", + endpoint: "https://example.com/collect", + isLogEvents: false, + isCompressEvents: false, + sendEventsInterval: 5000, + isTrackScreenViewEvents: true, + isTrackUserEngagementEvents: true, + isTrackAppExceptionEvents: false, + authCookie: "your auth cookie", + sessionTimeoutDuration: 1800000 +); +``` + +Here is an explanation of each property: + +- **appId (Required)**: the app id of your project in control plane. +- **endpoint (Required)**: the endpoint path you will upload the event to AWS server. +- **isLogEvents**: whether to print out event json for debugging, default is false. +- **isCompressEvents**: whether to compress event content when uploading events, default is `true` +- **sendEventsInterval**: event sending interval millisecond, works only bath send mode, the default value is `5000` +- **isTrackScreenViewEvents**: whether auto record screen view events in app, default is `true` +- **isTrackUserEngagementEvents**: whether auto record user engagement events in app, default is `true` +- **isTrackAppExceptionEvents**: whether auto track exception event in app, default is `false` +- **authCookie**: your auth cookie for AWS application load balancer auth cookie. +- **sessionTimeoutDuration**: the duration for session timeout millisecond, default is 1800000 + +#### Configuration update + +You can update the default configuration after initializing the SDK, below are the additional configuration options you can customize. + +```dart +final analytics = ClickstreamAnalytics(); +analytics.updateConfigure( + appId: "your appId", + endpoint: "https://example.com/collect", + isLogEvents: true, + isCompressEvents: false, + isTrackScreenViewEvents: false + isTrackUserEngagementEvents: false, + isTrackAppExceptionEvents: false, + sessionTimeoutDuration: 100000, + authCookie: "test cookie"); +``` + +#### Send event immediately + +```dart +final analytics = ClickstreamAnalytics(); +analytics.flushEvents(); +``` + +## How to build and test locally + +### Build + +```bash +flutter pub get +``` + +### Format and lint + +```bash +dart format . && flutter analyze +``` + +### Test + +```bash +flutter test +``` + +## Security + +See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. + +## License + +This library is licensed under the [Apache 2.0 License](./LICENSE). diff --git a/android/build.gradle b/android/build.gradle index 40e7772..9a51158 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,4 +1,4 @@ -group 'software.aws.solution.clickstream_flutter' +group 'software.aws.solution.clickstream_analytics' version '1.0-SNAPSHOT' buildscript { @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' android { if (project.android.hasProperty("namespace")) { - namespace 'software.aws.solution.clickstream_flutter' + namespace 'software.aws.solution.clickstream_analytics' } compileSdkVersion 33 diff --git a/android/settings.gradle b/android/settings.gradle index 4613fad..6b7d429 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1 +1 @@ -rootProject.name = 'clickstream_flutter' +rootProject.name = 'clickstream_analytics' diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index f5376d0..936f8cf 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,3 +1,3 @@ + package="software.aws.solution.clickstream_analytics"> diff --git a/android/src/main/kotlin/software/aws/solution/clickstream_flutter/ClickstreamFlutterPlugin.kt b/android/src/main/kotlin/software/aws/solution/clickstream_analytics/ClickstreamFlutterPlugin.kt similarity index 94% rename from android/src/main/kotlin/software/aws/solution/clickstream_flutter/ClickstreamFlutterPlugin.kt rename to android/src/main/kotlin/software/aws/solution/clickstream_analytics/ClickstreamFlutterPlugin.kt index 1adc22b..9390d02 100644 --- a/android/src/main/kotlin/software/aws/solution/clickstream_flutter/ClickstreamFlutterPlugin.kt +++ b/android/src/main/kotlin/software/aws/solution/clickstream_analytics/ClickstreamFlutterPlugin.kt @@ -1,4 +1,18 @@ -package software.aws.solution.clickstream_flutter +/* + * Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package software.aws.solution.clickstream_analytics import android.app.Activity import com.amazonaws.logging.Log diff --git a/android/src/test/kotlin/software/aws/solution/clickstream_flutter/ClickstreamFlutterPluginTest.kt b/android/src/test/kotlin/software/aws/solution/clickstream_analytics/ClickstreamFlutterPluginTest.kt similarity index 94% rename from android/src/test/kotlin/software/aws/solution/clickstream_flutter/ClickstreamFlutterPluginTest.kt rename to android/src/test/kotlin/software/aws/solution/clickstream_analytics/ClickstreamFlutterPluginTest.kt index 9f69015..70b2b44 100644 --- a/android/src/test/kotlin/software/aws/solution/clickstream_flutter/ClickstreamFlutterPluginTest.kt +++ b/android/src/test/kotlin/software/aws/solution/clickstream_analytics/ClickstreamFlutterPluginTest.kt @@ -1,4 +1,4 @@ -package software.aws.solution.clickstream_flutter +package software.aws.solution.clickstream_analytics import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel diff --git a/example/integration_test/plugin_integration_test.dart b/example/integration_test/plugin_integration_test.dart index 953f468..f9b8a92 100644 --- a/example/integration_test/plugin_integration_test.dart +++ b/example/integration_test/plugin_integration_test.dart @@ -1,16 +1,10 @@ -// This is a basic Flutter integration test. -// -// Since integration tests run in a full Flutter application, they can interact -// with the host side of a plugin implementation, unlike Dart unit tests. -// -// For more information about Flutter integration tests, please see -// https://docs.flutter.dev/cookbook/testing/integration/introduction - +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'package:clickstream_flutter/clickstream_flutter.dart'; +import 'package:clickstream_analytics/clickstream_analytics.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index e74f0d5..3388114 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -2,10 +2,10 @@ PODS: - Amplify (1.30.3): - Amplify/Default (= 1.30.3) - Amplify/Default (1.30.3) - - clickstream_flutter (0.0.1): - - clickstream_flutter/Clickstream (= 0.0.1) + - clickstream_analytics (0.0.1): + - clickstream_analytics/Clickstream (= 0.0.1) - Flutter - - clickstream_flutter/Clickstream (0.0.1): + - clickstream_analytics/Clickstream (0.0.1): - Amplify (= 1.30.3) - Flutter - GzipSwift (= 5.1.1) @@ -19,7 +19,7 @@ PODS: - SQLite.swift/standard (0.13.2) DEPENDENCIES: - - clickstream_flutter (from `.symlinks/plugins/clickstream_flutter/ios`) + - clickstream_analytics (from `.symlinks/plugins/clickstream_analytics/ios`) - Flutter (from `Flutter`) - integration_test (from `.symlinks/plugins/integration_test/ios`) @@ -30,8 +30,8 @@ SPEC REPOS: - SQLite.swift EXTERNAL SOURCES: - clickstream_flutter: - :path: ".symlinks/plugins/clickstream_flutter/ios" + clickstream_analytics: + :path: ".symlinks/plugins/clickstream_analytics/ios" Flutter: :path: Flutter integration_test: @@ -39,7 +39,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Amplify: 516e5da5f256f62841b6bc659e1644bc999d7b6e - clickstream_flutter: d5dd3ad04cb641b27c1014c23b4cdbc98f6956dc + clickstream_analytics: 22312ed8d353813f1f6847aecb4e04b62bdda478 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 GzipSwift: 893f3e48e597a1a4f62fafcb6514220fcf8287fa integration_test: 13825b8a9334a850581300559b8839134b124670 diff --git a/example/lib/main.dart b/example/lib/main.dart index 22777b5..547e002 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,8 +1,9 @@ -import 'package:flutter/material.dart'; -import 'dart:async'; +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 -import 'package:flutter/services.dart'; -import 'package:clickstream_flutter/clickstream_flutter.dart'; +import 'package:clickstream_analytics/clickstream_analytics.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); @@ -22,24 +23,12 @@ class _MyAppState extends State { @override void initState() { super.initState(); - initPlatformState(); } - // Platform messages are asynchronous, so we initialize in an async method. - Future initPlatformState() async { - String platformVersion; - // Platform messages may fail, so we use a try/catch PlatformException. - // We also handle the message potentially returning null. - try { - platformVersion = 'Unknown platform version'; - } on PlatformException { - platformVersion = 'Failed to get platform version.'; + void log(String message) { + if (kDebugMode) { + print(message); } - - // If the widget was removed from the tree while the asynchronous platform - // message was in flight, we want to discard the reply rather than calling - // setState to update our non-existent appearance. - if (!mounted) return; } @override @@ -55,12 +44,12 @@ class _MyAppState extends State { leading: const Icon(Icons.not_started_outlined), title: const Text('initSDK'), onTap: () async { - var result = await analytics.init( + bool result = await analytics.init( appId: "shopping", endpoint: testEndpoint, isLogEvents: true, isCompressEvents: false); - print("init SDK result is:$result"); + log("init SDK result is:$result"); }, minLeadingWidth: 0, ), @@ -78,7 +67,7 @@ class _MyAppState extends State { "boolValue": true, "value": 279.9 }); - print("recorded testEvent and testEventWithName"); + log("recorded testEvent and testEventWithName"); }, minLeadingWidth: 0, ), @@ -88,7 +77,7 @@ class _MyAppState extends State { onTap: () async { analytics.setUserId("12345"); analytics.setUserId(null); - print("setUserId"); + log("setUserId"); }, minLeadingWidth: 0, ), @@ -100,7 +89,7 @@ class _MyAppState extends State { {"category": 'shoes', "currency": 'CNY', "value": 279.9}); analytics.setUserAttributes({}); analytics.setUserAttributes({"testNull": null}); - print("setUserAttributes"); + log("setUserAttributes"); }, minLeadingWidth: 0, ), @@ -114,7 +103,7 @@ class _MyAppState extends State { "isTrue": true, "Score": 24.32 }); - print("addGlobalAttributes"); + log("addGlobalAttributes"); }, minLeadingWidth: 0, ), @@ -123,7 +112,7 @@ class _MyAppState extends State { title: const Text('deleteGlobalAttributes'), onTap: () async { analytics.deleteGlobalAttributes(["Score", "_channel"]); - print("deleteGlobalAttributes Score and _channel"); + log("deleteGlobalAttributes Score and _channel"); }, minLeadingWidth: 0, ), @@ -140,7 +129,7 @@ class _MyAppState extends State { authCookie: "test cookie", isTrackScreenViewEvents: false); analytics.updateConfigure(); - print("updateConfigure"); + log("updateConfigure"); }, minLeadingWidth: 0, ), @@ -149,7 +138,7 @@ class _MyAppState extends State { title: const Text('flushEvents'), onTap: () async { analytics.flushEvents(); - print("flushEvents"); + log("flushEvents"); }, minLeadingWidth: 0, ), diff --git a/example/pubspec.lock b/example/pubspec.lock index ff94088..092add3 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -25,13 +25,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" - clickstream_flutter: + clickstream_analytics: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.0.1" + version: "0.1.0" clock: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2cbc787..3305679 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: flutter: sdk: flutter - clickstream_flutter: + clickstream_analytics: # When depending on this package from a real application you should use: # clickstream_flutter: ^x.y.z # See https://dart.dev/tools/pub/dependencies#version-constraints diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index a56ab1a..8721e25 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -18,8 +18,8 @@ void main() { // Verify that platform version is retrieved. expect( find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data!.startsWith('Running on:'), + (Widget widget) => + widget is Text && widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/ios/Assets/.gitkeep b/ios/Assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ios/Assets/amplifyconfiguration.json b/ios/Assets/amplifyconfiguration.json deleted file mode 100644 index c1f3658..0000000 --- a/ios/Assets/amplifyconfiguration.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "UserAgent": "aws-solution/clickstream", - "Version": "1.0", - "analytics": { - "plugins": { - "awsClickstreamPlugin": { - "appId": "", - "endpoint": "", - "isCompressEvents": true, - "autoFlushEventsInterval": 10000, - "isTrackAppExceptionEvents": false - } - } - } -} \ No newline at end of file diff --git a/ios/Classes/ClickstreamFlutterPlugin.swift b/ios/Classes/ClickstreamFlutterPlugin.swift index f78a6a6..0e6613e 100644 --- a/ios/Classes/ClickstreamFlutterPlugin.swift +++ b/ios/Classes/ClickstreamFlutterPlugin.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + import Amplify import Flutter import UIKit diff --git a/ios/amplifyconfiguration.json b/ios/amplifyconfiguration.json deleted file mode 100644 index c1f3658..0000000 --- a/ios/amplifyconfiguration.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "UserAgent": "aws-solution/clickstream", - "Version": "1.0", - "analytics": { - "plugins": { - "awsClickstreamPlugin": { - "appId": "", - "endpoint": "", - "isCompressEvents": true, - "autoFlushEventsInterval": 10000, - "isTrackAppExceptionEvents": false - } - } - } -} \ No newline at end of file diff --git a/ios/clickstream_flutter.podspec b/ios/clickstream_analytics.podspec similarity index 74% rename from ios/clickstream_flutter.podspec rename to ios/clickstream_analytics.podspec index fc31316..b2cc817 100644 --- a/ios/clickstream_flutter.podspec +++ b/ios/clickstream_analytics.podspec @@ -1,17 +1,17 @@ # # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint clickstream_flutter.podspec` to validate before publishing. +# Run `pod lib lint clickstream_analytics.podspec` to validate before publishing. # Pod::Spec.new do |s| - s.name = 'clickstream_flutter' + s.name = 'clickstream_analytics' s.version = '0.0.1' s.summary = 'clickstream flutter SDK' s.description = <<-DESC clickstream flutter SDK DESC - s.homepage = 'http://example.com' + s.homepage = 'https://github.com/awslabs/clickstream-flutter' s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } + s.author = { 'AWS GCR Solutions Team' => 'aws-gcr-solutions@amazon.com' } s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' diff --git a/lib/clickstream_flutter.dart b/lib/clickstream_analytics.dart similarity index 94% rename from lib/clickstream_flutter.dart rename to lib/clickstream_analytics.dart index 8e25712..6f92790 100644 --- a/lib/clickstream_flutter.dart +++ b/lib/clickstream_analytics.dart @@ -1,4 +1,7 @@ -import 'clickstream_flutter_platform_interface.dart'; +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'clickstream_analytics_platform_interface.dart'; class ClickstreamAnalytics { Future init({ diff --git a/lib/clickstream_flutter_method_channel.dart b/lib/clickstream_analytics_method_channel.dart similarity index 86% rename from lib/clickstream_flutter_method_channel.dart rename to lib/clickstream_analytics_method_channel.dart index f342067..9973ac0 100644 --- a/lib/clickstream_flutter_method_channel.dart +++ b/lib/clickstream_analytics_method_channel.dart @@ -1,7 +1,10 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; -import 'clickstream_flutter_platform_interface.dart'; +import 'clickstream_analytics_platform_interface.dart'; /// An implementation of [ClickstreamFlutterPlatform] that uses method channels. class ClickstreamAnalyticsMethodChannel extends ClickstreamInterface { @@ -37,7 +40,8 @@ class ClickstreamAnalyticsMethodChannel extends ClickstreamInterface { @override Future deleteGlobalAttributes(Map attributes) async { - await methodChannel.invokeMethod('deleteGlobalAttributes', attributes); + await methodChannel.invokeMethod( + 'deleteGlobalAttributes', attributes); } @override diff --git a/lib/clickstream_flutter_platform_interface.dart b/lib/clickstream_analytics_platform_interface.dart similarity index 92% rename from lib/clickstream_flutter_platform_interface.dart rename to lib/clickstream_analytics_platform_interface.dart index de9ddb5..68edaf6 100644 --- a/lib/clickstream_flutter_platform_interface.dart +++ b/lib/clickstream_analytics_platform_interface.dart @@ -1,6 +1,9 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import 'package:plugin_platform_interface/plugin_platform_interface.dart'; -import 'clickstream_flutter_method_channel.dart'; +import 'clickstream_analytics_method_channel.dart'; abstract class ClickstreamInterface extends PlatformInterface { /// Constructs a ClickstreamAnalytics. diff --git a/pubspec.yaml b/pubspec.yaml index f64e36e..cc8935d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ -name: clickstream_flutter -description: clickstream flutter SDK -version: 0.0.1 -homepage: +name: clickstream_analytics +description: AWS Solution Clickstream Analytics SDK for Flutter +version: 0.1.0 +homepage: https://github.com/awslabs/clickstream-flutter environment: sdk: '>=3.1.3 <4.0.0' @@ -35,7 +35,7 @@ flutter: plugin: platforms: android: - package: software.aws.solution.clickstream_flutter + package: software.aws.solution.clickstream_analytics pluginClass: ClickstreamFlutterPlugin ios: pluginClass: ClickstreamFlutterPlugin diff --git a/test/clickstream_flutter_method_channel_test.dart b/test/clickstream_flutter_method_channel_test.dart index 0ecc7e8..466cd81 100644 --- a/test/clickstream_flutter_method_channel_test.dart +++ b/test/clickstream_flutter_method_channel_test.dart @@ -1,6 +1,9 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:clickstream_flutter/clickstream_flutter_method_channel.dart'; +import 'package:clickstream_analytics/clickstream_analytics_method_channel.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -36,6 +39,7 @@ void main() { case "flushEvents": return null; } + return null; }, ); }); diff --git a/test/clickstream_flutter_test.dart b/test/clickstream_flutter_test.dart index b2df4df..7074dd9 100644 --- a/test/clickstream_flutter_test.dart +++ b/test/clickstream_flutter_test.dart @@ -1,6 +1,9 @@ -import 'package:clickstream_flutter/clickstream_flutter.dart'; -import 'package:clickstream_flutter/clickstream_flutter_method_channel.dart'; -import 'package:clickstream_flutter/clickstream_flutter_platform_interface.dart'; +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:clickstream_analytics/clickstream_analytics.dart'; +import 'package:clickstream_analytics/clickstream_analytics_method_channel.dart'; +import 'package:clickstream_analytics/clickstream_analytics_platform_interface.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';