mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-24 06:35:46 +00:00
fix minor issues
This commit is contained in:
parent
0e6740ee23
commit
b840518038
12 changed files with 52 additions and 15 deletions
|
|
@ -1352,6 +1352,7 @@
|
|||
<string name="for_for_free_description">To keep the party going, we’ll be giving away Party Robes, 20 Gems, and a limited edition Cape set and Background!</string>
|
||||
<string name="birthday_limitations">This is a limited time event that starts on %1$s and will end %2$s. The Limited Edition Jubilant Gryphatrice and ten Magic Hatching Potions will be available to buy during this time. The other Gifts listed in the Four for Free section will be automatically delivered to all accounts that were active in the 30 days prior to day the gift is sent. Accounts created after the gifts are sent will not be able to claim them.</string>
|
||||
<string name="visit_the_market">Visit the Market</string>
|
||||
<string name="visit_market">Visit Market</string>
|
||||
<string name="exclusive_items_await">Exclusive items and gifts await</string>
|
||||
<string name="ends_in_x">Ends in %s</string>
|
||||
<string name="see_more">See More</string>
|
||||
|
|
@ -1469,6 +1470,8 @@
|
|||
<string name="subscribe_gems_for_gold_incentive_text">Subscribe to buy Gems with Gold and receive these other exclusive benefits!</string>
|
||||
<string name="subscribe_hourglass_incentive_text">Subscribers get Mystic Hourglasses to buy items in the Time Travelers Shop and these other exclusive benefits!</string>
|
||||
<string name="subscriber_benefit">SUBSCRIBER BENEFIT</string>
|
||||
<string name="no_saddles">You don\'t have any Saddles</string>
|
||||
<string name="purchase_saddles_in_market">Saddles instantly raise a Pet to a Mount. You can purchase one from the Market.</string>
|
||||
|
||||
|
||||
<plurals name="you_x_others">
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ interface ApiService {
|
|||
@GET("user/")
|
||||
suspend fun getUser(): HabitResponse<User>
|
||||
|
||||
@GET("user/stat-sync")
|
||||
suspend fun syncUserStats(): HabitResponse<User>
|
||||
|
||||
@GET("inbox/messages")
|
||||
suspend fun getInboxMessages(@Query("conversation") uuid: String, @Query("page") page: Int): HabitResponse<List<ChatMessage>>
|
||||
|
||||
|
|
|
|||
|
|
@ -283,4 +283,5 @@ interface ApiClient {
|
|||
suspend fun markTaskNeedsWork(taskID: String, userID: String): Task?
|
||||
suspend fun retrievePartySeekingUsers(page: Int): List<Member>?
|
||||
suspend fun getGroupInvites(groupId: String, includeAllPublicFields: Boolean?): List<Member>?
|
||||
suspend fun syncUserStats(): User?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,4 +85,5 @@ interface UserRepository : BaseRepository {
|
|||
fun getTeamPlans(): Flow<List<TeamPlan>>
|
||||
suspend fun retrieveTeamPlan(teamID: String): Group?
|
||||
fun getTeamPlan(teamID: String): Flow<Group?>
|
||||
suspend fun syncUserStats(): User?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,6 +390,8 @@ class ApiClientImpl(
|
|||
|
||||
override suspend fun getStatus(): Status? = process { apiService.getStatus() }
|
||||
|
||||
override suspend fun syncUserStats(): User? = process { apiService.syncUserStats() }
|
||||
|
||||
override suspend fun getContent(language: String?): ContentResult? {
|
||||
return process { apiService.getContent(language ?: this.languageCode) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,14 @@ class UserRepositoryImpl(
|
|||
override fun getUser(): Flow<User?> = authenticationHandler.userIDFlow.flatMapLatest { getUser(it) }
|
||||
override fun getUser(userID: String): Flow<User?> = localRepository.getUser(userID)
|
||||
|
||||
override suspend fun syncUserStats(): User? {
|
||||
val user = apiClient.syncUserStats()
|
||||
if (user != null) {
|
||||
localRepository.saveUser(user)
|
||||
}
|
||||
return user
|
||||
}
|
||||
|
||||
private suspend fun updateUser(userID: String, updateData: Map<String, Any?>): User? {
|
||||
val networkUser = apiClient.updateUser(updateData) ?: return null
|
||||
val oldUser = localRepository.getUser(userID).firstOrNull()
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class FullProfileActivity : BaseActivity() {
|
|||
|
||||
binding.avatarWithBars.setContent {
|
||||
HabiticaTheme {
|
||||
AppHeaderView(member.value, isMyProfile = isMyProfile(), onMemberRowClicked = {}, onClassSelectionClicked = {})
|
||||
AppHeaderView(member.value, isMyProfile = false, onMemberRowClicked = {}, onClassSelectionClicked = {})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ open class MainActivity : BaseActivity(), SnackbarActivity {
|
|||
inventoryRepository.getQuestContent(user.party?.quest?.completed ?: "")
|
||||
.firstOrNull()
|
||||
if (questContent != null) {
|
||||
QuestCompletedDialog.showWithQuest(this@MainActivity, questContent)
|
||||
QuestCompletedDialog.showWithQuest(this@MainActivity, questContent, userRepository)
|
||||
}
|
||||
viewModel.updateUser("party.quest.completed", "")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ fun AppHeaderView(
|
|||
disabled = true,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
} else if (user?.hasClass == false && isMyProfile && isPlayerOptedOutOfClass == false) {
|
||||
} else if (user?.hasClass == false && isMyProfile && !isPlayerOptedOutOfClass) {
|
||||
HabiticaButton(
|
||||
background = HabiticaTheme.colors.basicButtonColor(),
|
||||
color = MaterialTheme.colors.onPrimary,
|
||||
|
|
|
|||
|
|
@ -2,10 +2,15 @@ package com.habitrpg.android.habitica.ui.views.dialogs
|
|||
|
||||
import android.content.Context
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.data.UserRepository
|
||||
import com.habitrpg.android.habitica.models.inventory.QuestContent
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class QuestCompletedDialog(context: Context) : HabiticaAlertDialog(context) {
|
||||
|
||||
lateinit var userRepository: UserRepository
|
||||
|
||||
var quest: QuestContent? = null
|
||||
set(value) {
|
||||
field = value
|
||||
|
|
@ -17,21 +22,26 @@ class QuestCompletedDialog(context: Context) : HabiticaAlertDialog(context) {
|
|||
}
|
||||
|
||||
override fun dismiss() {
|
||||
dialog = null
|
||||
MainScope().launch {
|
||||
userRepository.syncUserStats()
|
||||
}
|
||||
isShowingDialog = false
|
||||
super.dismiss()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var dialog: QuestCompletedDialog? = null
|
||||
private var isShowingDialog = false
|
||||
|
||||
fun showWithQuest(context: Context, quest: QuestContent) {
|
||||
if (dialog != null) return
|
||||
fun showWithQuest(context: Context, quest: QuestContent, userRepository: UserRepository) {
|
||||
if (isShowingDialog) return
|
||||
|
||||
dialog = QuestCompletedDialog(context)
|
||||
dialog?.quest = quest
|
||||
dialog?.setTitle(R.string.quest_completed)
|
||||
dialog?.addButton(R.string.onwards, isPrimary = true, isDestructive = false)
|
||||
dialog?.enqueue()
|
||||
val dialog = QuestCompletedDialog(context)
|
||||
dialog.userRepository = userRepository
|
||||
dialog.quest = quest
|
||||
dialog.setTitle(R.string.quest_completed)
|
||||
dialog.addButton(R.string.onwards, isPrimary = true, isDestructive = false)
|
||||
dialog.enqueue()
|
||||
isShowingDialog = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.zIndex
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.extensions.addCloseButton
|
||||
import com.habitrpg.android.habitica.interactors.ShareMountUseCase
|
||||
import com.habitrpg.android.habitica.interactors.SharePetUseCase
|
||||
import com.habitrpg.android.habitica.models.inventory.Food
|
||||
|
|
@ -74,6 +75,7 @@ import com.habitrpg.common.habitica.theme.HabiticaTheme
|
|||
import com.habitrpg.android.habitica.ui.views.BackgroundScene
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaButton
|
||||
import com.habitrpg.android.habitica.ui.views.PixelArtView
|
||||
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
|
||||
import com.habitrpg.common.habitica.extensions.getThemeColor
|
||||
import com.habitrpg.common.habitica.helpers.MainNavigationController
|
||||
import com.habitrpg.common.habitica.helpers.launchCatching
|
||||
|
|
@ -256,6 +258,7 @@ fun PetBottomSheet(
|
|||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||
modifier = Modifier.padding(bottom = 16.dp)
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
HabiticaButton(
|
||||
Color(LocalContext.current.getThemeColor(R.attr.colorTintedBackgroundOffset)),
|
||||
HabiticaTheme.colors.textPrimary,
|
||||
|
|
@ -267,7 +270,13 @@ fun PetBottomSheet(
|
|||
onFeed?.invoke(pet, saddle)
|
||||
}
|
||||
} else {
|
||||
MainNavigationController.navigate(R.id.marketFragment)
|
||||
val dialog = HabiticaAlertDialog(context)
|
||||
dialog.setTitle(R.string.no_saddles)
|
||||
dialog.setMessage(R.string.purchase_saddles_in_market)
|
||||
dialog.addButton(R.string.visit_market, isPrimary = true) { _, _ ->
|
||||
MainNavigationController.navigate(R.id.marketFragment)
|
||||
}
|
||||
dialog.addCloseButton()
|
||||
}
|
||||
onDismiss()
|
||||
}, modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
NAME=4.3.1
|
||||
CODE=6761
|
||||
NAME=4.3.2
|
||||
CODE=6781
|
||||
Loading…
Reference in a new issue