mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 11:46:32 +00:00
Fix changing cds
This commit is contained in:
parent
eb999fb32b
commit
deeed81e79
4 changed files with 11 additions and 5 deletions
|
|
@ -320,7 +320,7 @@ interface ApiService {
|
|||
suspend fun validateNoRenewSubscription(@Body request: PurchaseValidationRequest): HabitResponse<Void>
|
||||
|
||||
@POST("user/custom-day-start")
|
||||
suspend fun changeCustomDayStart(@Body updateObject: Map<String, Any>): HabitResponse<User>
|
||||
suspend fun changeCustomDayStart(@Body updateObject: Map<String, Any>): HabitResponse<Void>
|
||||
|
||||
// Members URL
|
||||
@GET("members/{mid}")
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ interface ApiClient {
|
|||
|
||||
suspend fun validatePurchase(request: PurchaseValidationRequest): PurchaseValidationResult?
|
||||
|
||||
suspend fun changeCustomDayStart(updateObject: Map<String, Any>): User?
|
||||
suspend fun changeCustomDayStart(updateObject: Map<String, Any>): Void?
|
||||
|
||||
// Members URL
|
||||
suspend fun getMember(memberId: String): Member?
|
||||
|
|
|
|||
|
|
@ -735,7 +735,7 @@ class ApiClientImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun changeCustomDayStart(updateObject: Map<String, Any>): User? {
|
||||
override suspend fun changeCustomDayStart(updateObject: Map<String, Any>): Void? {
|
||||
return process { apiService.changeCustomDayStart(updateObject) }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,8 +230,14 @@ class UserRepositoryImpl(
|
|||
override suspend fun changeCustomDayStart(dayStartTime: Int): User? {
|
||||
val updateObject = HashMap<String, Any>()
|
||||
updateObject["dayStart"] = dayStartTime
|
||||
val newUser = apiClient.changeCustomDayStart(updateObject)
|
||||
return mergeWithExistingUser(newUser)
|
||||
apiClient.changeCustomDayStart(updateObject)
|
||||
val liveUser = getLiveUser()
|
||||
if (liveUser != null) {
|
||||
localRepository.executeTransaction {
|
||||
liveUser.preferences?.dayStart = dayStartTime
|
||||
}
|
||||
}
|
||||
return liveUser
|
||||
}
|
||||
|
||||
override suspend fun updateLanguage(languageCode: String): User? {
|
||||
|
|
|
|||
Loading…
Reference in a new issue