Skip to content

Commit

Permalink
#7 Feature google client id move to local properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Heonbyeong committed Jul 12, 2022
1 parent 2f665fc commit 78b1b74
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
7 changes: 1 addition & 6 deletions data/src/main/java/com/knowing/data/remote/api/AuthAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ import retrofit2.http.Url

interface AuthAPI {
@POST("/google")
suspend fun googleLogin(
suspend fun fetchGoogleSignIn(
@Body body: GoogleLoginRequest
): GoogleLoginResponse

@POST
suspend fun fetchGoogleAuthInfo(
@Url url: String
)
}
8 changes: 7 additions & 1 deletion presentation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
Expand All @@ -16,6 +18,7 @@ android {
versionName = Versions.VERSIONS_NAME

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "GOOGLE_CLIENT_ID", getGoogleClientId("GOOGLE_CLIENT_ID"))
}

buildTypes {
Expand Down Expand Up @@ -69,4 +72,7 @@ dependencies {
testImplementation(Dependency.UnitTest.JUNIT)
androidTestImplementation(Dependency.AndroidTest.ANDROID_JUNIT)
androidTestImplementation(Dependency.AndroidTest.ESPRESSO_CORE)
}
}

fun getGoogleClientId(propertyKey: String): String =
gradleLocalProperties(rootDir).getProperty(propertyKey)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.android.gms.common.Scopes
import com.google.android.gms.common.api.ApiException
import com.google.android.gms.common.api.Scope
import com.knowing.draven.BuildConfig

class LoginActivity : BaseActivity<ActivityLoginBinding>(R.layout.activity_login) {

Expand All @@ -24,7 +25,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>(R.layout.activity_login
binding.activity = this

val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestServerAuthCode(getString(R.string.google_client_id))
.requestServerAuthCode(BuildConfig.GOOGLE_CLIENT_ID)
.requestEmail()
.build()
val client = GoogleSignIn.getClient(this, gso)
Expand Down
3 changes: 1 addition & 2 deletions presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<string name="title_home">Home</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_notifications">Notifications</string>
<string name="google_client_id">414970516629-654sesumfduk6dgv32cfcsiof4djkr1k.apps.googleusercontent.com</string>


<!-- sign -->
<string name="login_title">세상의 모든 질문을,\nKnowing.</string>
<string name="login_auth_description">로그인 후 질문해보세요.</string>
Expand Down

0 comments on commit 78b1b74

Please sign in to comment.