Commit c16a1d36 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Add icon and localization strings to the report feature

parent 57507918
......@@ -380,6 +380,7 @@ class ChatRoomPresenter @Inject constructor(
retryIO("reportMessage($messageId, $description)") {
client.reportMessage(messageId = messageId, description = description)
}
view.showMessage(R.string.report_sent)
} catch (ex: RocketChatException) {
Timber.e(ex)
}
......
......@@ -86,8 +86,6 @@ import dagger.android.support.AndroidSupportInjection
import io.reactivex.Observable
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.dialog_report.view.*
import kotlinx.android.synthetic.main.emoji_image_row_item.*
import kotlinx.android.synthetic.main.emoji_image_row_item.view.*
import kotlinx.android.synthetic.main.emoji_row_item.view.*
import kotlinx.android.synthetic.main.fragment_chat_room.*
......@@ -95,7 +93,6 @@ import kotlinx.android.synthetic.main.message_attachment_options.*
import kotlinx.android.synthetic.main.message_composer.*
import kotlinx.android.synthetic.main.message_list.*
import kotlinx.android.synthetic.main.reaction_praises_list_item.view.*
import kotlinx.android.synthetic.main.reaction_praises_list_item.*
import timber.log.Timber
import java.io.File
import java.io.IOException
......@@ -1174,34 +1171,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
override fun reportMessage(id: String) {
val root = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_report, null)
val disposable = CompositeDisposable()
val dialog = androidx.appcompat.app.AlertDialog.Builder(requireContext())
.setTitle(R.string.action_msg_report)
.setCancelable(true)
.setView(root)
.setOnDismissListener {
disposable.clear()
}
.show()
with(root) {
disposable.add(
edit_text_description.asObservable()
.skip(1)
.subscribe { if (it.isNotEmpty()) text_view_error.fadeOut() }
)
button_send_report.setOnClickListener {
val description = edit_text_description.text.toString()
if (description.isBlank()) {
text_view_error.fadeIn()
} else {
dialog.dismiss()
presenter.reportMessage(messageId = id, description = description)
}
}
}
presenter.reportMessage(messageId = id,
description = "This message was reported by a user from the Android app")
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="@color/actionMenuColor"
android:pathData="M10.11,16.546h-0.183c-4.329,0 -7.47,-2.753 -7.47,-6.546 0,-3.61 2.942,-6.547 6.56,-6.547 3.616,0 6.56,2.937 6.56,6.547 0,0.59 -0.276,1.18 -0.567,1.803 -0.1,0.218 -0.2,0.433 -0.278,0.618 -0.756,1.626 0.731,2.41 1.364,2.743 0.098,0.051 0.224,0.117 0.326,0.178 -0.416,0.478 -1.814,1.22 -6.312,1.204m6.666,-2.667c-0.895,-0.473 -0.852,-0.567 -0.71,-0.875 0.081,-0.193 0.172,-0.389 0.264,-0.587 0.33,-0.705 0.703,-1.505 0.703,-2.417 0,-4.412 -3.597,-8 -8.017,-8S1,5.588 1,10c0,4.635 3.755,8 8.927,8h0.382c2.857,0 6.632,-0.256 7.565,-2.237 0.493,-1.046 -0.58,-1.612 -1.098,-1.884" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_message_info"
......@@ -52,6 +51,7 @@
<item
android:id="@+id/action_message_report"
android:icon="@drawable/ic_action_message_report_24dp"
android:title="@string/action_msg_report" />
<item
......
......@@ -338,6 +338,7 @@
<string name="timezone">Timezone</string> <!--TODO - Add proper translation-->
<!-- Report -->
<string name="submit">Submit</string>
<string name="required">*required</string>
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
</resources>
......@@ -340,4 +340,5 @@
<!-- Report -->
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
</resources>
......@@ -347,4 +347,6 @@
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -347,4 +347,6 @@
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -342,4 +342,6 @@
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -349,4 +349,6 @@
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -342,8 +342,7 @@
<string name="timezone">Fuso horário</string>
<!-- Report -->
<!--TODO - Add proper translation-->
<string name="submit">Enviar</string>
<!--TODO - Add proper translation-->
<string name="required">*obrigatório</string>
<string name="report_sent">A mensagem foi reportada!</string>
</resources>
......@@ -344,4 +344,6 @@
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -343,4 +343,5 @@
<!-- Report -->
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
</resources>
......@@ -346,4 +346,6 @@
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -357,4 +357,5 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<!-- Report -->
<string name="submit">Submit</string>
<string name="required">*required</string>
<string name="report_sent">Your report has been sent!</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment