Skip to content

Commit

Permalink
Change feedback to be sent via mail
Browse files Browse the repository at this point in the history
  • Loading branch information
UriahShaulMandel committed Sep 8, 2021
1 parent 1cfa96c commit d855fe5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.bald.uriah.baldphone.activities;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.EditText;

Expand All @@ -24,8 +26,6 @@
import com.bald.uriah.baldphone.R;
import com.bald.uriah.baldphone.utils.BaldToast;

import org.acra.ACRA;

public class FeedbackActivity extends BaldActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -37,19 +37,26 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
if (text.length() == 0)
BaldToast.from(v.getContext()).setType(BaldToast.TYPE_ERROR).setText(R.string.feedback_cannot_be_empty).show();
else {
ACRA.getErrorReporter().handleSilentException(new FeedbackException(String.valueOf(text)));
BaldToast.from(getApplicationContext()).setText(R.string.feedback_sent_successfully).show();
finish();
Intent intent =
new Intent(Intent.ACTION_SENDTO)
.setData(Uri.parse("mailto:"))
.putExtra(Intent.EXTRA_EMAIL, new String[]{"baldphone.contact@gmail.com"})
.putExtra(Intent.EXTRA_SUBJECT, "BaldPhone feedback")
.putExtra(Intent.EXTRA_TEXT, String.valueOf(text));
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
finish();
} else {
// No mail client, weird!
BaldToast.from(this)
.setText(R.string.mail_application_not_found)
.setType(BaldToast.TYPE_ERROR)
.show();
}
}
});
}

private final static class FeedbackException extends Exception {
FeedbackException(String message) {
super(message);
}
}

@Override
protected int requiredPermissions() {
return PERMISSION_NONE;
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@
<string name="appear_on_top">Appear on top</string>
<string name="appear_on_top_subtext">This permission is required on new version of android in order to show alarms and reminders when the screen is closed</string>

<string name="mail_application_not_found">Mail application not found!</string>

<string-array name="names_for_screenshots">
<item>The Godfather</item>
Expand Down

0 comments on commit d855fe5

Please sign in to comment.