-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from PopStackHack/release/4.1.1
Release/4.1.1
- Loading branch information
Showing
55 changed files
with
967 additions
and
226 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
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
13 changes: 13 additions & 0 deletions
13
...opstack/mvoter2015/feature/analytics/location/FakeLoggingSelectedLocationAnalyticsImpl.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.popstack.mvoter2015.feature.analytics.location | ||
|
||
import com.popstack.mvoter2015.domain.location.model.CombinedLocation | ||
import timber.log.Timber | ||
import javax.inject.Inject | ||
|
||
class FakeLoggingSelectedLocationAnalyticsImpl @Inject constructor() : SelectedLocationAnalytics { | ||
|
||
override fun logLocation(combinedLocation: CombinedLocation) { | ||
Timber.i("state: ${combinedLocation.stateRegion}, township : ${combinedLocation.township}, ward : ${combinedLocation.ward ?: "N/A"} ") | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...a/com/popstack/mvoter2015/feature/analytics/location/RealSelectedLocationAnalyticsImpl.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,27 @@ | ||
package com.popstack.mvoter2015.feature.analytics.location | ||
|
||
import android.content.Context | ||
import com.google.firebase.analytics.FirebaseAnalytics | ||
import com.popstack.mvoter2015.domain.location.model.CombinedLocation | ||
import javax.inject.Inject | ||
|
||
class RealSelectedLocationAnalyticsImpl @Inject constructor( | ||
private val context: Context | ||
) : SelectedLocationAnalytics { | ||
|
||
companion object { | ||
private const val PROPERTY_NAME_GEO = "geo" | ||
} | ||
|
||
override fun logLocation(combinedLocation: CombinedLocation) { | ||
val property = with(combinedLocation) { | ||
if (ward == null) { | ||
"$stateRegion|$township" | ||
} else { | ||
"$ward|$township|$stateRegion" | ||
} | ||
} | ||
FirebaseAnalytics.getInstance(context).setUserProperty(PROPERTY_NAME_GEO, property) | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...main/java/com/popstack/mvoter2015/feature/analytics/location/SelectedLocationAnalytics.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,9 @@ | ||
package com.popstack.mvoter2015.feature.analytics.location | ||
|
||
import com.popstack.mvoter2015.domain.location.model.CombinedLocation | ||
|
||
interface SelectedLocationAnalytics { | ||
|
||
fun logLocation(combinedLocation: CombinedLocation) | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...ava/com/popstack/mvoter2015/feature/analytics/location/SelectedLocationAnalyticsModule.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,23 @@ | ||
package com.popstack.mvoter2015.feature.analytics.location | ||
|
||
import android.content.Context | ||
import com.popstack.mvoter2015.data.cache.BuildConfig | ||
import dagger.Module | ||
import dagger.Provides | ||
|
||
@Module | ||
abstract class SelectedLocationAnalyticsModule { | ||
|
||
companion object { | ||
|
||
@Provides | ||
fun selectedLocationAnalytics(context: Context): SelectedLocationAnalytics { | ||
return if (BuildConfig.DEBUG) { | ||
FakeLoggingSelectedLocationAnalyticsImpl() | ||
} else { | ||
RealSelectedLocationAnalyticsImpl(context) | ||
} | ||
} | ||
} | ||
|
||
} |
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
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
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
Oops, something went wrong.