Fix adding reviews via personal accounts

This commit is contained in:
Rahul Patel
2023-10-14 03:24:27 +05:30
parent a50b62ca2c
commit 9b7029bded
3 changed files with 25 additions and 14 deletions

View File

@@ -287,7 +287,7 @@ class AppDetailsFragment : BaseFragment(R.layout.fragment_details) {
viewLifecycleOwner.lifecycleScope.launch {
viewModel.userReview.collect {
if (it.timeStamp == 0L) {
if (it.commentId.isNotEmpty()) {
binding.layoutDetailsReview.userStars.rating = it.rating.toFloat()
Toast.makeText(
requireContext(),
@@ -1029,7 +1029,7 @@ class AppDetailsFragment : BaseFragment(R.layout.fragment_details) {
toast(R.string.toast_anonymous_restriction)
} else {
addOrUpdateReview(app, Review().apply {
title = authData.userProfile!!.name
title = B.inputTitle.text.toString()
rating = B.userStars.rating.toInt()
comment = B.inputReview.text.toString()
})

View File

@@ -52,20 +52,32 @@
android:scaleY=".75"
android:stepSize="1" />
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/margin_normal"
android:orientation="vertical"
android:divider="@drawable/divider"
android:orientation="horizontal"
android:showDividers="middle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/input_title"
android:layout_width="match_parent"
android:layout_height="42dp"
android:background="@drawable/bg_search"
android:gravity="center_vertical|center_horizontal"
android:hint="@string/details_ratings_title_hint"
android:imeOptions="flagNoExtractUi|actionDone"
android:inputType="text"
android:paddingStart="@dimen/padding_large"
android:paddingEnd="@dimen/padding_normal"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Aurora.Line2" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/input_review"
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/btn_post_review"
android:background="@drawable/bg_search"
android:gravity="center_vertical|center_horizontal"
android:hint="@string/details_think_this_app"
@@ -78,15 +90,13 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_post_review"
style="@style/Widget.MaterialComponents.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
style="@style/Widget.Material3.Button.OutlinedButton"
app:cornerRadius="@dimen/margin_small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_xsmall"
android:text="@string/action_post" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout

View File

@@ -124,6 +124,7 @@
<string name="details_permission">"Permission"</string>
<string name="details_privacy">"Privacy"</string>
<string name="details_ratings">"Rating and reviews"</string>
<string name="details_ratings_title_hint">"Review title"</string>
<string name="details_think_this_app">"What do you think about this app?"</string>
<string name="download_cancel_all">"Cancel all"</string>
<string name="download_canceled">"Cancelled"</string>
@@ -310,7 +311,7 @@
<string name="toast_manual_unavailable">"The version code you are requesting is unavailable."</string>
<string name="toast_manual_available">"Congrats, requested version code is available, downloading now."</string>
<string name="toast_page_unavailable">Browse page unavailable</string>
<string name="toast_rated_success">Rated</string>
<string name="toast_rated_success">Rated, it may take a while to show</string>
<string name="toast_rated_failed">Could not submit rating</string>
<string name="toast_aas_token_failed">Could not generate AAS Token</string>
<string name="toast_export_success">Device config exported</string>