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

[chore] 기초 세팅 / Github Actions 세팅, KtLint 적용 #94

Merged
merged 18 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
tab_width = 4
disabled_rules = no-wildcard-imports,import-ordering,comment-spacing
13 changes: 11 additions & 2 deletions .github/workflows/pr_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ jobs:
echo auth.base.url=$AUTH_BASE_URL >> ./local.properties

- name: Build debug APK
run: ./gradlew assembleDebug --stacktrace
run: bash ./gradlew assembleDebug --stacktrace

- name: Upload APK
uses: actions/upload-artifact@v1
with:
name: app
path: app/build/outputs/apk/debug

- name: Run ktlint
run: ./gradlew ktlintCheck

- name: On Success, Notify in Slack
if: ${{ success() }}
Expand All @@ -68,4 +77,4 @@ jobs:
SLACK_TITLE: 'Winey checks have failed 🚫'
MSG_MINIMAL: true
SLACK_USERNAME: Winey Android
SLACK_MESSAGE: '버그 잡자 ㅋㅅㅋ'
SLACK_MESSAGE: '버그 잡자 🐛'
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins {
id(Plugins.kotlinAndroid)
id(Plugins.kotlinParcelize)
id(Plugins.kotlinKapt)
id(Plugins.hiltPlugin)
id(Plugins.ossLicensesPlugin)
id(Plugins.kotlinSerialization)
id(Plugins.hilt)
id(Plugins.oss)
}

