Skip to content

Commit 1c3f4f7

Browse files
Merge branch 'android-independent-restructure'
2 parents 916c821 + 2b7661d commit 1c3f4f7

File tree

122 files changed

+800
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+800
-356
lines changed

.gitignore

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,18 @@
1-
# Built application files
2-
*.apk
3-
*.ap_
41

5-
# Files for the Dalvik VM
6-
*.dex
2+
android-analytics/\.gradle/
73

8-
# Java class files
9-
*.class
4+
android-analytics/\.idea/
105

11-
# Generated files
12-
bin/
13-
gen/
6+
kotlin-analytics/\.idea/
147

15-
# Gradle files
16-
.gradle/
17-
build/
8+
kotlin-analytics/\.gradle/
189

19-
# Local configuration file (sdk path, etc)
20-
local.properties
21-
22-
# Proguard folder generated by Eclipse
23-
proguard/
24-
25-
# Log Files
26-
*.log
27-
28-
# Android Studio Navigation editor temp files
29-
.navigation/
10+
*.iml
3011

31-
# Android Studio captures folder
32-
captures/
12+
android-analytics/local\.properties
3313

34-
\.idea/libraries/
14+
kotlin-analytics/local\.properties
3515

36-
\.idea/
16+
kotlin-analytics/build/
3717

38-
*.iml
18+
android-analytics/build/

analytics/build.gradle

Lines changed: 0 additions & 184 deletions
This file was deleted.

analytics/src/main/java/com/sofakingforever/analytics/events/InviteEvent.kt

Lines changed: 0 additions & 21 deletions
This file was deleted.

analytics/src/main/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

android-analytics/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
[ ![Bintray](https://api.bintray.com/packages/sofakingforever/analytics/kotlin-analytics/images/download.svg) ](https://bintray.com/sofakingforever/analytics/kotlin-analytics/_latestVersion)
2+
3+
4+
# SOLID Android Client Kotlin Analytics Interface
5+
6+
![fancy-diagram](https://cdn-images-1.medium.com/max/2000/1*WS5jAiurPYSrY_RdGDK8pQ.png)
7+
8+
[Writing SOLID Analytics With Kotlin for Android](https://medium.com/@nadavfima/how-to-build-better-analytics-with-kotlin-60ab50ce25ac) - Medium Article
9+
10+
This library demonstrates how you could decouple analytics libraries from your business logic code, effectively allowing you to:
11+
* Add & remove analytics services quickly
12+
* Add & remove events quickly
13+
* Change event names and parameters according to the required kit
14+
15+
## Quick Start Guide
16+
17+
### Add To Gradle
18+
Add library to your gradle module
19+
20+
```gradle
21+
repositories {
22+
maven { url "http://dl.bintray.com/sofakingforever/analytics" }
23+
}
24+
25+
dependencies {
26+
27+
def version = '1.0.19'
28+
29+
30+
// This is the generic java/kotlin interface
31+
compile "com.sofakingforever.analytics:analytics:version"
32+
33+
// This is an android-dependant extension interface
34+
compile "com.sofakingforever.analytics:android:version@aar"
35+
36+
// then add the kits you need, or implement your own kit/dispatcher
37+
compile "com.sofakingforever.analytics:kit-answers:version@aar"
38+
compile "com.sofakingforever.analytics:kit-firebase:version@aar"
39+
compile "com.sofakingforever.analytics:kit-flurry:version@aar"
40+
compile "com.sofakingforever.analytics:kit-mixpanel:version@aar"
41+
42+
43+
}
44+
```
45+
46+
### Kotlin Implementation Example
47+
Initiate analytics and send events
48+
49+
```kotlin
50+
// init analytics
51+
analytics = Analytics(settings,
52+
CustomDispatcher(init = true),
53+
LoggerDispatcherImpl(init = true, context = this),
54+
FirebaseDispatcherImpl(init = true, context = this),
55+
MixPanelDispatcherImpl(init = true, projectToken = "TOKEN", context = this),
56+
AnswersDispatcherImpl(init = true, context = this)
57+
58+
59+
// if you're using crashlytics, or any other fabric kit in addition to Answers
60+
// AnswersDispatcherImpl(init = true, Answers(), Crashlytics())
61+
)
62+
63+
// send event
64+
analytics.track(SimpleEvent())
65+
```
66+
67+
Don't forget to declare the event
68+
```kotlin
69+
class SimpleEvent : CustomEvent {
70+
// declare name - will be sent to all dispatchers
71+
override fun getEventName(kit: AnalyticsKit): String = "Simple Event"
72+
73+
}
74+
```
75+
### Android Highlights
76+
77+
If you're targeting Android, you need the android package, and you should generally extend
78+
`AndroidAnalyticsDispatcher` and `AndroidAnalyticsSettings` instead of the kotlin ones.
79+
80+
#### See more integration examples in the [source code](https://github.com/sofakingforever/kotlin-analytics/tree/master/app/src/main/java/com/sofakingforever/example)
81+
82+
## Todo List
83+
84+
- [x] Setup repository
85+
- [x] Add Code
86+
- [x] Upload First Build
87+
- [x] Add Gradle Example
88+
- [x] Add Fabric Answers Default Implementation
89+
- [x] Add Firebase Default Implementation
90+
- [x] Add Flurry Default Implementation
91+
- [x] Add Example Code to App Module
92+
- [x] Add Example Code to README
93+
- [x] Add Documentation
94+
- [x] Add Unit Tests
95+
- [ ] Who knows... :o
96+
97+
98+
### Originally developed for [Wakey - Beautiful Alarm Clock](https://play.google.com/store/apps/details?id=com.sofaking.moonworshipper&hl=en_US)
99+
100+
Wakey is a simple & beautiful animated alarm clock, featuring a spectacular design and an immersive experience - guaranteed to wake you up with a smile everyday!
101+
102+
With our smiling sunrise, and grumpy lunar animations, this is the most unique alarm clock in our solar system.
103+
104+
![Wakey Alarm Clock](https://cdn-images-1.medium.com/max/2000/1*DhcklS1xNZwHogX0wDQEyw.png)
105+
106+
License
107+
-------
108+
109+
Licensed under the Apache License, Version 2.0 (the "License");
110+
you may not use this file except in compliance with the License.
111+
You may obtain a copy of the License at
112+
113+
http://www.apache.org/licenses/LICENSE-2.0
114+
115+
Unless required by applicable law or agreed to in writing, software
116+
distributed under the License is distributed on an "AS IS" BASIS,
117+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118+
See the License for the specific language governing permissions and
119+
limitations under the License.
120+
File renamed without changes.

0 commit comments

Comments
 (0)