Skip to content

Commit

Permalink
Merge pull request #283 from team-peekabook/feature/#275-feat-open-so…
Browse files Browse the repository at this point in the history
…urce

#275 [feat/fix] 오픈소스 라이선스 구현, okhttp 로깅 개선, 카카오 로그인 프로가드 설정 #281 #282
  • Loading branch information
2zerozu authored Dec 22, 2023
2 parents 3c3677f + 2c3d032 commit 7d9d1f2
Show file tree
Hide file tree
Showing 27 changed files with 144 additions and 48 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/pr_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,33 @@ jobs:
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
KAKAO_REDIRECT_SCHEME: ${{ secrets.KAKAO_REDIRECT_SCHEME }}
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
STORE_FILE: ${{ secrets.STORE_FILE }}
run: |
echo BASE_URI=\"$BASE_URI\" >> local.properties
echo NAVER_URL=\"$NAVER_URL\" >> local.properties
echo CLIENT_ID=\"$CLIENT_ID\" >> local.properties
echo CLIENT_SECRET=\"$CLIENT_SECRET\" >> local.properties
echo KAKAO_NATIVE_APP_KEY=\"KAKAO_NATIVE_APP_KEY\" >> local.properties
echo KAKAO_REDIRECT_SCHEME=\"KAKAO_REDIRECT_SCHEME\" >> local.properties
echo STORE_PASSWORD= $STORE_PASSWORD >> local.properties
echo KEY_PASSWORD= $KEY_PASSWORD >> local.properties
echo KEY_ALIAS= $KEY_ALIAS >> local.properties
echo STORE_FILE= $STORE_FILE >> local.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Create keystore
run: |
mkdir -p app/keystore
touch app/keystore/peeka_key.jks
- name: decode release keystore
run: echo "${{ secrets.RELEASE_KEYSTORE_FILE_BASE_64 }}" | base64 -d > app/keystore/peeka_key.jks

- name: Lint Check
run: ./gradlew ktlintCheck

Expand Down
35 changes: 26 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
id "org.jlleitschuh.gradle.ktlint" version "10.3.0"
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.0'
id 'com.google.gms.google-services'
id 'com.google.android.gms.oss-licenses-plugin'
}

Properties properties = new Properties()
Expand Down Expand Up @@ -36,11 +37,25 @@ android {
abortOnError false
}

