-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
409 additions
and
62 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="16dp" | ||
android:height="22dp" | ||
android:viewportWidth="16" | ||
android:viewportHeight="22"> | ||
<path | ||
android:pathData="M1.1,15.05C0.733,14.417 0.458,13.767 0.275,13.1C0.092,12.433 0,11.75 0,11.05C0,8.817 0.775,6.917 2.325,5.35C3.875,3.783 5.767,3 8,3H8.175L6.575,1.4L7.975,0L11.975,4L7.975,8L6.575,6.6L8.175,5H8C6.333,5 4.917,5.588 3.75,6.762C2.583,7.938 2,9.367 2,11.05C2,11.483 2.05,11.908 2.15,12.325C2.25,12.742 2.4,13.15 2.6,13.55L1.1,15.05ZM8.025,22L4.025,18L8.025,14L9.425,15.4L7.825,17H8C9.667,17 11.083,16.413 12.25,15.238C13.417,14.063 14,12.633 14,10.95C14,10.517 13.95,10.092 13.85,9.675C13.75,9.258 13.6,8.85 13.4,8.45L14.9,6.95C15.267,7.583 15.542,8.233 15.725,8.9C15.908,9.567 16,10.25 16,10.95C16,13.183 15.225,15.083 13.675,16.65C12.125,18.217 10.233,19 8,19H7.825L9.425,20.6L8.025,22Z" | ||
android:fillColor="#1C1B1F"/> | ||
</vector> |
This file was deleted.
Oops, something went wrong.
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
13 changes: 12 additions & 1 deletion
13
data/src/main/java/com/synrgy7team4/data/feature_dashboard/FileUtils.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,13 +1,24 @@ | ||
package com.synrgy7team4.data.feature_dashboard | ||
|
||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.response.BalanceGetResponse | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.response.NotificationGetResponseItem | ||
import com.synrgy7team4.domain.feature_dashboard.model.response.BalanceGetResponseDomain | ||
import com.synrgy7team4.domain.feature_dashboard.model.response.NotificationGetResponseItemDomain | ||
|
||
object FileUtils { | ||
fun BalanceGetResponse.toBalanceGetResponseDomain(): BalanceGetResponseDomain = | ||
fun BalanceGetResponse.toDomain(): BalanceGetResponseDomain = | ||
BalanceGetResponseDomain( | ||
success = success, | ||
message = message, | ||
data = data | ||
) | ||
|
||
fun NotificationGetResponseItem.toDomain(): NotificationGetResponseItemDomain = | ||
NotificationGetResponseItemDomain( | ||
id = id, | ||
title = title, | ||
body = body, | ||
sentAt = sentAt, | ||
read = read | ||
) | ||
} |
4 changes: 3 additions & 1 deletion
4
...asource/remote/BalanceRemoteDatasource.kt → ...ource/remote/DashboardRemoteDatasource.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,7 +1,9 @@ | ||
package com.synrgy7team4.data.feature_dashboard.datasource.remote | ||
|
||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.response.BalanceGetResponse | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.response.NotificationGetResponseItem | ||
|
||
interface BalanceRemoteDatasource { | ||
interface DashboardRemoteDatasource { | ||
suspend fun getBalance(jwtToken: String, accountNumber: String): BalanceGetResponse | ||
suspend fun getNotification(jwtToken: String): List<NotificationGetResponseItem> | ||
} |
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
20 changes: 20 additions & 0 deletions
20
...synrgy7team4/data/feature_dashboard/datasource/remote/response/NotificationGetResponse.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,20 @@ | ||
package com.synrgy7team4.data.feature_dashboard.datasource.remote.response | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class NotificationGetResponseItem( | ||
@field:SerializedName("id") | ||
val id: String? = null, | ||
|
||
@field:SerializedName("title") | ||
val title: String? = null, | ||
|
||
@field:SerializedName("body") | ||
val body: String? = null, | ||
|
||
@field:SerializedName("sentAt") | ||
val sentAt: String? = null, | ||
|
||
@field:SerializedName("read") | ||
val read: Boolean | ||
) |
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
13 changes: 0 additions & 13 deletions
13
...ain/java/com/synrgy7team4/data/feature_dashboard/repository/ImplementBalanceRepository.kt
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
...n/java/com/synrgy7team4/data/feature_dashboard/repository/ImplementDashboardRepository.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,17 @@ | ||
package com.synrgy7team4.data.feature_dashboard.repository | ||
|
||
import com.synrgy7team4.data.feature_dashboard.FileUtils.toDomain | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.DashboardRemoteDatasource | ||
import com.synrgy7team4.domain.feature_dashboard.model.response.BalanceGetResponseDomain | ||
import com.synrgy7team4.domain.feature_dashboard.model.response.NotificationGetResponseItemDomain | ||
import com.synrgy7team4.domain.feature_dashboard.repository.DashboardRepository | ||
|
||
class ImplementDashboardRepository( | ||
private val dashboardRemoteSource: DashboardRemoteDatasource | ||
) : DashboardRepository { | ||
override suspend fun getBalance(jwtToken: String, accountNumber: String): BalanceGetResponseDomain = | ||
dashboardRemoteSource.getBalance(jwtToken, accountNumber).toDomain() | ||
|
||
override suspend fun getNotification(jwtToken: String): List<NotificationGetResponseItemDomain> = | ||
dashboardRemoteSource.getNotification(jwtToken).map { it.toDomain() } | ||
} |
16 changes: 8 additions & 8 deletions
16
di/src/main/java/com/synrgy7team4/di/feature_dashboard/dashboardKoin.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,19 +1,19 @@ | ||
package com.synrgy7team4.di.feature_dashboard | ||
|
||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.BalanceRemoteDatasource | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.ImplementBalanceRemoteDatasource | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.DashboardRemoteDatasource | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.ImplementDashboardRemoteDatasource | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.retrofit.ApiConfig | ||
import com.synrgy7team4.data.feature_dashboard.datasource.remote.retrofit.ApiService | ||
import com.synrgy7team4.data.feature_dashboard.repository.ImplementBalanceRepository | ||
import com.synrgy7team4.domain.feature_dashboard.repository.BalanceRepository | ||
import com.synrgy7team4.domain.feature_dashboard.usecase.BalanceUseCase | ||
import com.synrgy7team4.data.feature_dashboard.repository.ImplementDashboardRepository | ||
import com.synrgy7team4.domain.feature_dashboard.repository.DashboardRepository | ||
import com.synrgy7team4.domain.feature_dashboard.usecase.DashboardUseCase | ||
import org.koin.dsl.module | ||
|
||
val dashboardKoin = module { | ||
single<BalanceUseCase> { BalanceUseCase(get())} | ||
single<DashboardUseCase> { DashboardUseCase(get())} | ||
|
||
single<BalanceRepository> { ImplementBalanceRepository(get()) } | ||
single<BalanceRemoteDatasource> { ImplementBalanceRemoteDatasource(get()) } | ||
single<DashboardRepository> { ImplementDashboardRepository(get()) } | ||
single<DashboardRemoteDatasource> { ImplementDashboardRemoteDatasource(get()) } | ||
|
||
single<ApiService> { ApiConfig.provideApiService(get()) } | ||
} |
9 changes: 9 additions & 0 deletions
9
...a/com/synrgy7team4/domain/feature_dashboard/model/response/NotificationGetResponseItem.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,9 @@ | ||
package com.synrgy7team4.domain.feature_dashboard.model.response | ||
|
||
data class NotificationGetResponseItemDomain( | ||
val id: String? = null, | ||
val title: String? = null, | ||
val body: String? = null, | ||
val sentAt: String? = null, | ||
val read: Boolean | ||
) |
4 changes: 3 additions & 1 deletion
4
...dashboard/repository/BalanceRepository.kt → ...shboard/repository/DashboardRepository.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,7 +1,9 @@ | ||
package com.synrgy7team4.domain.feature_dashboard.repository | ||
|
||
import com.synrgy7team4.domain.feature_dashboard.model.response.BalanceGetResponseDomain | ||
import com.synrgy7team4.domain.feature_dashboard.model.response.NotificationGetResponseItemDomain | ||
|
||
interface BalanceRepository { | ||
interface DashboardRepository { | ||
suspend fun getBalance(jwtToken: String, accountNumber: String): BalanceGetResponseDomain | ||
suspend fun getNotification(jwtToken: String): List<NotificationGetResponseItemDomain> | ||
} |
10 changes: 0 additions & 10 deletions
10
domain/src/main/java/com/synrgy7team4/domain/feature_dashboard/usecase/BalanceUseCase.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
domain/src/main/java/com/synrgy7team4/domain/feature_dashboard/usecase/DashboardUseCase.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,13 @@ | ||
package com.synrgy7team4.domain.feature_dashboard.usecase | ||
|
||
import com.synrgy7team4.domain.feature_dashboard.repository.DashboardRepository | ||
|
||
class DashboardUseCase( | ||
private val dashboardRepository: DashboardRepository | ||
) { | ||
suspend fun getBalance(jwtToken: String, accountNumber: String) = | ||
dashboardRepository.getBalance(jwtToken, accountNumber) | ||
|
||
suspend fun getNotification(jwtToken: String) = | ||
dashboardRepository.getNotification(jwtToken) | ||
} |
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
43 changes: 43 additions & 0 deletions
43
...main/java/com/synrgy7team4/feature_dashboard/ui/notificationScreen/NotificationAdapter.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,43 @@ | ||
package com.synrgy7team4.feature_dashboard.ui.notificationScreen | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.synrgy7team4.domain.feature_dashboard.model.response.NotificationGetResponseItemDomain | ||
import com.synrgy7team4.feature_dashboard.R | ||
import com.synrgy7team4.feature_dashboard.databinding.NotificationItemListBinding | ||
import java.text.SimpleDateFormat | ||
import java.util.Locale | ||
|
||
class NotificationAdapter( | ||
private val notificationList: List<NotificationGetResponseItemDomain> | ||
) : RecyclerView.Adapter<NotificationAdapter.ViewHolder>() { | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder = | ||
ViewHolder( | ||
LayoutInflater.from(parent.context).inflate(R.layout.notification_item_list, parent, false) | ||
) | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) = holder.bind(notificationList[position]) | ||
|
||
override fun getItemCount(): Int = notificationList.size | ||
|
||
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
private val binding = NotificationItemListBinding.bind(itemView) | ||
|
||
fun bind(item: NotificationGetResponseItemDomain) { | ||
binding.tvJudulTransaksi.text = item.title | ||
binding.tvDeskripsiTransaksi.text = item.body | ||
binding.tvWaktuTransaksi.text = convertDateFormat(item.sentAt) | ||
} | ||
} | ||
|
||
private fun convertDateFormat(dateString: String?): String { | ||
val inputFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS", Locale.US) | ||
val outputFormat = SimpleDateFormat("dd MMM yyyy, HH:mm:ss", Locale("in", "ID")) | ||
|
||
val date = inputFormat.parse(dateString) | ||
return outputFormat.format(date) | ||
} | ||
} |
Oops, something went wrong.