Skip to content

Commit

Permalink
Report Player UI additions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafizzle committed Jul 29, 2023
1 parent c2b0408 commit 7e4519b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Habitica/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,13 @@
<string name="report_message_explanation">**Only** report a post that violates the [Community Guidelines](https://habitica.com/static/community-guidelines) and/or [Terms of Service](https://habitica.com/static/terms). Inappropriately reporting a post may give you an infraction.</string>
<string name="report_user_explanation">**Only** report for a user that violates the [Community Guidelines](https://habitica.com/static/community-guidelines) and/or [Terms of Service](https://habitica.com/static/terms). Inappropriately reporting a user may give you an infraction.</string>
<string name="report_message_title">Report %s for violation:</string>
<string name="report_player_toolbar_title">Report %s</string>
<string name="report_player_title">Report %s?</string>
<string name="report_player_hint">Reason for report (required)</string>
<string name="report_user_description">This will also block %s - A blocked user cannot send you Private Messages but you will still see their posts.</string>
<string name="report_message_hint">Reason for report (optional)</string>
<string name="report_successful">%s Reported</string>
<string name="report_failure">Report failed, please try again later</string>
<string name="mystery_sets">Mystery Sets</string>
<string name="guild_description">Guild Description</string>
<string name="invite_to_guild">Invite to Guild</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ class ReportBottomSheetFragment : BottomSheetDialogFragment() {
binding.closeButton.setOnClickListener { dismiss() }

if (reportType == REPORT_TYPE_USER) {
binding.toolbarTitle.text = getString(R.string.report_player_toolbar_title, profileName)
binding.additionalExplanationTextview.visibility = View.VISIBLE
binding.infoTextInputLayout.hint = getString(R.string.report_player_hint)
binding.additionalExplanationTextview.setMarkdown(getString(R.string.report_user_description))
binding.additionalExplanationTextview.setMarkdown(getString(R.string.report_user_description, profileName))
binding.reportExplanationTextview.setMarkdown(getString(R.string.report_user_explanation))
binding.titleTextView.text = getString(R.string.report_player_title, profileName)
binding.messageTextView.visibility = View.GONE
Expand Down Expand Up @@ -115,11 +116,14 @@ class ReportBottomSheetFragment : BottomSheetDialogFragment() {
lifecycleScope.launch(
ExceptionHandler.coroutine {
isReporting = false
(this.activity as? MainActivity)?.showSnackbar(title = getString(R.string.report_failure))
}
) {
val reportReasonInfo = binding.additionalInfoEdittext.text.toString()
val data = mapOf(Pair("comment", reportReasonInfo))
socialRepository.reportMember(userIdBeingReported, data)
socialRepository.blockMember(userIdBeingReported)
(activity as? MainActivity)?.showSnackbar(title = getString(R.string.report_successful, profileName))
dismiss()
}
}
Expand Down

0 comments on commit 7e4519b

Please sign in to comment.