Skip to content

Commit 671f82c

Browse files
Merge pull request #19 from reactivedroid/feature/firebase
Integrate Firebase and multiple improvements
2 parents 2b32f83 + 512bbb5 commit 671f82c

File tree

82 files changed

+851
-394
lines changed

Some content is hidden

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

82 files changed

+851
-394
lines changed

.github/workflows/android.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v1
12-
- name: set up JDK 1.8
12+
- name: set up JDK 1.11
1313
uses: actions/setup-java@v1
1414
with:
15-
java-version: 1.8
15+
java-version: 1.11
1616
- name: Build with Gradle
1717
run: ./gradlew assembleDebug

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ captures/
4444
ehthumbs.db
4545
Thumbs.db
4646

47-
*.hprof
47+
*.hprof
48+
tvflix-*.json
49+
tester-groups.txt

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ This app is under development. :construction_worker: :hammer_and_wrench:
2525
* UI Test by [Espresso](https://developer.android.com/training/testing/espresso) based on [Robot Pattern](https://academy.realm.io/posts/kau-jake-wharton-testing-robots/)
2626
* Uses [Kotlin Coroutines Test](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-test/) to unit test Kotlin Coroutines
2727
* Uses [StateFlow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/) as a replacement over LiveData as a state-holder observable
28+
* Uses [Firebase Remote Config](https://firebase.google.com/products/remote-config) for experimentation and feature rollout
29+
* Uses [Firebase App Distribution](https://firebase.google.com/products/app-distribution) for internal distribution and quality testing
2830

2931
## Further Reading
3032

3133
There are several articles written on this repository which state the design and architecture.
3234

33-
### Kotlin Everywhere. Coroutines, Tests, Robots and much more…
35+
### Kotlin Everywhere. Coroutines, Tests, Robots and much more…
3436

3537
The TvFlix complete repository has been re-written in Kotlin with Coroutines covering
3638
Unit Tests across ViewModels and UI tests for the app.
3739
Know more:
38-
[Kotlin Everywhere. Coroutines, Tests, Robots and much more…](https://proandroiddev.com/kotlin-everywhere-coroutines-tests-robots-and-much-more-b02030206cc9)
40+
[Kotlin Everywhere. Coroutines, Tests, Robots and much more…](https://proandroiddev.com/kotlin-everywhere-coroutines-tests-robots-and-much-more-b02030206cc9)
3941

4042
### MVVM using Android Architecture Components
4143

app/build.gradle.kts

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ plugins {
44
kotlin("kapt")
55
kotlin("plugin.parcelize")
66
id("dagger.hilt.android.plugin")
7+
id("com.google.gms.google-services")
8+
id("com.google.firebase.crashlytics")
9+
id("com.google.firebase.firebase-perf")
10+
id("com.google.firebase.appdistribution")
711
}
812

913
apply {
@@ -12,7 +16,7 @@ apply {
1216
}
1317

1418
android {
15-
compileSdkVersion(Deps.Versions.compile_sdk)
19+
compileSdk = Deps.Versions.compile_sdk
1620

1721
buildFeatures {
1822
viewBinding = true
@@ -22,8 +26,8 @@ android {
2226

2327
defaultConfig {
2428
applicationId = "com.android.tvflix"
25-
minSdkVersion(Deps.Versions.min_sdk)
26-
targetSdkVersion(Deps.Versions.target_sdk)
29+
minSdk = Deps.Versions.min_sdk
30+
targetSdk = Deps.Versions.target_sdk
2731
versionCode = Deps.Versions.app_version_code
2832
versionName = Deps.Versions.app_version_name
2933
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -40,19 +44,27 @@ android {
4044
}
4145
}
4246
}
43-
flavorDimensions("default")
47+
flavorDimensions.addAll(listOf("default"))
4448
productFlavors {
4549
create("prod") {
50+
dimension = "default"
4651
applicationId = "com.android.tvflix"
52+
firebaseAppDistribution {
53+
releaseNotesFile = "release-notes.txt"
54+
groupsFile = "tester-groups.txt"
55+
serviceCredentialsFile = "tvflix-b45cd-5fa9e2fb3108.json"
56+
}
4757
}
4858
create("dev") {
49-
applicationId = "com.android.tvflix.dev"
59+
applicationId = "com.android.tvflix"
60+
firebaseAppDistribution {
61+
releaseNotesFile = "release-notes.txt"
62+
groupsFile = "tester-groups.txt"
63+
serviceCredentialsFile = "tvflix-b45cd-5fa9e2fb3108.json"
64+
}
5065
}
5166
}
5267
buildTypes {
53-
getByName("debug") {
54-
applicationIdSuffix = ".debug"
55-
}
5668
getByName("release") {
5769
isMinifyEnabled = true
5870
isShrinkResources = true
@@ -64,8 +76,8 @@ android {
6476
}
6577
}
6678
compileOptions {
67-
sourceCompatibility = JavaVersion.VERSION_1_8
68-
targetCompatibility = JavaVersion.VERSION_1_8
79+
sourceCompatibility = JavaVersion.VERSION_11
80+
targetCompatibility = JavaVersion.VERSION_11
6981
}
7082

7183
testOptions {
@@ -84,17 +96,21 @@ android {
8496
testBuildType = "debug"
8597

8698
packagingOptions {
87-
exclude("META-INF/ASL2.0")
88-
exclude("META-INF/DEPENDENCIES")
89-
exclude("META-INF/NOTICE")
90-
exclude("META-INF/LICENSE")
91-
exclude("META-INF/LICENSE.txt")
92-
exclude("META-INF/NOTICE.txt")
93-
exclude(".readme")
99+
resources.excludes.addAll(
100+
listOf(
101+
"META-INF/ASL2.0",
102+
"META-INF/DEPENDENCIES",
103+
"META-INF/NOTICE",
104+
"META-INF/LICENSE",
105+
"META-INF/LICENSE.txt",
106+
"META-INF/NOTICE.txt",
107+
".readme"
108+
)
109+
)
94110
}
95111

96112
kotlinOptions {
97-
jvmTarget = "1.8"
113+
jvmTarget = "11"
98114
}
99115
}
100116

@@ -106,7 +122,6 @@ dependencies {
106122
implementation(Deps.AndroidX.ktx_fragment)
107123
implementation(Deps.AndroidX.ktx_activity)
108124
implementation(Deps.AndroidX.constraint_layout)
109-
implementation(Deps.AndroidX.Lifecycle.extensions)
110125
kapt(Deps.AndroidX.Lifecycle.compiler)
111126
implementation(Deps.AndroidX.Lifecycle.viewmodel)
112127
implementation(Deps.AndroidX.Paging.runtime)
@@ -115,12 +130,10 @@ dependencies {
115130
kapt(Deps.AndroidX.Room.compiler)
116131
testImplementation(Deps.AndroidX.Room.testing)
117132
implementation(Deps.AndroidX.Room.ktx)
118-
implementation(Deps.AndroidX.Hilt.viewmodel)
119-
kapt(Deps.AndroidX.Hilt.compiler)
120-
implementation(Deps.AndroidX.multidex)
121133
implementation(Deps.AndroidX.annotation)
122134
// end-region AndroidX
123135

136+
implementation(platform(Deps.OkHttp.okhttp_bom))
124137
implementation(Deps.OkHttp.main)
125138
implementation(Deps.OkHttp.logging_interceptor)
126139
implementation(Deps.Glide.runtime)
@@ -162,6 +175,14 @@ dependencies {
162175

163176
implementation(Deps.Hilt.android)
164177
kapt(Deps.Hilt.android_compiler)
178+
179+
// start-region Firebase
180+
implementation(platform(Deps.Firebase.firebase_bom))
181+
implementation(Deps.Firebase.crashlytics)
182+
implementation(Deps.Firebase.performance_monitoring)
183+
implementation(Deps.Firebase.analytics)
184+
implementation(Deps.Firebase.remote_config)
185+
// end-region Firebase
165186
}
166187

167188

app/google-services.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"project_info": {
3+
"project_number": "352317035381",
4+
"project_id": "tvflix-b45cd",
5+
"storage_bucket": "tvflix-b45cd.appspot.com"
6+
},
7+
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:352317035381:android:d68e4d8178aaa27e62793c",
11+
"android_client_info": {
12+
"package_name": "com.android.tvflix"
13+
}
14+
},
15+
"oauth_client": [
16+
{
17+
"client_id": "352317035381-gknu987p38ks98itjcds99pehar6539u.apps.googleusercontent.com",
18+
"client_type": 3
19+
}
20+
],
21+
"api_key": [
22+
{
23+
"current_key": "AIzaSyDomD9NnOHReomJXzki3akzw9M_JZ--DyU"
24+
}
25+
],
26+
"services": {
27+
"appinvite_service": {
28+
"other_platform_oauth_client": [
29+
{
30+
"client_id": "352317035381-gknu987p38ks98itjcds99pehar6539u.apps.googleusercontent.com",
31+
"client_type": 3
32+
}
33+
]
34+
}
35+
}
36+
}
37+
],
38+
"configuration_version": "1"
39+
}

app/src/androidTest/java/com/android/tvmaze/home/HomeRobot.kt renamed to app/src/androidTest/java/com/android/tvflix/home/HomeRobot.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.android.tvmaze.home
1+
package com.android.tvflix.home
22

33
import android.app.Activity
44
import androidx.test.espresso.Espresso.onView
@@ -9,9 +9,9 @@ import androidx.test.espresso.matcher.RootMatchers.withDecorView
99
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
1010
import androidx.test.espresso.matcher.ViewMatchers.withId
1111
import androidx.test.espresso.matcher.ViewMatchers.withText
12-
import com.android.tvmaze.R
13-
import com.android.tvmaze.utils.MatcherUtils
14-
import com.android.tvmaze.utils.ViewActionUtils
12+
import com.android.tvflix.R
13+
import com.android.tvflix.utils.MatcherUtils
14+
import com.android.tvflix.utils.ViewActionUtils
1515
import org.hamcrest.Matchers.`is`
1616
import org.hamcrest.Matchers.allOf
1717
import org.hamcrest.Matchers.not

app/src/androidTest/java/com/android/tvmaze/home/HomeTest.kt renamed to app/src/androidTest/java/com/android/tvflix/home/HomeTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.android.tvmaze.home
1+
package com.android.tvflix.home
22

33
import androidx.test.espresso.Espresso.pressBack
44
import androidx.test.espresso.IdlingRegistry
55
import androidx.test.ext.junit.runners.AndroidJUnit4
66
import androidx.test.filters.LargeTest
77
import androidx.test.rule.ActivityTestRule
8-
import com.android.tvmaze.idlingresource.LoadingIdlingResource
8+
import com.android.tvflix.idlingresource.LoadingIdlingResource
99
import org.junit.After
1010
import org.junit.Before
1111
import org.junit.Rule

app/src/androidTest/java/com/android/tvmaze/idlingresource/LoadingIdlingResource.kt renamed to app/src/androidTest/java/com/android/tvflix/idlingresource/LoadingIdlingResource.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.android.tvmaze.idlingresource
1+
package com.android.tvflix.idlingresource
22

33
import android.app.Activity
44
import android.view.View
55
import android.widget.ProgressBar
66
import androidx.test.espresso.IdlingResource
7-
import com.android.tvmaze.R
7+
import com.android.tvflix.R
88

99
/**
1010
* An idling resource which checks which tells Espresso to wait until Progress Bar dismisses

app/src/androidTest/java/com/android/tvmaze/shows/AllShowsRobot.kt renamed to app/src/androidTest/java/com/android/tvflix/shows/AllShowsRobot.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package com.android.tvmaze.shows
1+
package com.android.tvflix.shows
22

33
import androidx.test.espresso.Espresso.onView
44
import androidx.test.espresso.assertion.ViewAssertions.matches
55
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
66
import androidx.test.espresso.matcher.ViewMatchers.withId
77
import androidx.test.espresso.matcher.ViewMatchers.withText
8-
import com.android.tvmaze.R
9-
import com.android.tvmaze.utils.MatcherUtils
8+
import com.android.tvflix.R
9+
import com.android.tvflix.utils.MatcherUtils
1010

1111
fun launchAllShows(func: AllShowsRobot.() -> Unit) = AllShowsRobot().apply { func() }
1212
class AllShowsRobot {

app/src/androidTest/java/com/android/tvmaze/shows/AllShowsTest.kt renamed to app/src/androidTest/java/com/android/tvflix/shows/AllShowsTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.android.tvmaze.shows
1+
package com.android.tvflix.shows
22

33
import androidx.test.espresso.IdlingRegistry
44
import androidx.test.ext.junit.runners.AndroidJUnit4
55
import androidx.test.filters.LargeTest
66
import androidx.test.rule.ActivityTestRule
7-
import com.android.tvmaze.idlingresource.LoadingIdlingResource
7+
import com.android.tvflix.idlingresource.LoadingIdlingResource
88
import org.junit.After
99
import org.junit.Before
1010
import org.junit.Rule

0 commit comments

Comments
 (0)