summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-06-20 19:19:31 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-06-24 11:35:22 +0000
commitc1e303baa001c9d531a1918312fb2225e1648882 (patch)
tree98ccb1c0a88af937b0ff4b8574d3bdb6963e310a /android/src
parentac58f81f0e9a14d5eacbe9a206be0d607eb3cb92 (diff)
downloadmullvadvpn-c1e303baa001c9d531a1918312fb2225e1648882.tar.xz
mullvadvpn-c1e303baa001c9d531a1918312fb2225e1648882.zip
Show error screen if sending report fails
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt23
-rw-r--r--android/src/main/res/layout/problem_report.xml7
-rw-r--r--android/src/main/res/values/strings.xml5
3 files changed, 33 insertions, 2 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt
index d897d23d8d..a8b47307d2 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ProblemReportFragment.kt
@@ -1,5 +1,6 @@
package net.mullvad.mullvadvpn
+import kotlinx.coroutines.async
import kotlinx.coroutines.launch
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -30,6 +31,8 @@ class ProblemReportFragment : Fragment() {
private lateinit var sendingSpinner: View
private lateinit var sentSuccessfullyIcon: View
+ private lateinit var failedToSendIcon: View
+
private lateinit var sendStatusLabel: TextView
private lateinit var sendDetailsLabel: TextView
private lateinit var responseMessageLabel: TextView
@@ -64,6 +67,8 @@ class ProblemReportFragment : Fragment() {
sendingSpinner = view.findViewById<View>(R.id.sending_spinner)
sentSuccessfullyIcon = view.findViewById<View>(R.id.sent_successfully_icon)
+ failedToSendIcon = view.findViewById<View>(R.id.failed_to_send_icon)
+
sendStatusLabel = view.findViewById<TextView>(R.id.send_status)
sendDetailsLabel = view.findViewById<TextView>(R.id.send_details)
responseMessageLabel = view.findViewById<TextView>(R.id.response_message)
@@ -93,8 +98,11 @@ class ProblemReportFragment : Fragment() {
bodyContainer.showNext()
- problemReport.send().await()
- showSuccessScreen(userEmail)
+ if (problemReport.send().await()) {
+ showSuccessScreen(userEmail)
+ } else {
+ showErrorScreen()
+ }
}
private fun showSuccessScreen(userEmail: String) {
@@ -113,6 +121,17 @@ class ProblemReportFragment : Fragment() {
sendStatusLabel.setText(R.string.sent)
}
+ private fun showErrorScreen() {
+ sendingSpinner.visibility = View.GONE
+
+ failedToSendIcon.visibility = View.VISIBLE
+ sendStatusLabel.visibility = View.VISIBLE
+ sendDetailsLabel.visibility = View.VISIBLE
+
+ sendStatusLabel.setText(R.string.failed_to_send)
+ sendDetailsLabel.setText(R.string.failed_to_send_details)
+ }
+
private fun setSendButtonEnabled(enabled: Boolean) {
sendButton.setEnabled(enabled)
sendButton.alpha = if (enabled) 1.0F else 0.5F
diff --git a/android/src/main/res/layout/problem_report.xml b/android/src/main/res/layout/problem_report.xml
index 03827ebd15..49ba73ced9 100644
--- a/android/src/main/res/layout/problem_report.xml
+++ b/android/src/main/res/layout/problem_report.xml
@@ -119,6 +119,13 @@
android:src="@drawable/icon_success"
android:visibility="gone"
/>
+ <ImageView android:id="@+id/failed_to_send_icon"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:src="@drawable/icon_fail"
+ android:visibility="gone"
+ />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml
index 8bb198b45b..701c8205c5 100644
--- a/android/src/main/res/values/strings.xml
+++ b/android/src/main/res/values/strings.xml
@@ -35,8 +35,13 @@
<string name="send">Send</string>
<string name="sending">Sending...</string>
<string name="sent">Sent</string>
+ <string name="failed_to_send">Failed to send</string>
<string name="sent_thanks">Thanks! We will look into this.</string>
<string name="sent_contact">If needed we will contact you on</string>
+ <string name="failed_to_send_details">
+ You may need to go back to the app\'s main screen and click Disconnect before trying again.
+ Don\'t worry, the information you entered will remain in the form.
+ </string>
<string name="unsecured_connection">Unsecured connection</string>
<string name="creating_secure_connection">Creating secure connection</string>