android {
Expand All @@ -24,7 +24,7 @@ android {
buildConfigField(
"String",
"AUTH_BASE_URL",
gradleLocalProperties(rootDir).getProperty("auth.base.url"),
gradleLocalProperties(rootDir).getProperty("auth.base.url")
)

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -94,7 +94,7 @@ dependencies {
implementation(MaterialDesignDependencies.materialDesign)

KaptDependencies.run {
kapt(hiltCompiler)
kapt(hiltAndroidCompiler)
kapt(hiltWorkManagerCompiler)
}

Expand All @@ -117,4 +117,4 @@ dependencies {
debugImplementation(flipperLeakCanary)
debugImplementation(soloader)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package com.android.go.sopt.winey

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.android.go.sopt.winey", appContext.packageName)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class WineyApplication : Application() {
super.onCreate()
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import okhttp3.Interceptor
import okhttp3.Response
import javax.inject.Inject


class AuthInterceptor @Inject constructor(
@ApplicationContext context: Context
) : Interceptor {
Expand All @@ -24,4 +23,4 @@ class AuthInterceptor @Inject constructor(
private const val HEADER_TOKEN = "userId"
const val USER_ID = "24"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class RequestCreateGoalDto(
@SerialName("targetMoney")
val targetMoney : Int,
val targetMoney: Int,
@SerialName("targetDay")
val targetDay : Int,
val targetDay: Int
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
@Serializable
data class RequestPostLikeDto(
@SerialName("feedLike")
val feedLike : Boolean
val feedLike: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import kotlinx.serialization.Serializable
@Serializable
data class ResponseCreateGoalDto(
@SerialName("userId")
val userId : Int,
val userId: Int,
@SerialName("targetMoney")
val targetMoney : Long,
val targetMoney: Long,
@SerialName("targetDate")
val targetDate: String,
@SerialName("createdAt")
val createdAt: String,
){
val createdAt: String
) {
fun toGoal(): Goal {
val data = this

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ data class ResponseDeleteWineyFeedDto(
val code: Int,
val data: Any,
val message: String
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data class ResponseGetRecommendListDto(
@SerialName("currentPageIndex")
val currentPageIndex: Int,
@SerialName("isEnd")
val isEnd: Boolean,
val isEnd: Boolean
)

@Serializable
Expand Down Expand Up @@ -46,7 +46,7 @@ data class ResponseGetRecommendListDto(
title = it.recommendTitle ?: "",
subtitle = it.recommendSubTitle ?: "",
discount = it.recommendDiscount ?: "",
image = it.recommendImage ?: "",
image = it.recommendImage ?: ""
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ data class ResponseGetUserDto(
isAttained = data.userResponseGoalDto?.isAttained ?: false
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ data class ResponseGetWineyFeedListDto(
totalPageSize = data.pageResponseDto.totalPageSize
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ data class ResponsePostLikeDto(
val likeData = Like.Data(data.feedId, data.isLiked, data.likes)
return Like(code, likeData, message)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ data class ResponsePostWineyFeedDto(
val feedId: Int,
@SerialName("createdAt")
val createdAt: LocalDateTime
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ data class BaseResponse<T>(
@SerialName("message")
val message: String,
@SerialName("data")
val data: T? = null,
)
val data: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class AuthRepositoryImpl @Inject constructor(
response.toWineyFeed()
}


override suspend fun postWineyFeed(
file: MultipartBody.Part?,
requestMap: HashMap<String, RequestBody>
Expand All @@ -49,7 +48,7 @@ class AuthRepositoryImpl @Inject constructor(

override suspend fun postFeedLike(feedId: Int, requestPostLikeDto: RequestPostLikeDto): Result<Like> =
runCatching {
authDataSource.postFeedLike(feedId,requestPostLikeDto).toLike()
authDataSource.postFeedLike(feedId, requestPostLikeDto).toLike()
}

override suspend fun postCreateGoal(requestCreateGoalDto: RequestCreateGoalDto): Result<Goal> =
Expand All @@ -61,5 +60,4 @@ class AuthRepositoryImpl @Inject constructor(
runCatching {
authDataSource.getRecommendList(page).data!!.convertToRecommend()
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface AuthService {

@GET("feed/myFeed")
suspend fun getMyFeedList(
@Query("page") page:Int
@Query("page") page: Int
): ResponseGetWineyFeedListDto

@POST("feedLike/{feedId}")
Expand All @@ -55,10 +55,11 @@ interface AuthService {

@GET("recommend")
suspend fun getRecommendList(
@Query("page") page:Int
@Query("page") page: Int
): BaseResponse<ResponseGetRecommendListDto>

@DELETE("feed/{feedId}")
suspend fun deleteFeed(
@Path("feedId") feedId: Int
): BaseResponse<Unit>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class AuthDataSource @Inject constructor(
suspend fun postCreateGoal(requestCreateGoalDto: RequestCreateGoalDto): BaseResponse<ResponseCreateGoalDto> =
authService.postCreateGoal(requestCreateGoalDto)

suspend fun getRecommendList(page: Int) : BaseResponse<ResponseGetRecommendListDto> =
suspend fun getRecommendList(page: Int): BaseResponse<ResponseGetRecommendListDto> =
authService.getRecommendList(page)
suspend fun deleteFeed(feedId: Int): BaseResponse<Unit> =
authService.deleteFeed(feedId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ abstract class RepositoryModule {
abstract fun bindsAuthRepository(
authRepository: AuthRepositoryImpl
): AuthRepository
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ object RetrofitModule {
@Provides
@Singleton
@Auth
fun provideAuthInterceptor (interceptor: AuthInterceptor): Interceptor = interceptor
fun provideAuthInterceptor(interceptor: AuthInterceptor): Interceptor = interceptor

@Provides
@Singleton
fun provideOkHttpClient(
@Logger loggingInterceptor: Interceptor,
@Auth authInterceptor: Interceptor,
@Auth authInterceptor: Interceptor
): OkHttpClient = OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.addInterceptor(authInterceptor)
Expand All @@ -61,10 +61,10 @@ object RetrofitModule {
@Singleton
fun provideRetrofit(
client: OkHttpClient,
factory: Converter.Factory,
factory: Converter.Factory
): Retrofit = Retrofit.Builder()
.baseUrl(AUTH_BASE_URL)
.client(client)
.addConverterFactory(factory)
.build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ object ServiceModule {
@Singleton
fun provideAuthService(retrofit: Retrofit): AuthService =
retrofit.create(AuthService::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import javax.inject.Qualifier

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class Logger
annotation class Logger

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class Auth
annotation class Auth
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package com.android.go.sopt.winey.domain.entity

data class Goal(
val userId: Int,
val targetMoney: Long,
val targetMoney: Long
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ data class Like(
val isLiked: Boolean,
val likes: Int
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ data class Recommend(
val title: String,
val subtitle: String,
val discount: String,
val image: String,
val image: String
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.android.go.sopt.winey.domain.entity


data class WineyFeed (
data class WineyFeed(
val feedId: Int,
val feedImage: String,
val feedMoney: Long,
Expand All @@ -12,4 +11,4 @@ data class WineyFeed (
val userId: Int,
val writerLevel: Int,
val totalPageSize: Int
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ interface AuthRepository {

suspend fun getRecommendList(page: Int): Result<List<Recommend>>
suspend fun deleteFeed(feedId: Int): Result<Unit>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
replace<T>(R.id.fcv_main, T::class.simpleName)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import javax.inject.Inject

@HiltViewModel
class MainViewModel @Inject constructor(
private val authRepository: AuthRepository,
) : ViewModel(){
private val authRepository: AuthRepository
) : ViewModel() {
private val _getUserState = MutableLiveData<UiState<User>>(UiState.Loading)
val getUserState: LiveData<UiState<User>> get() = _getUserState

Expand All @@ -42,4 +42,4 @@ class MainViewModel @Inject constructor(
}
}
}
}
}
Loading
Loading