Add crash dialog

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/242/head
androidacy-user 1 year ago
parent 37b93367bf
commit 816d94aee4

@ -204,4 +204,10 @@
<string name="transparent_theme_dialogue_title">You are setting a transparent theme</string>
<string name="transparent_theme_dialogue_message">Transparent themes may have some inconsistencies and may not work on all ROMs. In additon, monet and blur will be disabled. You can change back at any time.</string>
<string name="custom_repo_always_on">Custom repos are always on until you remove them.</string>
<string name="sentry_dialogue_message">We encountered an error, please help us improve the app by adding some information about the error.</string>
<string name="sentry_dialogue_title">Sentry report</string>
<string name="name">Name</string>
<string name="email">Email</string>
<string name="additional_info">Tell us what happened</string>
<string name="submit">Submit</string>
</resources>

@ -3,12 +3,18 @@ package com.fox2code.mmm.sentry;
import static io.sentry.TypeCheckHint.SENTRY_TYPE_CHECK_HINT;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.EditText;
import com.fox2code.mmm.BuildConfig;
import com.fox2code.mmm.MainApplication;
import com.fox2code.mmm.R;
import com.fox2code.mmm.androidacy.AndroidacyUtil;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.io.IOException;
import java.io.Writer;
@ -94,16 +100,46 @@ public class SentryMain {
SentryId sentryId = event.getEventId();
if (sentryId != null) {
UserFeedback userFeedback = new UserFeedback(sentryId);
userFeedback.setName("Anonymous");
userFeedback.setEmail("test@test.com");
userFeedback.setComments("No comments");
Sentry.captureUserFeedback(userFeedback);
// Get the current activity
Activity context = MainApplication.getINSTANCE().getLastCompatActivity();
// Create a material dialog
new Handler(Looper.getMainLooper()).post(() -> {
if (context != null) {
// Show fields for name, email, and comment, and two buttons: "Submit" and "Cancel"
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context);
builder.setTitle(R.string.sentry_dialogue_title);
builder.setMessage(R.string.sentry_dialogue_message);
// Add the text fields, set the text to the previously entered values
EditText name = new EditText(context);
name.setHint(R.string.name);
builder.setView(name);
EditText email = new EditText(context);
email.setHint(R.string.email);
builder.setView(email);
EditText comment = new EditText(context);
comment.setHint(R.string.additional_info);
builder.setView(comment);
// Add the buttons
builder.setPositiveButton(R.string.submit, (dialog, id) -> {
// User clicked "Submit"
userFeedback.setName(name.getText().toString());
userFeedback.setEmail(email.getText().toString());
userFeedback.setComments(comment.getText().toString());
// Send the feedback
Sentry.captureUserFeedback(userFeedback);
});
builder.setNegativeButton(R.string.cancel, (dialog, id) -> {
// User cancelled the dialog
});
// Create and show the AlertDialog
builder.create().show();
}
});
}
return event;
} else {
// We need to do this to avoid crash delay on crash when the event is dropped
DiskFlushNotification diskFlushNotification = hint.getAs(
SENTRY_TYPE_CHECK_HINT, DiskFlushNotification.class);
DiskFlushNotification diskFlushNotification = hint.getAs(SENTRY_TYPE_CHECK_HINT, DiskFlushNotification.class);
if (diskFlushNotification != null) diskFlushNotification.markFlushed();
return null;
}
@ -112,8 +148,7 @@ public class SentryMain {
options.setBeforeBreadcrumb((breadcrumb, hint) -> {
String url = (String) breadcrumb.getData("url");
if (url == null || url.isEmpty()) return breadcrumb;
if ("cloudflare-dns.com".equals(Uri.parse(url).getHost()))
return null;
if ("cloudflare-dns.com".equals(Uri.parse(url).getHost())) return null;
if (AndroidacyUtil.isAndroidacyLink(url)) {
breadcrumb.setData("url", AndroidacyUtil.hideToken(url));
}

@ -0,0 +1,47 @@
## Adding custom repositories
You have two options:
### Option 1: Add your repo to the app for yourself:
1. You need the modules.json link of your repo, if you don't have one please contact the repo owner.
2. Open the app and go to the settings.
3. Go to repos at the top.
4. Scroll to the bottom and click on the "Add repo" button.
5. Paste the modules.json link and click on the "Add" button.
6. You can now download modules from your repo.
### Option 2: Add your repo to the app for everyone:
To add you own repo to Fox's mmm it need to follow theses conditions:
- The module repo or at least one of it's owners must be known.
- Modules in the repo must be monitored, and malicious modules must be removed.
- Module repo must have a valid, working, automatically or frequently updated `modules.json`
([Example](https://github.com/Magisk-Modules-Alt-Repo/json/blob/main/modules.json))
These guidelines are not mandatory, but not following them may result in your repo being removed or
not being added in the first place.
<details>
<summary>Click to see the guidelines</summary>
- Repos must process and take-down off their repo module where it's removal was provably
requested by
their
original author
- Repos may not collect and/or distribute any personally identifiable data (including IP
addresses) without
informing
users
that they do so and offering a way to opt out
- Modules owners must be aware that their modules are being hosted on the repository and/or have a
way to remove their modules from the repository
- Modules owners must be aware of any change made of the distributed version of their modules.
- Repos should make an effort to keep users safe, via a review process, or by using a
whitelist/blacklist
</details>
In all scenarios, insofar that their policies are not in conflict with the above, the repo owner's
poloicies take precedence over the above guidelines. We encourage users to check the guidelines of
the repo they are using.
Loading…
Cancel
Save