signingConfigs {
release {
storeFile file(properties["STORE_FILE"])
keyAlias properties["KEY_ALIAS"]
keyPassword properties["KEY_PASSWORD"]
storePassword properties["STORE_PASSWORD"]
}
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
proguardFile 'proguard-rules.pro'
proguardFile 'proguard-retrofit2.pro'
proguardFile 'proguard-okhttp3.pro'
proguardFile 'proguard-glide.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
Expand All @@ -58,6 +73,8 @@ android {
}

dependencies {
// open source
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.1'

// hilt
implementation 'com.google.dagger:hilt-android:2.48.1'
Expand All @@ -67,7 +84,7 @@ dependencies {
implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha06'

// ktx
implementation 'androidx.activity:activity-ktx:1.8.1'
implementation 'androidx.activity:activity-ktx:1.8.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
implementation 'androidx.fragment:fragment-ktx:1.6.2'
Expand All @@ -91,14 +108,14 @@ dependencies {
implementation 'com.jakewharton.timber:timber:5.0.1'

//navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.5'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.6'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.6'

// CameraX
implementation 'androidx.camera:camera-core:1.3.0'
implementation 'androidx.camera:camera-camera2:1.3.0'
implementation 'androidx.camera:camera-lifecycle:1.3.0'
implementation 'androidx.camera:camera-view:1.3.0'
implementation 'androidx.camera:camera-core:1.3.1'
implementation 'androidx.camera:camera-camera2:1.3.1'
implementation 'androidx.camera:camera-lifecycle:1.3.1'
implementation 'androidx.camera:camera-view:1.3.1'

// ML Kit
implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.0'
Expand All @@ -116,7 +133,7 @@ dependencies {
implementation 'com.kakao.sdk:v2-user:2.11.0'

// exifinterface
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'androidx.exifinterface:exifinterface:1.3.7'

// firebase
implementation platform('com.google.firebase:firebase-bom:32.6.0')
Expand Down
6 changes: 6 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@

# https://developers.kakao.com/docs/latest/en/getting-started/sdk-android#configure-for-shrinking-and-obfuscation-(optional)
-keep class com.kakao.sdk.**.model.* { <fields>; }
-keep interface com.kakao.sdk.**.*Api
-keep class * extends com.google.gson.TypeAdapter

# https://github.com/square/okhttp/pull/6792
-dontwarn org.bouncycastle.jsse.**
-dontwarn org.conscrypt.*
-dontwarn org.openjsse.**

-keep class com.sopt.peekabookaos.domain.entity.** { *; }
-keep class com.sopt.peekabookaos.data.entity.** { *; }

Expand Down
14 changes: 12 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@
android:supportsRtl="true"
android:theme="@style/Theme.PeekabookAOS"
android:usesCleartextTraffic="true"
tools:targetApi="31">
tools:targetApi="33">
<activity
android:name=".presentation.forceUpdate.ForcedUpdateActivity"
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/OpenSourceItemTheme" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/OpenSourceItemTheme" />
<activity
android:name=".presentation.forcedUpdate.ForcedUpdateActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ object NaverRetrofitModule {
fun providesNaverOkHttpClient(@NaverType interceptor: Interceptor): OkHttpClient =
OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS).readTimeout(10, TimeUnit.SECONDS)
.addInterceptor(interceptor).addInterceptor(
.addInterceptor(interceptor)
.addInterceptor(
HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
level =
if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE
}
).build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ object RefreshRetrofitModule {
.readTimeout(5, TimeUnit.SECONDS)
.addInterceptor(interceptor)
.addInterceptor(
HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY }
HttpLoggingInterceptor().apply {
level =
if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE
}
)
.build()

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/sopt/peekabookaos/di/RetrofitModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ object RetrofitModule {
}
}
}

SERVER_ERROR -> {
Handler(Looper.getMainLooper()).post {
ToastMessageUtil.showToast(
Expand All @@ -138,7 +139,8 @@ object RetrofitModule {
.addInterceptor(interceptor)
.addInterceptor(
HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
level =
if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE
}
).build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ class BookActivity : BindingActivity<ActivityBookBinding>(R.layout.activity_book
when (intent.getStringExtra(LOCATION) ?: CREATE) {
RECOMMEND -> {
navController.navigate(R.id.action_barcodeScannerFragment_to_searchBookFragment)
activityOpenTransition(R.animator.anim_from_right, R.animator.anim_to_left)
activityOpenTransition(R.anim.anim_from_right, R.anim.anim_to_left)
}

else -> {
navController.navigate(R.id.barcodeScannerFragment)
activityOpenTransition(R.animator.anim_from_bottom, R.animator.anim_to_top)
activityOpenTransition(R.anim.anim_from_bottom, R.anim.anim_to_top)
}
}
}

override fun finish() {
super.finish()
activityCloseTransition(R.animator.anim_from_left, R.animator.anim_to_right)
activityCloseTransition(R.anim.anim_from_left, R.anim.anim_to_right)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.peekabookaos.presentation.forceUpdate
package com.sopt.peekabookaos.presentation.forcedUpdate

import android.content.Intent
import android.net.Uri
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.peekabookaos.presentation.forceUpdate
package com.sopt.peekabookaos.presentation.forcedUpdate

import androidx.lifecycle.ViewModel
import com.sopt.peekabookaos.domain.entity.UpdateInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.fragment.app.viewModels
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import com.sopt.peekabookaos.R
import com.sopt.peekabookaos.databinding.FragmentMyPageBinding
import com.sopt.peekabookaos.presentation.block.BlockedUserActivity
Expand Down Expand Up @@ -35,6 +36,7 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
initLinkInfoClickListener()
initLinkAskClickListener()
initLinkPolicyClickListener()
initOpenSourceClickListener()
}

private fun initBlockBtnClickListener() {
Expand Down Expand Up @@ -96,6 +98,13 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
}
}

private fun initOpenSourceClickListener() {
binding.tvMyPageOpenSourceInfo.setSingleOnClickListener {
startActivity(Intent(requireActivity(), OssLicensesMenuActivity::class.java))
OssLicensesMenuActivity.setActivityTitle(getString(R.string.my_page_open_source))
}
}

companion object {
const val USER_INFO = "user_info"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.sopt.peekabookaos.R
import com.sopt.peekabookaos.databinding.ActivitySplashBinding
import com.sopt.peekabookaos.domain.entity.SplashUiState
import com.sopt.peekabookaos.domain.entity.UpdateInformation
import com.sopt.peekabookaos.presentation.forceUpdate.ForcedUpdateActivity
import com.sopt.peekabookaos.presentation.forcedUpdate.ForcedUpdateActivity
import com.sopt.peekabookaos.presentation.main.MainActivity
import com.sopt.peekabookaos.presentation.networkError.NetworkErrorActivity.Companion.LOCATION
import com.sopt.peekabookaos.presentation.networkError.NetworkErrorActivity.Companion.NETWORK_ERROR
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_forced_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

<variable
name="viewModel"
type="com.sopt.peekabookaos.presentation.forceUpdate.ForcedUpdateViewModel" />
type="com.sopt.peekabookaos.presentation.forcedUpdate.ForcedUpdateViewModel" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/network_background"
tools:context=".presentation.forceUpdate.ForcedUpdateActivity">
tools:context=".presentation.forcedUpdate.ForcedUpdateActivity">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
Expand Down
32 changes: 16 additions & 16 deletions app/src/main/res/navigation/nav_book.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
<action
android:id="@+id/action_barcodeScannerFragment_to_searchBookFragment"
app:destination="@id/searchBookFragment"
app:enterAnim="@animator/anim_from_right"
app:exitAnim="@animator/anim_to_left"
app:popEnterAnim="@animator/anim_from_left"
app:popExitAnim="@animator/anim_to_right"
app:enterAnim="@anim/anim_from_right"
app:exitAnim="@anim/anim_to_left"
app:popEnterAnim="@anim/anim_from_left"
app:popExitAnim="@anim/anim_to_right"
app:popUpTo="@id/nav_book" />

<action
android:id="@+id/action_barcodeScannerFragment_to_createBookFragment"
app:destination="@id/createBookFragment"
app:enterAnim="@animator/anim_from_right"
app:exitAnim="@animator/anim_to_left"
app:popEnterAnim="@animator/anim_from_left"
app:popExitAnim="@animator/anim_to_right"
app:enterAnim="@anim/anim_from_right"
app:exitAnim="@anim/anim_to_left"
app:popEnterAnim="@anim/anim_from_left"
app:popExitAnim="@anim/anim_to_right"
app:popUpTo="@id/barcodeScannerFragment"
app:popUpToInclusive="true" />
</fragment>
Expand All @@ -38,20 +38,20 @@
<action
android:id="@+id/action_searchBookFragment_to_createBookFragment"
app:destination="@id/createBookFragment"
app:enterAnim="@animator/anim_from_right"
app:exitAnim="@animator/anim_to_left"
app:popEnterAnim="@animator/anim_from_left"
app:popExitAnim="@animator/anim_to_right"
app:enterAnim="@anim/anim_from_right"
app:exitAnim="@anim/anim_to_left"
app:popEnterAnim="@anim/anim_from_left"
app:popExitAnim="@anim/anim_to_right"
app:popUpTo="@id/searchBookFragment"
app:popUpToInclusive="false" />

<action
android:id="@+id/action_searchBookFragment_to_recommendationFragment"
app:destination="@id/recommendationFragment"
app:enterAnim="@animator/anim_from_right"
app:exitAnim="@animator/anim_to_left"
app:popEnterAnim="@animator/anim_from_left"
app:popExitAnim="@animator/anim_to_right" />
app:enterAnim="@anim/anim_from_right"
app:exitAnim="@anim/anim_to_left"
app:popEnterAnim="@anim/anim_from_left"
app:popExitAnim="@anim/anim_to_right" />
</fragment>

<fragment
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/res/navigation/nav_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<action
android:id="@+id/action_socialLoginFragment_to_userInputFragment"
app:destination="@id/userInputFragment"
app:enterAnim="@animator/anim_from_right"
app:exitAnim="@animator/anim_to_left"
app:popEnterAnim="@animator/anim_from_left"
app:popExitAnim="@animator/anim_to_right" />
app:enterAnim="@anim/anim_from_right"
app:exitAnim="@anim/anim_to_left"
app:popEnterAnim="@anim/anim_from_left"
app:popExitAnim="@anim/anim_to_right" />
</fragment>

<fragment
Expand All @@ -27,10 +27,10 @@
<action
android:id="@+id/action_userInputFragment_to_socialLoginFragment"
app:destination="@id/socialLoginFragment"
app:enterAnim="@animator/anim_from_left"
app:exitAnim="@animator/anim_to_right"
app:popEnterAnim="@animator/anim_from_right"
app:popExitAnim="@animator/anim_to_left"
app:enterAnim="@anim/anim_from_left"
app:exitAnim="@anim/anim_to_right"
app:popEnterAnim="@anim/anim_from_right"
app:popExitAnim="@anim/anim_to_left"
app:popUpTo="@id/socialLoginFragment"
app:popUpToInclusive="true" />
</fragment>
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
Expand Up @@ -80,7 +80,7 @@
<string name="my_page_policy"><![CDATA[개인정보 보호 정책 & 서비스 이용 약관]]></string>
<string name="my_page_ask">문의하기</string>
<string name="my_page_info">개발자 정보</string>
<string name="my_page_open_source">오픈소스 라이브러리</string>
<string name="my_page_open_source">오픈소스 라이선스</string>
<string name="my_page_logout">로그아웃</string>
<string name="my_page_withdraw">서비스 탈퇴하기</string>
<string name="my_page_developer_info_link">https://interesting-door-b57.notion.site/About-Team-b25424073add46b9a186d69c17815bf2</string>
Expand Down
Loading

0 comments on commit 7d9d1f2

Please sign in to comment.