diff --git a/README.md b/README.md index 64faa84..7200dcd 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,48 @@ -// add badges and stuff here - -# Destination - -## Getting Started - -1. Create repo from this template. The name of the repo should follow this pattern `project-language-destination`. For example `analytics-kotlin-firebase` -2. In `settings.gralde.kts`, change `rootProject.name` to match your repo name. -3. In `gradle.properties`, update the fields with `<>` brackets -4. Delete `com.segment.analytics.kotlin.destinations.Destination.kt` -5. Create a directory with the destination name under `com.segment.analytics.kotlin.destinations`. For example Firebase, `com.segment.analytics.kotlin.destinations.firebase` -6. Create your destination class under the directory created in step 5. For example Firebase, `com.segment.analytics.kotlin.destinations.firebase.Firebase.kt` -7. update Android manifest with your package name. For example Firebase - ```xml - - ``` -8. Implement destination -9. Add tests +# Analytics-Kotlin Flurry + +Add Flurry support to your applications via this plugin for [Analytics-Kotlin](https://github.com/segmentio/analytics-kotlin) + +## Adding the dependency +To install the Segment-Flurry integration, simply add this line to your gradle file: + +``` +implementation 'com.segment.analytics.kotlin.destinations:flurry:' +``` +Or the following for Kotlin DSL +``` +implementation("com.segment.analytics.kotlin.destinations:flurry:") +``` + +## Using the Plugin in your App + +Open the file where you setup and configure the Analytics-Kotlin library. Add this plugin to the list of imports. + +``` +import com.segment.analytics.kotlin.destinations.flurry.FlurryDestination +``` + +Just under your Analytics-Kotlin library setup, call `analytics.add(plugin = ...)` to add an instance of the plugin to the Analytics timeline. + +``` + analytics = Analytics("", applicationContext) { + this.flushAt = 3 + this.trackApplicationLifecycleEvents = true + } + analytics.add(plugin = FlurryDestination()) +``` + +Your events will now begin to flow to Flurry in device mode. + + +## Integrating with Segment + +Interested in integrating your service with us? Check out our [Partners page](https://segment.com/partners/) for more details. +Please see [our documentation](https://segment.com/docs/connections/destinations/catalog/flurry/) for more information. + + +## Support + +Please use Github issues, Pull Requests, or feel free to reach out to our [support team](https://segment.com/help/). ## License diff --git a/gradle.properties b/gradle.properties index 099ef17..091e74b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,17 +23,17 @@ kotlin.code.style=official # Deployment variables GROUP=com.segment.analytics.kotlin.destinations -VERSION_CODE=<100> -VERSION_NAME=<1.0.0> +VERSION_CODE=100 +VERSION_NAME=1.0.0 -POM_ARTIFACT_ID= -POM_NAME= -POM_DESCRIPTION= +POM_ARTIFACT_ID=flurry +POM_NAME=flurry +POM_DESCRIPTION=Destination Plugin for Flurry -POM_URL=https://github.com/segmentio/ -POM_SCM_URL=https://github.com/segmentio/ -POM_SCM_CONNECTION=scm:git:git://github.com/segmentio/.git -POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/segmentio/.git +POM_URL=https://github.com/segmentio/analytics-kotlin-integration-flurry +POM_SCM_URL=https://github.com/segmentio/analytics-kotlin-integration-flurry +POM_SCM_CONNECTION=scm:git:git://github.com/segmentio/analytics-kotlin-integration-flurry.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/segmentio/analytics-kotlin-integration-flurry.git POM_LICENCE_NAME=The MIT License (MIT) POM_LICENCE_URL=http://opensource.org/licenses/MIT diff --git a/lib/src/main/AndroidManifest.xml b/lib/src/main/AndroidManifest.xml index 15d8c30..3e96aae 100644 --- a/lib/src/main/AndroidManifest.xml +++ b/lib/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + \ No newline at end of file diff --git a/lib/src/main/java/com/segment/analytics/kotlin/destinations/MyDestination.kt b/lib/src/main/java/com/segment/analytics/kotlin/destinations/flurry/FlurryDestination.kt similarity index 59% rename from lib/src/main/java/com/segment/analytics/kotlin/destinations/MyDestination.kt rename to lib/src/main/java/com/segment/analytics/kotlin/destinations/flurry/FlurryDestination.kt index 1f78147..def198b 100644 --- a/lib/src/main/java/com/segment/analytics/kotlin/destinations/MyDestination.kt +++ b/lib/src/main/java/com/segment/analytics/kotlin/destinations/flurry/FlurryDestination.kt @@ -1,22 +1,15 @@ -package com.segment.analytics.kotlin.destinations - -import com.segment.analytics.kotlin.core.AliasEvent -import com.segment.analytics.kotlin.core.BaseEvent -import com.segment.analytics.kotlin.core.GroupEvent -import com.segment.analytics.kotlin.core.IdentifyEvent -import com.segment.analytics.kotlin.core.ScreenEvent -import com.segment.analytics.kotlin.core.Settings -import com.segment.analytics.kotlin.core.TrackEvent +package com.segment.analytics.kotlin.destinations.flurry + +import com.segment.analytics.kotlin.core.* import com.segment.analytics.kotlin.core.platform.DestinationPlugin import com.segment.analytics.kotlin.core.platform.Plugin -class MyDestination : DestinationPlugin() { - override val key: String = TODO("Destination Name here") +class FlurryDestination : DestinationPlugin() { + override val key: String = "Flurry" override fun update(settings: Settings, type: Plugin.UpdateType) { super.update(settings, type) if (type == Plugin.UpdateType.Initial) { - TODO("Setup code with $settings") } } diff --git a/lib/src/test/kotlin/com/segment/analytics/kotlin/destinations/flurry/FlurryDestinationTests.kt b/lib/src/test/kotlin/com/segment/analytics/kotlin/destinations/flurry/FlurryDestinationTests.kt new file mode 100644 index 0000000..b76059a --- /dev/null +++ b/lib/src/test/kotlin/com/segment/analytics/kotlin/destinations/flurry/FlurryDestinationTests.kt @@ -0,0 +1,21 @@ +package com.segment.analytics.kotlin.destinations.flurry + +import android.os.Bundle +import io.mockk.every +import io.mockk.mockk +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(manifest = Config.NONE) +class FlurryDestinationTests { + + @Test + fun `sample mock test`() { + // https://mockk.io/#dsl-examples + val bundle = mockk() + every { bundle.get("key") }.returns("value") + } +} diff --git a/lib/src/test/kotlin/com/segment/analytics/kotlin/destinations/matchers/MyDestinationTests.kt b/lib/src/test/kotlin/com/segment/analytics/kotlin/destinations/matchers/MyDestinationTests.kt deleted file mode 100644 index 74d97b0..0000000 --- a/lib/src/test/kotlin/com/segment/analytics/kotlin/destinations/matchers/MyDestinationTests.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.segment.analytics.kotlin.destinations.matchers - -import android.os.Bundle -import io.mockk.every -import io.mockk.mockk -import org.junit.Assert.assertFalse -import org.junit.Assert.assertTrue -import org.junit.Test -import org.junit.runner.RunWith -import org.robolectric.RobolectricTestRunner -import org.robolectric.annotation.Config - -/** - * This is a template with some example code for your tests, which outlines the basics of mocking - * and matchers. For more info: https://mockk.io/ - * - * The template uses Robolectric + JUnit as a test runner to simulate the android runtime, - * and mockK as the mocking framework. - */ -@RunWith(RobolectricTestRunner::class) -@Config(manifest = Config.NONE) -class MyDestinationTests { - - class SomeObject { - fun bundle(bundle: Bundle): Boolean { - return false - } - } - - @Test - fun `sample mock test`() { - // https://mockk.io/#dsl-examples - val bundle = mockk() - every { bundle.get("key") }.returns("value") - } - - @Test - fun `sample bundle matcher`() { - val valid = Bundle() - valid.putString("strKey", "invalid") - valid.putInt("intKey", 10) - - val invalid = Bundle() - invalid.putString("strKey", "value") - invalid.putInt("intKey", 10) - - val mock = mockk() - // https://mockk.io/#custom-matchers - every { mock.bundle(matchBundle(valid)) }.returns(true) - every { mock.bundle(not(matchBundle(valid))) }.returns(false) - - assertTrue(mock.bundle(valid)) - assertFalse(mock.bundle(invalid)) - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 53c932b..8a50711 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,4 @@ -rootProject.name = "analytics-kotlin-destination-template" +rootProject.name = "analytics-kotlin-integration-flurry" include(":lib") includeBuild("publishing-plugins") include(":testapp")