-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ux/ui): sửa các lỗi nghiêm trọng liên quan đến hiệu suất, logic v…
…à giao diện todo: fix study schedule
- Loading branch information
Showing
19 changed files
with
234 additions
and
124 deletions.
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
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
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/pwhs/quickmem/data/mapper/notification/DeviceTokenRequestMapper.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.pwhs.quickmem.data.mapper.notification | ||
|
||
import com.pwhs.quickmem.data.dto.notification.DeviceTokenRequestDto | ||
import com.pwhs.quickmem.domain.model.notification.DeviceTokenRequestModel | ||
|
||
fun DeviceTokenRequestModel.toDto() = DeviceTokenRequestDto( | ||
userId = userId, | ||
deviceToken = deviceToken | ||
) |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/pwhs/quickmem/data/remote/repository/FirebaseRepositoryImpl.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,31 @@ | ||
package com.pwhs.quickmem.data.remote.repository | ||
|
||
import com.pwhs.quickmem.core.utils.Resources | ||
import com.pwhs.quickmem.data.mapper.notification.toDto | ||
import com.pwhs.quickmem.data.remote.ApiService | ||
import com.pwhs.quickmem.domain.model.notification.DeviceTokenRequestModel | ||
import com.pwhs.quickmem.domain.repository.FirebaseRepository | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
import timber.log.Timber | ||
import javax.inject.Inject | ||
|
||
class FirebaseRepositoryImpl @Inject constructor( | ||
private val apiService: ApiService | ||
) : FirebaseRepository { | ||
override suspend fun sendDeviceToken( | ||
accessToken: String, | ||
deviceTokenRequest: DeviceTokenRequestModel | ||
): Flow<Resources<Unit>> { | ||
return flow { | ||
emit(Resources.Loading()) | ||
try { | ||
apiService.sendDeviceToken(accessToken, deviceTokenRequest.toDto()) | ||
emit(Resources.Success(Unit)) | ||
} catch (e: Exception) { | ||
Timber.e(e) | ||
emit(Resources.Error(e.toString())) | ||
} | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/pwhs/quickmem/domain/model/notification/DeviceTokenRequestModel.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 com.pwhs.quickmem.domain.model.notification | ||
|
||
data class DeviceTokenRequestModel( | ||
val userId: String, | ||
val deviceToken: String | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/pwhs/quickmem/domain/repository/FirebaseRepository.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 com.pwhs.quickmem.domain.repository | ||
|
||
import com.pwhs.quickmem.core.utils.Resources | ||
import com.pwhs.quickmem.domain.model.notification.DeviceTokenRequestModel | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
|
||
interface FirebaseRepository { | ||
suspend fun sendDeviceToken(accessToken: String, deviceTokenRequest: DeviceTokenRequestModel): Flow<Resources<Unit>> | ||
} |
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
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
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.