forked from quran/quran_android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial basic implementation of Analytics (quran#1471)
Implement analytics in such a way as to be able to swap out the implementation with a NoopImplementation for cases where we don't want to use Firebase.
- Loading branch information
Showing
10 changed files
with
59 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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dependencies { | ||
implementation project(path: ':pages:madani') | ||
implementation project(path: ':feature:analytics-noop') | ||
} |
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
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
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,10 @@ | ||
apply plugin: 'kotlin' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
dependencies { | ||
implementation "androidx.annotation:annotation:${androidxAnnotationVersion}" | ||
|
||
// dagger | ||
kapt deps.dagger.apt | ||
implementation deps.dagger.runtime | ||
} |
5 changes: 5 additions & 0 deletions
5
common/analytics/src/main/java/com/quran/analytics/AnalyticsProvider.kt
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 @@ | ||
package com.quran.analytics | ||
|
||
fun interface AnalyticsProvider { | ||
fun logEvent(name: String, params: Map<String, Any>) | ||
} |
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,11 @@ | ||
apply plugin: 'kotlin' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
dependencies { | ||
implementation project(":common:analytics") | ||
implementation "androidx.annotation:annotation:${androidxAnnotationVersion}" | ||
|
||
// dagger | ||
kapt deps.dagger.apt | ||
implementation deps.dagger.runtime | ||
} |
12 changes: 12 additions & 0 deletions
12
feature/analytics-noop/src/main/java/com/quran/analytics/provider/AnalyticsModule.kt
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,12 @@ | ||
package com.quran.analytics.provider | ||
|
||
import com.quran.analytics.AnalyticsProvider | ||
import dagger.Binds | ||
import dagger.Module | ||
|
||
@Module | ||
interface AnalyticsModule { | ||
|
||
@Binds | ||
fun provideAnalyticsProvider(noopAnalyticsProvider: NoopAnalyticsProvider): AnalyticsProvider | ||
} |
13 changes: 13 additions & 0 deletions
13
feature/analytics-noop/src/main/java/com/quran/analytics/provider/NoopAnalyticsProvider.kt
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 @@ | ||
package com.quran.analytics.provider | ||
|
||
import com.quran.analytics.AnalyticsProvider | ||
import javax.inject.Inject | ||
|
||
class NoopAnalyticsProvider @Inject constructor() : AnalyticsProvider { | ||
|
||
override fun logEvent( | ||
name: String, | ||
params: Map<String, Any> | ||
) { | ||
} | ||
} |
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