Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config Firebase #76

Open
wants to merge 1 commit into
base: mvp-dagger-architecture
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'com.google.firebase.firebase-perf'
id 'org.jlleitschuh.gradle.ktlint'
Expand Down Expand Up @@ -65,12 +66,6 @@ android {
applicationIdSuffix = ".stg"
manifestPlaceholders = [applicationName: "ProjectName-STG"]
}
preProduct {
applicationIdSuffix = ".pre.prod"
manifestPlaceholders = [applicationName: "JC-ProjectName-PRD"]
versionCode build_versions.versionCodeRelease
versionName build_versions.versionNameRelease
}
prd {
manifestPlaceholders = [applicationName: "@string/app_name"]
versionCode build_versions.versionCodeRelease
Expand Down Expand Up @@ -98,10 +93,6 @@ android {

buildTypes {
debug {
ext.betaDistributionReleaseNotesFilePath = "release_notes.txt"
ext.betaDistributionGroupAliases = "QA3C"
ext.betaDistributionNotifications = true

applicationVariants.all { variant -> appendVersionNameVersionCode(variant) }
}

Expand All @@ -123,16 +114,12 @@ android {
}

applicationVariants.all { variant ->
def BASE_URL, CLIENT_ID, CLIENT_SECRET
def BASE_URL
if (variant.buildType.isDebuggable()) {
if (variant.flavorName.contains("stg")) {
BASE_URL = "https://host.name.vn"
CLIENT_ID = "Android"
CLIENT_SECRET = "AndroidSecret"
} else {
BASE_URL = "https://4438b6c1.ngrok.io/"
CLIENT_ID = "Android"
CLIENT_SECRET = "AndroidSecret"
}
} else if (!System.getenv('CI')) {
def signFile = file("../local.properties")
Expand All @@ -143,8 +130,6 @@ android {
}

variant.buildConfigField "String", "BASE_URL", "\"${BASE_URL}\""
variant.buildConfigField "String", "CLIENT_ID", "\"${CLIENT_ID}\""
variant.buildConfigField "String", "CLIENT_SECRET", "\"${CLIENT_SECRET}\""
}
}

Expand Down Expand Up @@ -191,7 +176,7 @@ dependencies {
kapt "com.google.dagger:dagger-android-processor:$versions.dagger2"

// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation platform('com.google.firebase:firebase-bom:28.0.0')

// Declare the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
Expand All @@ -205,10 +190,6 @@ dependencies {
androidTestImplementation "androidx.test.espresso:espresso-core:$versions.espresso"
}

repositories {
google()
}

ktlint {
version = "0.37.0"
android = true
Expand Down
96 changes: 85 additions & 11 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,115 @@
{
"project_info": {
"project_number": "478782649877",
"project_id": "picturepassword-b63c8",
"storage_bucket": "picturepassword-b63c8.appspot.com"
"project_number": "172896032281",
"project_id": "projectname-31ea2",
"storage_bucket": "projectname-31ea2.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:478782649877:android:cd8ae5d2e0ce6b04cc801c",
"mobilesdk_app_id": "1:172896032281:android:df29af0ecf67b2c503fc88",
"android_client_info": {
"package_name": "com.ccc.projectnanme"
"package_name": "com.ccc.nameapp"
}
},
"oauth_client": [
{
"client_id": "478782649877-61shcaa97aj220fd9vip3q5ge35hbri1.apps.googleusercontent.com",
"client_id": "172896032281-sram0a913hcff3lgdsfhu9b1bjnqmgtj.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.ccc.projectnanme",
"certificate_hash": "dfd612dcc63eb9e2ea02a3df9618dcd2d031227c"
"package_name": "com.ccc.nameapp",
"certificate_hash": "b9f56ba90349785fce3912ffedddccf0bc24cad2"
}
},
{
"client_id": "478782649877-fngfeecq1lf2e4avicebqko467p2aiv4.apps.googleusercontent.com",
"client_id": "172896032281-84n14ko19e3isu0hjv2ned7ud0i0qe6m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAsVmaoeAOmhkmj_YUrwPFtdeLZBuPOZik"
"current_key": "AIzaSyB7v5lTvysQS5Xg2-fU9hI3xAPA45UquZc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "478782649877-fngfeecq1lf2e4avicebqko467p2aiv4.apps.googleusercontent.com",
"client_id": "172896032281-84n14ko19e3isu0hjv2ned7ud0i0qe6m.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:172896032281:android:2d0faa082e26550303fc88",
"android_client_info": {
"package_name": "com.ccc.nameapp.dev"
}
},
"oauth_client": [
{
"client_id": "172896032281-lvkd7p1shacokggkktmg23d1m6d3cbsf.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.ccc.nameapp.dev",
"certificate_hash": "b9f56ba90349785fce3912ffedddccf0bc24cad2"
}
},
{
"client_id": "172896032281-84n14ko19e3isu0hjv2ned7ud0i0qe6m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyB7v5lTvysQS5Xg2-fU9hI3xAPA45UquZc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "172896032281-84n14ko19e3isu0hjv2ned7ud0i0qe6m.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:172896032281:android:1c2237d24d12c38403fc88",
"android_client_info": {
"package_name": "com.ccc.nameapp.stg"
}
},
"oauth_client": [
{
"client_id": "172896032281-9ghbddklbo99bec1s6fb1tgg0rs0m31b.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.ccc.nameapp.stg",
"certificate_hash": "b9f56ba90349785fce3912ffedddccf0bc24cad2"
}
},
{
"client_id": "172896032281-84n14ko19e3isu0hjv2ned7ud0i0qe6m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyB7v5lTvysQS5Xg2-fU9hI3xAPA45UquZc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "172896032281-84n14ko19e3isu0hjv2ned7ud0i0qe6m.apps.googleusercontent.com",
"client_type": 3
}
]
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
</activity>

<meta-data
android:name="io.fabric.ApiKey"
android:value="afa5b4969ced7faced055aca28be45ea3adfaa5f" />
android:name="firebase_performance_logcat_enabled"
android:value="true" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.ccc.nameapp.data.source.remote.service

import com.ccc.nameapp.BuildConfig
import com.ccc.nameapp.data.model.Token
import com.ccc.nameapp.data.source.remote.api.request.RefreshTokenRequest
import io.reactivex.Single
Expand All @@ -17,8 +16,6 @@ interface RestfulApi {
@FormUrlEncoded
fun loginWithEmailAndPassword(
@Field("username") username: String,
@Field("password") password: String,
@Field("client_id") clientId: String = BuildConfig.CLIENT_ID,
@Field("client_secret") clientSecret: String = BuildConfig.CLIENT_SECRET
@Field("password") password: String
): Single<Token>
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ class MainLoginFragment : DaggerFragment(), MainLoginView {
}

private fun handleEvents() {
mView.nextView.setOnClickListener { onNextClick() }
mView.nextView.setOnClickListener {
throw RuntimeException("Test Crash") // Force a crash
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ RuntimeException is a too generic Exception. Prefer throwing specific exceptions that indicate a specific error case.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This expression is followed by unreachable code which should either be used or removed.

onNextClick()
}
}

private fun onNextClick() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-vi/strings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<resources>
<string name="app_name">JobChat_Android_New</string>
<string name="app_name">ProjectName</string>

<!-- common -->
<string name="dd_mm_yyyy">yyyy/MM/dd</string>
<string name="ok">Đồng ý</string>
<string name="ok">Đồng ý</string>F
<string name="cancel">Hủy</string>
<string name="decline">Từ chối</string>
<string name="close">Đóng</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">JobChat_Android_New</string>
<string name="app_name">ProjectName</string>

<!-- common -->
<string name="dd_mm_yyyy">yyyy/MM/dd</string>
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
-Djavax.net.ssl.trustStore=/path/to/truststore -Djavax.net.ssl.trustStorePassword=password