-
Notifications
You must be signed in to change notification settings - Fork 48
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
[부나] 2단계 재화 미션 제출합니다. #26
Merged
Merged
Changes from all commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
a7a3ad9
feat: 하마드 서버 base url 추가
tmdgh1592 b100514
feat(Page): 공통 코드를 Page 클래스로 이동
tmdgh1592 79a07c9
docs: 주문 기능 구현 기능 목록 작성
tmdgh1592 8b7cc29
chore: Retrofit 라이브러리 추가
tmdgh1592 4e05fce
feat: RetrofitServiceCreater 구현
tmdgh1592 ffbf8c3
refactor: OkHttpClient를 Retrofit으로 리팩터링
tmdgh1592 708d742
feat: 상품 주문하기 ui 구현
tmdgh1592 9ad002d
feat: 주문할 상품을 보여주는 화면 구현
tmdgh1592 491ff6a
feat: PointEditText 커스텀뷰 구현
tmdgh1592 b2de7d3
feat: 장바구니 아이템 주문하는 기능 구현
tmdgh1592 902b7c9
feat: 쇼핑 목록 화면으로 이동하는 기능 구현
tmdgh1592 4f6292c
feat: 주문 목록을 불러오는 기능 구현
tmdgh1592 521ed80
feat: 상세 주문 내역을 보여주는 기능 구현
tmdgh1592 db6e20d
fix: 상품 주문시, 상품 id와 수량을 서버에 보내는 대신 cartItemId를 전달하도록 변경
tmdgh1592 cc52965
refactor: RecyclerViewBindingAdapter의 setAdapter 메서드의 인자를 ConcatAdapt…
tmdgh1592 9b4c856
refactor: ORDER_DETAIL과 ORDER 뷰타입의 value를 OrderProduct에서 관리하도록 변경
tmdgh1592 c9babbe
refactor: cartItemIds를 orderItems로 변경
tmdgh1592 4c4311b
chore: kotlinx.serialization 라이브러리 추가
tmdgh1592 d7e8da7
refactor: Dto에 Serializable 어노테이션 추가
tmdgh1592 4054061
feat: 각 화면별로 뒤로가기 기능 구현
tmdgh1592 558c694
refactor: 라인 포맷팅
tmdgh1592 4b6cfed
refactor: isolatedViewTypeConcatAdapter을 notIsolatedViewTypeConcatAda…
tmdgh1592 8a05f31
feat: 스낵바를 보여주는 확장함수 구현
tmdgh1592 15ef714
refactor: 상품 주문 완료시 스낵바로 메시지를 보여주도록 변경
tmdgh1592 87709b2
refactor: 사용하지 않는 클래스, 메서드 제거
tmdgh1592 9685128
refactor: ShoppingDatabase를 싱클톤으로 변경
tmdgh1592 c68c1f1
refactor: inject 메서드명을 명시적으로 변경
tmdgh1592 471bf9a
refactor: ui의 CartProduct typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 05e244c
refactor: ui의 OrderModel typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 3f9f6e8
refactor: ui의 OrderProductModel typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 f5a1fd1
refactor: ui의 UiPage typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 53e96a7
refactor: ui의 UiPayment typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 948c74f
refactor: ui의 PointUi typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 740390a
refactor: ui의 PriceUi typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 ea3d85a
refactor: ui의 UiProduct typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 aecf209
refactor: ui의 UiProductCount typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 aea0e58
refactor: ui의 UiRecentProduct typealias를 제거하고 Model suffix를 붙이도록 변경
tmdgh1592 2dd17a1
refactor: 함수 네이밍 통일화
tmdgh1592 f479f24
refactor: 재화 관련 도메인을 추상화
tmdgh1592 93b2b76
refactor: OrderPresenter 중복 코드를 메서드로 분리
tmdgh1592 9a6a1cd
refactor: Ui 모델 파라미터명을 cartProductModel로 변경
tmdgh1592 3e167d6
refactor: 네이밍 통일화
tmdgh1592 46b6475
refactor: abstract class를 interface로 변경
tmdgh1592 0196ee7
refactor: page 관련 뷰 업데이트를 하나의 추상 메서드로 변경
tmdgh1592 8f88737
refactor: OrderActivity의 showOrders 메서드명 변경
tmdgh1592 c33533c
refactor: PaymentRequest의 SerializedName 파라미터명 변경
tmdgh1592 1255597
test: ProductDetailPresenter 테스트 코드 작성
tmdgh1592 ab5d8e8
test: ShoppingPresenter 테스트 코드 작성
tmdgh1592 611aca8
test: OrderPresenter 테스트 코드 작성
tmdgh1592 6211ba8
feat: 응답에 대해 response의 body null 여부를 검사하도록 변경
tmdgh1592 59459aa
refactor: typealias가 적용되지 않은 ProductId에 typealias 적용
tmdgh1592 31df852
fix: item_order_history.xml에서 binding type이 맞지 않아 크래시 발생하는 버그 수정
tmdgh1592 743fb78
fix: item_order_history.xml에서 제품 이미지뷰에 scaleType 적용
tmdgh1592 c716daa
feat: 상세 주문 내역 뒤로가기 기능 구현
tmdgh1592 8a67f4f
feat: Gson의 SerializedName을 kotlinx-serialization의 SerialName으로 변경
tmdgh1592 6637bb7
chore: Gson 라이브러리 의존성 제거
tmdgh1592 ce80e22
fix: gson 라이브러리 import 제거
tmdgh1592 ccf431b
fix: 주문 상세 리사이클러뷰에서 아이템이 보여지지 않는 버그 수정
tmdgh1592 a9a1cbf
feat: 주문 상세 아이템의 상품 이미지에 scaleType(centerCrop) 적용
tmdgh1592 02836bc
fix: 결제 아이템 뷰의 높이를 wrap_content로 변경
tmdgh1592 e1fded7
fix: CounterView의 숫자를 클릭하면 뒤의 배경이 클릭되는 버그 수정
tmdgh1592 23e0295
refactor: Log 출력 제거
tmdgh1592 6deb885
refactor: 코드 포맷팅
tmdgh1592 7b5f9a4
fix: 토큰 설정이 안 되었던 버그 수정
tmdgh1592 a59cc1b
refactor: 주문 목록 가져오는 api body 형식 변경에 따른 dto 변경
tmdgh1592 5f2fb98
feat: 필요 없는 않는 json 변환 옵션 제거
tmdgh1592 f2f6a9b
refactor: toText() 시그니처 대신 toString()을 오버라이드하여 사용하도록 변경
tmdgh1592 4497d33
refactor: 제품 가져오기 페이지네이션 api 적용
tmdgh1592 a70f99e
refactor: 주문 목록 api 변경에 따른 스펙 변경
tmdgh1592 0bc40f5
refactor: findCartProductByProductId의 실패 콜백 람다의 인자 변경
tmdgh1592 f2bd29c
refactor: 장바구니에 담긴 제품 개수를 매번 서버에 요청하도록 변경
tmdgh1592 a82f66f
refactor: Repository 네이밍의 Impl을 Default로 변경
tmdgh1592 5c9cea7
feat: 주문 목록 페이징 구현
tmdgh1592 1e09e7a
fix: 쇼핑 리스트 페이지네이션이 동작하지 않는 버그 수정
tmdgh1592 1a46c16
refactor: 주문 목록 더 보기 기능에서 take 함수를 호출하지 않도록 변경
tmdgh1592 1a2b2ff
fix: 최근 상품 목록에서 장바구니 개수가 담기지 않는 버그 수정
tmdgh1592 39f71be
fix: 최근 상품 디테일 화면에서 상품 개수를 더해지지 않는 버그 수정
tmdgh1592 d9c98c2
fix: 커스텀뷰에서 TypedArray 인스턴스에 use 사용를 사용하는 대신 recycle() 메서드를 호출하도록 변경
tmdgh1592 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
# android-shopping-order | ||
|
||
## UI | ||
- [ ] 데이터가 로딩되기 전 상태에서는 스켈레톤 UI를 노출한다. | ||
- [ ] 메인 액티비티가 로딩되기 전에 서버를 선택한다. | ||
- [x] 데이터가 로딩되기 전 상태에서는 스켈레톤 UI를 노출한다. | ||
- [x] 메인 액티비티가 로딩되기 전에 서버를 선택한다. | ||
|
||
## Domain | ||
- [ ] 사용자 인증 정보를 저장한다. | ||
- [ ] 서버를 선택하여 교체할 수 있다. | ||
- [x] 사용자 인증 정보를 저장한다. | ||
- [x] 서버를 선택하여 교체할 수 있다. | ||
- [x] 장바구니에 담은 상품을 주문할 수 있다. | ||
```gherkin | ||
Given 장바구니에서 주문할 상품을 선택한다. | ||
When 상품을 주문한다. | ||
Then 주문이 완료되면 성공 메시지를 보여준다. | ||
``` | ||
- [x] 상품 주문시 포인트를 적용할 수 있다. | ||
```gherkin | ||
Given 장바구니에서 선택된 상품이 존재한다. | ||
And 포인트가 존재한다. | ||
When 상품을 주문한다. | ||
Then 포인트가 적용된 가격으로 주문한다. | ||
``` | ||
- [x] 사용자 별로 주문 목록을 확인할 수 있다. | ||
```gherkin | ||
Given 사용자가 주문한 상품이 존재한다. | ||
When 주문 목록을 확인한다. | ||
Then 주문 목록을 보여준다. | ||
``` | ||
- [x] 특정 주문의 상세 정보를 확인할 수 있다. | ||
```gherkin | ||
Given 주문한 목록이 존재한다. | ||
When 특정 주문을 조회한다. | ||
Then 특정 주문의 상세 정보를 보여준다. | ||
``` | ||
- [x] 서버 통신을 Retrofit으로 리팩터링한다. |
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
8 changes: 4 additions & 4 deletions
8
app/src/main/java/woowacourse/shopping/data/dao/recentproduct/RecentProductDao.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,10 +1,10 @@ | ||
package woowacourse.shopping.data.dao.recentproduct | ||
|
||
import woowacourse.shopping.data.model.DataRecentProduct | ||
import woowacourse.shopping.data.entity.RecentProductEntity | ||
|
||
interface RecentProductDao { | ||
fun getSize(): Int | ||
fun getRecentProductsPartially(size: Int): List<DataRecentProduct> | ||
fun addRecentProduct(item: DataRecentProduct) | ||
fun removeLast() | ||
fun getRecentProducts(size: Int): List<RecentProductEntity> | ||
fun saveRecentProduct(item: RecentProductEntity) | ||
fun deleteLast() | ||
} |
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
26 changes: 26 additions & 0 deletions
26
app/src/main/java/woowacourse/shopping/data/dto/CartDto.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,26 @@ | ||
package woowacourse.shopping.data.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class CartGetResponse( | ||
@SerialName("id") | ||
val id: Int, | ||
@SerialName("quantity") | ||
val quantity: Int, | ||
@SerialName("product") | ||
val product: ProductItemResponse, | ||
) | ||
|
||
@Serializable | ||
data class CartAddRequest( | ||
@SerialName("productId") | ||
val productId: Int, | ||
) | ||
|
||
@Serializable | ||
data class CartPatchRequest( | ||
@SerialName("quantity") | ||
val quantity: Int, | ||
) |
48 changes: 48 additions & 0 deletions
48
app/src/main/java/woowacourse/shopping/data/dto/OrderDto.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,48 @@ | ||
package woowacourse.shopping.data.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class OrdersResponse( | ||
@SerialName("pageInfo") | ||
val pageInfo: PageInfoResponse, | ||
@SerialName("orders") | ||
val orders: List<OrderResponse> = listOf(), | ||
) | ||
|
||
@Serializable | ||
data class OrderResponse( | ||
@SerialName("orderId") | ||
val orderId: Int, | ||
@SerialName("orderedProducts") | ||
val orderedProducts: List<OrderProductResponse> = listOf(), | ||
@SerialName("payment") | ||
val payment: PaymentResponse, | ||
) | ||
|
||
@Serializable | ||
data class OrderProductResponse( | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("price") | ||
val price: Int, | ||
@SerialName("quantity") | ||
val quantity: Int, | ||
@SerialName("imageUrl") | ||
val imageUrl: String, | ||
) | ||
|
||
@Serializable | ||
data class OrderPostRequest( | ||
@SerialName("orderItems") | ||
val orderItems: List<OrderItem>, | ||
@SerialName("payment") | ||
val payment: PaymentRequest, | ||
) | ||
|
||
@Serializable | ||
data class OrderItem( | ||
@SerialName("cartItemId") | ||
val cartItemId: Int, | ||
) |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/woowacourse/shopping/data/dto/PageInfoResponse.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,16 @@ | ||
package woowacourse.shopping.data.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PageInfoResponse( | ||
@SerialName("page") | ||
val page: Int, | ||
@SerialName("size") | ||
val size: Int, | ||
@SerialName("totalElements") | ||
val totalElements: Int, | ||
@SerialName("totalPages") | ||
val totalPages: Int, | ||
) |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/woowacourse/shopping/data/dto/PaymentDto.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,24 @@ | ||
package woowacourse.shopping.data.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PaymentResponse( | ||
@SerialName("originalPayment") | ||
val originalPayment: Int = 0, | ||
@SerialName("finalPayment") | ||
val finalPayment: Int = 0, | ||
@SerialName("point") | ||
val point: Int = 0, | ||
) | ||
|
||
@Serializable | ||
data class PaymentRequest( | ||
@SerialName("originalPayment") | ||
val originalPayment: Int, | ||
@SerialName("finalPayment") | ||
val finalPayment: Int, | ||
@SerialName("point") | ||
val usedPoint: Int, | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/woowacourse/shopping/data/dto/PointDto.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,10 @@ | ||
package woowacourse.shopping.data.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PointResponse( | ||
@SerialName("availablePoint") | ||
val availablePoint: Int = 0, | ||
) |
54 changes: 54 additions & 0 deletions
54
app/src/main/java/woowacourse/shopping/data/dto/ProductDto.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,54 @@ | ||
package woowacourse.shopping.data.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ProductsResponse( | ||
@SerialName("pageInfo") | ||
val pageInfo: PageInfoResponse, | ||
@SerialName("products") | ||
val products: List<ProductItemResponse> = listOf(), | ||
) | ||
|
||
@Serializable | ||
data class ProductItemResponse( | ||
@SerialName("id") | ||
val id: Int, | ||
@SerialName("imageUrl") | ||
val imageUrl: String, | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("price") | ||
val price: Int, | ||
) | ||
|
||
@Serializable | ||
data class ProductPostRequest( | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("price") | ||
val price: Int, | ||
@SerialName("imageUrl") | ||
val imageUrl: String, | ||
) | ||
|
||
@Serializable | ||
data class ProductPutRequest( | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("price") | ||
val price: Int, | ||
@SerialName("imageUrl") | ||
val imageUrl: String, | ||
) | ||
|
||
@Serializable | ||
data class ProductDeleteRequest( | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("price") | ||
val price: Int, | ||
@SerialName("imageUrl") | ||
val imageUrl: String, | ||
) |
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.
SerialName 어노테이션을 붙이는 이유는 무엇일까요?
만약 SerialName 어노테이션을 붙이지 않았을 경우에는 어떤 일이 발생할까요?
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.
Gson의 @SerializedName 어노테이션과 동일하게,
@SerialName 어노테이션을 붙이지 않아도 property명과 response body 각각의 json key 이름이 동일하면 문제가 없는 것으로 알고 있습니다 : )
어노테이션을 사용한 이유는,
미션을 진행하면서 서버에서 제공하는 json의 key값과 클라이언트에서 사용하고자 하는 이름이 다른 경우가 있었습니다.
이 외에도, 클라이언트에서는 그대로 프로퍼티명을 유지하고 싶은데,
서버에서 제공해주는 key 이름만 변경되는 상황에는 @SerialName("...")만 변경하여 코드의 수정을 최소화하고자 하였습니다.
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.
잘 알고 계시네요. 👍
추가로 "난독화" 관련해서도 알아보시면 도움이 될 거에요.