-
Notifications
You must be signed in to change notification settings - Fork 0
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
[AN-CONFIG] 초기 세팅 AN_FEAT #6
Merged
Merged
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7900caa
initial commit
murjune da48359
docs: project 단 gitignore
murjune 1c9774c
build: gradle 버전 관리
murjune 0b03179
feat: PokeRogueHelperApp
murjune 00e6da8
chore: Manifest INTERNET 설정
murjune 5ee96c8
chore: Packaging base
murjune 7dcec61
utils: 프로젝트 ui 에서 사용할 util 추가
murjune 4036a10
utils: test util
murjune 81678ee
style: ktFormat
murjune 4b1d8bc
fix: 깃 충돌 해결
murjune 9a822bd
fix: PR Builder 수정
murjune 9356781
delete: assertj 삭제
murjune 40ed5b6
build: room 설정 및 glide-compiler
murjune ee7e2e6
refactor: 코드리뷰 반영
murjune 25a5dbe
refactor: withItemCount, performClickHolderAt 함수 RecyclerViewUtil 로 이동
murjune 2efb35f
refactor: getDeviceSize -> deviceSize로 네이밍 수정
murjune d657309
refactor: getDescription 에 View Id 추가
murjune f63df63
refactor: matchDescendantWithText 로 네이밍 수정
murjune c2baaf6
refactor: CommonBindingAdapter 로 네이밍 수정
murjune 31e2541
build: FlexboxLayout 추가
murjune File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
|
||
.idea/ | ||
|
||
.DS_Store |
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 |
---|---|---|
@@ -1,48 +1,99 @@ | ||
import org.jetbrains.kotlin.konan.properties.Properties | ||
|
||
plugins { | ||
alias(libs.plugins.androidApplication) | ||
alias(libs.plugins.jetbrainsKotlinAndroid) | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.kotlin.kapt) | ||
alias(libs.plugins.kotlinx.serialization) | ||
alias(libs.plugins.android.junit5) | ||
alias(libs.plugins.ktlint) | ||
id("kotlin-parcelize") | ||
} | ||
|
||
val properties = | ||
Properties().apply { | ||
load(rootProject.file("local.properties").inputStream()) | ||
} | ||
|
||
android { | ||
namespace = "poke.rogue.helper" | ||
compileSdk = 34 | ||
namespace = libs.versions.applicationId.get() | ||
compileSdk = libs.versions.compileSdk.get().toInt() | ||
|
||
defaultConfig { | ||
applicationId = "poke.rogue.helper" | ||
minSdk = 26 | ||
targetSdk = 34 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
applicationId = libs.versions.applicationId.get() | ||
minSdk = libs.versions.minSdk.get().toInt() | ||
targetSdk = libs.versions.targetSdk.get().toInt() | ||
versionName = libs.versions.appVersion.get() | ||
versionCode = libs.versions.versionCode.get().toInt() | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
testInstrumentationRunnerArguments["runnerBuilder"] = | ||
"de.mannodermaus.junit5.AndroidJUnit5Builder" | ||
|
||
// TODO 서버 URL 나오면 설정 | ||
// buildConfigField( | ||
// "String", | ||
// "SHOPPING_BASE_URL", | ||
// properties.getProperty("SHOPPING_BASE_URL"), | ||
// ) | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
"proguard-rules.pro", | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} | ||
packaging { | ||
resources { | ||
excludes += "META-INF/**" | ||
excludes += "win32-x86*/**" | ||
} | ||
} | ||
buildFeatures { | ||
buildConfig = true | ||
dataBinding = true | ||
} | ||
testOptions { | ||
animationsDisabled = true | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
// androidx | ||
implementation(libs.androidx.core.ktx) | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.material) | ||
implementation(libs.androidx.activity) | ||
implementation(libs.androidx.constraintlayout) | ||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.junit) | ||
androidTestImplementation(libs.androidx.espresso.core) | ||
} | ||
implementation(libs.androidx.startup) | ||
implementation(libs.androidx.lifecycle) | ||
implementation(libs.androidx.lifecycle.viewmodel) | ||
implementation(libs.kotlin.coroutines.android) | ||
implementation(libs.androidx.fragment.ktx) | ||
// retrofit & okhttp | ||
implementation(libs.bundles.retrofit) | ||
implementation(platform(libs.okhttp.bom)) | ||
implementation(libs.okhttp.logging.interceptor) | ||
// third party | ||
implementation(libs.kotlin.serialization.json) | ||
implementation(libs.timber) | ||
implementation(libs.coil.core) | ||
implementation(libs.glide) | ||
implementation(libs.splash.screen) | ||
// unit test | ||
testImplementation(libs.bundles.unit.test) | ||
testImplementation(libs.mockk.webserver) | ||
// android test | ||
androidTestImplementation(libs.bundles.android.test) | ||
androidTestRuntimeOnly(libs.junit5.android.test.runner) | ||
} |
15 changes: 4 additions & 11 deletions
15
android/app/src/androidTest/java/poke/rogue/helper/ExampleInstrumentedTest.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 |
---|---|---|
@@ -1,24 +1,17 @@ | ||
package poke.rogue.helper | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import poke.rogue.helper.util.testContext | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
val appContext = testContext | ||
assertEquals("poke.rogue.helper", appContext.packageName) | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
android/app/src/androidTest/java/poke/rogue/helper/util/ContextUtils.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,6 @@ | ||
package poke.rogue.helper.util | ||
|
||
import android.content.Context | ||
import androidx.test.core.app.ApplicationProvider | ||
|
||
val testContext: Context get() = ApplicationProvider.getApplicationContext<Context>() |
66 changes: 66 additions & 0 deletions
66
android/app/src/androidTest/java/poke/rogue/helper/util/RecyclerViewUtils.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,66 @@ | ||
package poke.rogue.helper.util | ||
|
||
import android.view.View | ||
import androidx.recyclerview.widget.RecyclerView | ||
import androidx.test.espresso.NoMatchingViewException | ||
import androidx.test.espresso.UiController | ||
import androidx.test.espresso.ViewAction | ||
import androidx.test.espresso.ViewAssertion | ||
import io.kotest.matchers.nulls.shouldNotBeNull | ||
import io.kotest.matchers.shouldBe | ||
import org.hamcrest.Matcher | ||
|
||
/** | ||
* 리사이클러뷰의 expectedCount만큼 아이템이 있는지 확인하는 ViewAssertion | ||
*/ | ||
class RecyclerViewItemCountAssertion(private val expectedCount: Int) : ViewAssertion { | ||
override fun check( | ||
view: View?, | ||
noViewFoundException: NoMatchingViewException?, | ||
) { | ||
if (noViewFoundException != null) { | ||
throw noViewFoundException | ||
murjune marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
val recyclerView = view as RecyclerView | ||
murjune marked this conversation as resolved.
Show resolved
Hide resolved
|
||
val adapter = recyclerView.adapter | ||
adapter.shouldNotBeNull() | ||
adapter.itemCount shouldBe expectedCount | ||
} | ||
} | ||
|
||
/** | ||
* 리사이클러뷰의 특정 위치에 있는 아이템을 클릭하는 ViewAction | ||
* | ||
* reference: https://gist.github.com/quentin7b/9c5669fd940865cf2e89 | ||
* | ||
* sample | ||
* ```kotlin | ||
* onView(withId(R.id.rv_shopping_cart)).perform( | ||
* RecyclerViewActions.actionOnItemAtPosition<CartAdapter.CartViewHolder>( | ||
* 3, // 3번째 아이템 | ||
* clickChildViewWithId(R.id.iv_shooping_cart_delete), // id가 iv_shooping_cart_delete인 뷰 클릭 | ||
* ), | ||
* ) | ||
|
||
* ``` | ||
*/ | ||
fun clickChildViewWithId(id: Int): ViewAction { | ||
return object : ViewAction { | ||
override fun getConstraints(): Matcher<View>? { | ||
return null | ||
} | ||
|
||
override fun getDescription(): String { | ||
return "Click on specific button" | ||
murjune marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
override fun perform( | ||
uiController: UiController, | ||
view: View, | ||
) { | ||
val v = view.findViewById<View>(id) | ||
v.performClick() | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
android/app/src/androidTest/java/poke/rogue/helper/util/ViewAssertionUtils.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,38 @@ | ||
package poke.rogue.helper.util | ||
|
||
import androidx.test.espresso.ViewAssertion | ||
import androidx.test.espresso.assertion.ViewAssertions | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import org.hamcrest.CoreMatchers | ||
|
||
/** | ||
* 자식 뷰의 텍스트를 포함하는 뷰가 있는지 확인하는 ViewAssertion을 반환하는 함수 | ||
* | ||
* sample | ||
* ```kotlin | ||
* // 리사이클러뷰의 자식 뷰 중 텍스트에 "텍스트"가 포함된 뷰가 있는지 확인 | ||
* onView(withId(R.id.rv_shopping_cart)).check(matchDescendantSoftly("텍스트")) | ||
* ``` | ||
*/ | ||
fun matchDescendantSoftly(text: String): ViewAssertion { | ||
murjune marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return ViewAssertions.matches( | ||
ViewMatchers.hasDescendant( | ||
ViewMatchers.withText( | ||
CoreMatchers.containsString(text), | ||
), | ||
), | ||
) | ||
} | ||
|
||
/** | ||
* 리사이클러뷰의 아이템 개수를 확인하는 ViewAssertion을 반환하는 함수 | ||
* | ||
* sample | ||
* ```kotlin | ||
* // 리사이클러뷰의 아이템 개수가 3개인지 확인 | ||
* onView(withId(R.id.rv_shopping_cart)).check(withItemCount(3)) | ||
* ``` | ||
*/ | ||
fun withItemCount(expectedCount: Int): ViewAssertion { | ||
murjune marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return RecyclerViewItemCountAssertion(expectedCount) | ||
} |
26 changes: 26 additions & 0 deletions
26
android/app/src/androidTest/java/poke/rogue/helper/util/ViewInteractionExtensions.kt
murjune marked this conversation as resolved.
Show resolved
Hide resolved
|
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,26 @@ | ||
package poke.rogue.helper.util | ||
|
||
import androidx.annotation.IdRes | ||
import androidx.recyclerview.widget.RecyclerView | ||
import androidx.test.espresso.ViewInteraction | ||
import androidx.test.espresso.contrib.RecyclerViewActions | ||
import org.hamcrest.CoreMatchers | ||
|
||
inline fun <reified T : RecyclerView.ViewHolder> ViewInteraction.performScrollToHolder(position: Int = 0): ViewInteraction { | ||
return perform( | ||
RecyclerViewActions.scrollToHolder(CoreMatchers.instanceOf(T::class.java)) | ||
.atPosition(position), | ||
) | ||
} | ||
|
||
fun <T : RecyclerView.ViewHolder> ViewInteraction.performClickHolderAt( | ||
absolutePosition: Int = 0, | ||
@IdRes childViewId: Int, | ||
): ViewInteraction { | ||
return perform( | ||
RecyclerViewActions.actionOnItemAtPosition<T>( | ||
absolutePosition, | ||
clickChildViewWithId(childViewId), | ||
), | ||
) | ||
} |
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
11 changes: 11 additions & 0 deletions
11
android/app/src/main/java/poke/rogue/helper/HomeActivity.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,11 @@ | ||
package poke.rogue.helper | ||
|
||
import android.os.Bundle | ||
import poke.rogue.helper.databinding.ActivityHomeBinding | ||
import poke.rogue.helper.presentation.base.BindingActivity | ||
|
||
class HomeActivity : BindingActivity<ActivityHomeBinding>(R.layout.activity_home) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
} | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timber
라이브러리를 사용하는 이유가이정도 이유 때문에 사용하는 걸까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞습니다! 디버그용 로그로 사용하기 좋아용
이게 무슨 뜻인가요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
잘은 모르지만.. Sentry ? 같은 에러 모니터링 툴과 같이 사용하기에 용이하다는 뜻으로 이해했어용