-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1791fbc
Showing
154 changed files
with
4,975 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches/build_file_checksums.ser | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/compiler/build | ||
/captures | ||
.externalNativeBuild | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
language: android | ||
android: | ||
components: | ||
- build-tools-28.0.3 | ||
- android-28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Winfooz | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# WinAnalytics(Beta) library | ||
[![Build Status](https://travis-ci.org/Winfooz/WinAnalytics.svg?branch=master)](https://travis-ci.org/Winfooz/WinAnalytics) | ||
[![Deploy Status](https://app.buddy.works/mohamednayef95/winanalytics-1/pipelines/pipeline/158574/badge.svg?token=071324226326a701b263c3a2755acc1f179227f6bb2f1d11c84cbbfd3e77c732 "Deploy Status")](https://app.buddy.works/mohamednayef95/winanalytics-1/pipelines/pipeline/158574) | ||
[![Download](https://api.bintray.com/packages/mnayef95/WinAnalytics/com.winfooz.winanalytics%3Awinanalytics/images/download.svg) ](https://bintray.com/mnayef95/WinAnalytics/com.winfooz.winanalytics%3Awinanalytics/_latestVersion) | ||
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-WinAnalytics-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/7197) | ||
[![Gitter](https://badges.gitter.im/WinAnalyticsChat/WinAnalytics.svg)](https://gitter.im/WinAnalyticsChat/WinAnalytics?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) | ||
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/Winfooz/WinAnalytics/blob/master/LICENSE) | ||
![GitHub](https://img.shields.io/badge/Support-Kotlin%20%7C%20Java-lightgrey.svg) | ||
|
||
A light-weight android library that can be quickly integrated into any app to use analytics tools. | ||
- Full Kotlin support. | ||
- Support multiple analytical tools e.g(Firebase, Fabric, Mixpanel). | ||
- Annotations based. | ||
- 100% reflection free. | ||
# Contributing: | ||
If you'd like to contribute, please take a look at the [`Contributing`](https://github.com/Winfooz/WinAnalytics/wiki/Contributing) page on the Wiki. | ||
# Example WinAnalytics: | ||
|
||
**Application class** | ||
```kotlin | ||
@AnalyticsConfiguration( | ||
AnalyticsClient(type = AnalyticsTypes.FIREBASE, enabled=false), | ||
AnalyticsClient(type = AnalyticsTypes.FABRIC), | ||
AnalyticsClient(key = "mixpanelToken", type = AnalyticsTypes.MIXPANEL) | ||
) | ||
class MyApplication : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
Fabric.with(this, Crashlytics()) | ||
} | ||
} | ||
``` | ||
|
||
**Model class** | ||
```kotlin | ||
data class User( | ||
@Analytics( | ||
Event("Login"), | ||
Event("Logout") | ||
) | ||
val name: String, | ||
|
||
@Analytics(Event("Logout")) | ||
val email: String, | ||
|
||
@Analytics(Event("Login")) | ||
val phone: String, | ||
|
||
@Analytics( | ||
Event("Login"), | ||
Event("Logout") | ||
) | ||
val age: Int, | ||
|
||
@AnalyticsEmbedded | ||
val address: Address? | ||
) | ||
|
||
data class Address( | ||
@Analytics(Event("Login")) | ||
val address: String, | ||
|
||
@Analytics(Event("Login")) | ||
val latitude: String, | ||
|
||
@Analytics(Event("Login")) | ||
val longitude: String | ||
) | ||
``` | ||
|
||
**MainActivity** | ||
```kotlin | ||
private fun onHelloWorldClicked(view: View) { | ||
Analytics.getInstance(applicationContext).userAnalytics.loginEvent(user) | ||
} | ||
``` | ||
|
||
# Example analytics from more than a place: | ||
|
||
**MainActivity** | ||
```kotlin | ||
@AnalyticsEmbedded | ||
var user: User? = null | ||
|
||
@AnalyticsEmbedded | ||
var address: Address? = null | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
Analytics.getInstance(applicationContext).mainActivityAnalytics.loginEvent(this) | ||
} | ||
``` | ||
|
||
# Download | ||
|
||
```groovy | ||
repositories { | ||
maven { | ||
url "https://dl.bintray.com/mnayef95/WinAnalytics" | ||
} | ||
} | ||
dependencies { | ||
implementation 'com.winfooz.winanalytics:winanalytics:1.0.3-beta' | ||
kapt 'com.winfooz.winanalytics:compiler:1.0.3-beta' | ||
} | ||
``` | ||
|
||
# Support annotations | ||
```kotlin | ||
@Analytics() | ||
@AnalyticsConfiguration() | ||
@AnalyticsEmbedded() | ||
@AnalyticsTypes() | ||
@AnalyticsClient() | ||
``` | ||
## License | ||
|
||
WinAnalytics is released under the MIT license. [See LICENSE](https://github.com/Winfooz/WinAnalytics/blob/master/LICENSE) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-cayman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
apply plugin: 'com.jfrog.bintray' | ||
|
||
version = libraryVersion | ||
|
||
if (project.hasProperty("android")) { | ||
task sourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.java.srcDirs | ||
} | ||
} else { | ||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
} | ||
|
||
bintrayUpload.dependsOn assemble | ||
bintrayUpload.dependsOn sourcesJar | ||
|
||
artifacts { | ||
archives sourcesJar | ||
} | ||
|
||
bintray { | ||
user = getBintrayUser() | ||
key = getBintrayKey() | ||
|
||
configurations = ['archives'] | ||
pkg { | ||
repo = bintrayRepo | ||
name = bintrayName | ||
desc = libraryDescription | ||
|
||
websiteUrl = siteUrl | ||
vcsUrl = gitUrl | ||
licenses = allLicenses | ||
publish = true | ||
publicDownloadNumbers = true | ||
version { | ||
desc = libraryDescription | ||
gpg { | ||
sign = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
def getBintrayUser() { | ||
if (System.getenv('BINTRAY_USER')) { | ||
logger.lifecycle(System.getenv('BINTRAY_USER')) | ||
return System.getenv('BINTRAY_USER') | ||
} else if (rootProject.file('local.properties').exists()) { | ||
Properties properties = new Properties() | ||
properties.load(rootProject.file('local.properties').newDataInputStream()) | ||
return properties.getProperty('bintray.user') | ||
} else { | ||
logger.lifecycle("Warning: Could not find BINTRAY_USER in environment or local.properties") | ||
} | ||
} | ||
|
||
def getBintrayKey() { | ||
if (System.getenv('BINTRAY_KEY')) { | ||
logger.lifecycle(System.getenv('BINTRAY_KEY')) | ||
return System.getenv('BINTRAY_KEY') | ||
} else if (rootProject.file('local.properties').exists()) { | ||
Properties properties = new Properties() | ||
properties.load(rootProject.file('local.properties').newDataInputStream()) | ||
return properties.getProperty('bintray.apikey') | ||
} else { | ||
logger.lifecycle("Warning: Could not find BINTRAY_KEY in environment or local.properties") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import com.github.sherter.googlejavaformatgradleplugin.GoogleJavaFormat | ||
|
||
buildscript { | ||
|
||
repositories { | ||
google() | ||
jcenter() | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.2.1' | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10" | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' | ||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' | ||
classpath "org.jmailen.gradle:kotlinter-gradle:1.20.1" | ||
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.16' | ||
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.7.1" | ||
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} | ||
|
||
subprojects { project -> | ||
apply plugin: 'net.ltgt.errorprone' | ||
apply from: rootProject.file('ktlint.gradle') | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
errorprone 'com.google.errorprone:error_prone_core:2.3.1' | ||
} | ||
|
||
if (!project.name.endsWith("sample")) { | ||
apply plugin: "com.github.sherter.google-java-format" | ||
apply plugin: 'checkstyle' | ||
apply plugin: 'pmd' | ||
|
||
task pmd(type: Pmd) { | ||
ruleSetFiles = files("${project.rootDir}/pmd.xml") | ||
ruleSets = ["java-basic", "java-braces"] | ||
source 'src/main/java' | ||
include '**/*.java' | ||
exclude '**/gen/**' | ||
classpath = files() | ||
consoleOutput = true | ||
} | ||
|
||
task checkstyle(type: Checkstyle) { | ||
configFile rootProject.file('checkstyle.xml') | ||
source 'src/main/java' | ||
ignoreFailures false | ||
showViolations true | ||
include '**/*.java' | ||
|
||
classpath = files() | ||
} | ||
|
||
googleJavaFormat { | ||
group "formatting" | ||
options style: 'AOSP' | ||
} | ||
|
||
task format(type: GoogleJavaFormat) { | ||
source 'src/main/java' | ||
include '**/*.java' | ||
exclude '**/gen/**' | ||
} | ||
|
||
project.afterEvaluate { | ||
def task = null | ||
if (project.tasks.findByName('preBuild')) { | ||
task = preBuild | ||
} else if (project.tasks.findByName('clean')) { | ||
task = clean | ||
} | ||
if (task != null) { | ||
task.dependsOn "format" | ||
tasks['pmd'].shouldRunAfter format | ||
tasks['checkstyle'].shouldRunAfter format | ||
|
||
task.dependsOn "formatKotlin" | ||
tasks['lintKotlin'].shouldRunAfter formatKotlin | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.