Skip to content

Commit

Permalink
feat(rudder_integration_appsflyer_flutter): added initial changes for…
Browse files Browse the repository at this point in the history
… the development of appsflyer device mod

e in flutter
  • Loading branch information
Desu Sai Venkat committed Apr 5, 2023
1 parent 03dbb39 commit 559fbda
Show file tree
Hide file tree
Showing 16 changed files with 424 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: eb6d86ee27deecba4a83536aa20f366a6044895c
channel: stable

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: android
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: ios
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
21 changes: 21 additions & 0 deletions packages/integrations/rudder_integration_appsflyer_flutter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 RudderStack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# What is RudderStack?

[RudderStack](https://rudderstack.com/) is a **customer data pipeline tool** for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.

With RudderStack, you can build customer data pipelines that connect your whole customer data stack and then make them smarter by triggering enrichment and activation in customer tools based on analysis in your data warehouse. Its easy-to-use SDKs and event source integrations, Cloud Extract integrations, transformations, and expansive library of destination and warehouse integrations makes building customer data pipelines for both event streaming and cloud-to-warehouse ELT simple.

Questions? Please join our [Slack channel](https://www.rudderstack.com/join-rudderstack-slack-community/) or read about us on [Product Hunt](https://www.producthunt.com/posts/rudderstack).

## Integrating Appsflyer with the RudderStack Flutter SDK

1. Add [Adjust](https://www.appsflyer.com/) as a destination in the [RudderStack dashboard](https://app.rudderstack.com/).

2. Open `pubspec.yaml` and add `rudder_integration_appsflyer_flutter` under `dependencies` section:

```groovy
dependencies:
rudder_integration_appsflyer_flutter: ^1.0.0
```

3. Navigate to your Application's root folder and install all the required dependencies with:

```bash
flutter pub get
```

4. Import the module you added above and add it to your SDK initialization code as shown below:

```typescript
import 'package:rudder_sdk_flutter/RudderController.dart';
import 'package:rudder_sdk_flutter_platform_interface/platform.dart';
import 'package:rudder_integration_appsflyer_flutter/rudder_integration_appsflyer_flutter.dart';

RudderConfigBuilder builder = RudderConfigBuilder();
builder.withDataPlaneUrl(DATA_PLANE_URL);
builder.withFactory(RudderIntegrationAppsflyerFlutter());
final RudderController rudderClient = RudderController.instance;
rudderClient.initialize(WRITE_KEY,
config: builder.build(), options:null);
```



## Sending Events

Follow the steps from our [RudderStack Flutter SDK](https://github.com/rudderlabs/rudder-sdk-flutter#send-events) repo.

## Contact Us

If you come across any issues while configuring or using this integration, please feel free to start a conversation on our [Slack](https://www.rudderstack.com/join-rudderstack-slack-community/) channel. We will be happy to help you.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
group 'com.rudderstack.sdk.flutter.integrations.rudder_integration_appsflyer_flutter'
version '1.0'

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
}
}

rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 31

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 16
}
}

dependencies {
// Rudder Android Core SDK Dependencies
implementation 'com.rudderstack.android.sdk:core:[1.12.0, 2.0.0)'
implementation project(path: ':rudder_plugin_android')

// RudderStack AppsFlyer-SDK
implementation 'com.rudderstack.android.integration:appsflyer:1.+'

// AppsFlyer SDK
implementation 'com.appsflyer:af-android-sdk:6.+'
implementation 'com.android.installreferrer:installreferrer:2.+'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rudder_integration_appsflyer_flutter'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rudderstack.sdk.flutter.integrations.rudder_integration_appsflyer_flutter">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.rudderstack.sdk.flutter.integrations.rudder_integration_appsflyer_flutter;

import static com.rudderstack.sdk.flutter.RudderSdkFlutterPlugin.addIntegration;
import com.rudderstack.android.integrations.appsflyer.AppsFlyerIntegrationFactory;

import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;

/** RudderIntegrationAppsflyerFlutterPlugin */
public class RudderIntegrationAppsflyerFlutterPlugin implements FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private MethodChannel channel;

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "rudder_integration_appsflyer_flutter");
channel.setMethodCallHandler(this);
}

@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (call.method.equals("addFactory")) {
addIntegration(AppsFlyerIntegrationFactory.FACTORY);
// To do with result
} else {
result.notImplemented();
}
}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/

.DS_Store
*.swp
profile

DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m

.generated/

*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3

!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3

xcuserdata

*.moved-aside

*.pyc
*sync/
Icon?
.tags*

/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface RudderIntegrationAppsflyerFlutterPlugin : NSObject<FlutterPlugin>
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#import "RudderIntegrationAppsflyerFlutterPlugin.h"
#import <rudder_plugin_ios/RudderSdkFlutterPlugin.h>
#import "RudderAppsflyerFactory.h"

@implementation RudderIntegrationAppsflyerFlutterPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel
methodChannelWithName:@"rudder_integration_appsflyer_flutter"
binaryMessenger:[registrar messenger]];
RudderIntegrationAppsflyerFlutterPlugin* instance = [[RudderIntegrationAppsflyerFlutterPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
}

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([call.method isEqualToString:@"addFactory"]) {
[RudderSdkFlutterPlugin addIntegration:[RudderAppsflyerFactory instance]];
// To do with result
} else {
result(FlutterMethodNotImplemented);
}
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint rudder_integration_appsflyer_flutter.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'rudder_integration_appsflyer_flutter'
s.version = '1.0.0'
s.summary = "RudderStack's Flutter Device Mode for the Appsflyer Destination"
s.description = <<-DESC
Rudder is a platform for collecting, storing and routing customer event data to dozens of tools. Rudder is open-source, can run in your cloud environment (AWS, GCP, Azure or even your data-centre) and provides a powerful transformation framework to process your event data on the fly.
DESC
s.homepage = 'https://github.com/rudderlabs/rudder-sdk-flutter/tree/2.x'
s.license = { :file => '../LICENSE' }
s.author = { 'RudderStack' => '[email protected]' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'rudder_plugin_ios'
s.dependency 'Rudder-Appsflyer', '2.2.0'
s.platform = :ios, '9.0'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:flutter/services.dart';
import 'package:flutter/foundation.dart';
import 'package:rudder_sdk_flutter_platform_interface/platform.dart';

class RudderIntegrationAppsflyerFlutter implements RudderIntegration {
static const MethodChannel _channel =
MethodChannel('rudder_integration_appsflyer_flutter');

@override
void addFactory() {
if (!kIsWeb) {
_channel.invokeMethod("addFactory");
}
}

@override
String getKey() {
return "AppsFlyer";
}
}
Loading

0 comments on commit 559fbda

Please sign in to comment.