diff --git a/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java b/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java index a3aa28059..09ae5648d 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java +++ b/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java @@ -8,7 +8,6 @@ import androidx.test.filters.LargeTest; import org.junit.Test; import org.junit.runner.RunWith; import org.schabi.newpipe.R; -import org.schabi.newpipe.report.ErrorActivity.ErrorInfo; import static org.junit.Assert.assertEquals; @@ -29,10 +28,10 @@ public class ErrorInfoTest { parcel.setDataPosition(0); final ErrorInfo infoFromParcel = ErrorInfo.CREATOR.createFromParcel(parcel); - assertEquals(UserAction.USER_REPORT, infoFromParcel.userAction); - assertEquals("youtube", infoFromParcel.serviceName); - assertEquals("request", infoFromParcel.request); - assertEquals(R.string.general_error, infoFromParcel.message); + assertEquals(UserAction.USER_REPORT, infoFromParcel.getUserAction()); + assertEquals("youtube", infoFromParcel.getServiceName()); + assertEquals("request", infoFromParcel.getRequest()); + assertEquals(R.string.general_error, infoFromParcel.getMessage()); parcel.recycle(); } diff --git a/app/src/main/java/org/schabi/newpipe/App.java b/app/src/main/java/org/schabi/newpipe/App.java index 5fdc1058a..51d0f1016 100644 --- a/app/src/main/java/org/schabi/newpipe/App.java +++ b/app/src/main/java/org/schabi/newpipe/App.java @@ -22,6 +22,7 @@ import org.acra.config.CoreConfigurationBuilder; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.downloader.Downloader; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.settings.SettingsActivity; import org.schabi.newpipe.util.ExceptionUtils; @@ -226,7 +227,7 @@ public class App extends MultiDexApplication { ace, null, null, - ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", + ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Could not initialize ACRA crash report", R.string.app_ui_crash)); } } diff --git a/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java b/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java index a193149e2..1bec52dcd 100644 --- a/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java +++ b/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java @@ -23,6 +23,7 @@ import com.grack.nanojson.JsonParserException; import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import java.io.ByteArrayInputStream; @@ -67,7 +68,7 @@ public final class CheckForNewAppVersion { packageInfo = pm.getPackageInfo(packageName, flags); } catch (final PackageManager.NameNotFoundException e) { ErrorActivity.reportError(application, e, null, null, - ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", + ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Could not find package info", R.string.app_ui_crash)); } @@ -82,7 +83,7 @@ public final class CheckForNewAppVersion { c = (X509Certificate) cf.generateCertificate(input); } catch (final CertificateException e) { ErrorActivity.reportError(application, e, null, null, - ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", + ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Certificate error", R.string.app_ui_crash)); } @@ -94,7 +95,7 @@ public final class CheckForNewAppVersion { hexString = byte2HexFormatted(publicKey); } catch (NoSuchAlgorithmException | CertificateEncodingException e) { ErrorActivity.reportError(application, e, null, null, - ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", + ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Could not retrieve SHA1 key", R.string.app_ui_crash)); } diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java index 93398d990..827da87e1 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -49,6 +49,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.SubtitlesStream; import org.schabi.newpipe.extractor.stream.VideoStream; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.settings.NewPipeSettings; import org.schabi.newpipe.util.FilePickerActivityHelper; @@ -602,7 +603,7 @@ public class DownloadDialog extends DialogFragment Collections.singletonList(e), null, null, - ErrorActivity.ErrorInfo + ErrorInfo .make(UserAction.SOMETHING_ELSE, "-", "-", R.string.general_error) ); } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java index c687c4a6a..37e4ce465 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java @@ -23,6 +23,7 @@ import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException; import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException; import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.ExceptionUtils; import org.schabi.newpipe.util.InfoCache; @@ -252,7 +253,7 @@ public abstract class BaseStateFragment extends BaseFragment implements ViewC } ErrorActivity.reportError(getContext(), exception, MainActivity.class, null, - ErrorActivity.ErrorInfo.make(userAction, serviceName == null ? "none" : serviceName, + ErrorInfo.make(userAction, serviceName == null ? "none" : serviceName, request == null ? "none" : request, errorId)); } @@ -265,7 +266,7 @@ public abstract class BaseStateFragment extends BaseFragment implements ViewC /** * Show a SnackBar and only call - * {@link ErrorActivity#reportError(Context, List, Class, View, ErrorActivity.ErrorInfo)} + * {@link ErrorActivity#reportError(Context, List, Class, View, ErrorInfo)} * IF we a find a valid view (otherwise the error screen appears). * * @param exception List of the exceptions to show @@ -291,6 +292,6 @@ public abstract class BaseStateFragment extends BaseFragment implements ViewC } ErrorActivity.reportError(getContext(), exception, MainActivity.class, rootView, - ErrorActivity.ErrorInfo.make(userAction, serviceName, request, errorId)); + ErrorInfo.make(userAction, serviceName, request, errorId)); } } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java index e78bfa7ce..866b324ec 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java @@ -27,6 +27,7 @@ import org.schabi.newpipe.BaseFragment; import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.settings.tabs.Tab; import org.schabi.newpipe.settings.tabs.TabsManager; @@ -242,7 +243,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte } if (throwable != null) { - ErrorActivity.reportError(context, throwable, null, null, ErrorActivity.ErrorInfo + ErrorActivity.reportError(context, throwable, null, null, ErrorInfo .make(UserAction.UI_ERROR, "none", "", R.string.app_ui_crash)); return new BlankFragment(); } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 772a291b1..e7c98fe8b 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -92,6 +92,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueue; import org.schabi.newpipe.player.playqueue.PlayQueueItem; import org.schabi.newpipe.player.playqueue.SinglePlayQueue; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.Constants; import org.schabi.newpipe.util.DeviceUtils; @@ -1630,7 +1631,7 @@ public final class VideoDetailFragment downloadDialog.show(activity.getSupportFragmentManager(), "downloadDialog"); } catch (final Exception e) { - final ErrorActivity.ErrorInfo info = ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR, + final ErrorInfo info = ErrorInfo.make(UserAction.UI_ERROR, ServiceList.all() .get(currentInfo .getServiceId()) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index 1452241aa..66e16ff3c 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -49,6 +49,7 @@ import org.schabi.newpipe.fragments.BackPressable; import org.schabi.newpipe.fragments.list.BaseListFragment; import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.AnimationUtils; import org.schabi.newpipe.util.Constants; @@ -248,7 +249,7 @@ public class SearchFragment extends BaseListFragment ErrorActivity.reportError(getContext(), throwable, SettingsActivity.class, null, - ErrorActivity.ErrorInfo.make( + ErrorInfo.make( UserAction.DELETE_FROM_HISTORY, "none", "Delete view history", @@ -197,7 +198,7 @@ public class StatisticsPlaylistFragment throwable -> ErrorActivity.reportError(getContext(), throwable, SettingsActivity.class, null, - ErrorActivity.ErrorInfo.make( + ErrorInfo.make( UserAction.DELETE_FROM_HISTORY, "none", "Delete search history", diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java index a2a848b4b..d7a1051e6 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java @@ -27,6 +27,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.Constants; import org.schabi.newpipe.util.FilePickerActivityHelper; @@ -84,7 +85,7 @@ public class SubscriptionsImportFragment extends BaseFragment { setupServiceVariables(); if (supportedSources.isEmpty() && currentServiceId != Constants.NO_SERVICE_ID) { ErrorActivity.reportError(activity, Collections.emptyList(), null, null, - ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, + ErrorInfo.make(UserAction.SOMETHING_ELSE, NewPipe.getNameOfService(currentServiceId), "Service don't support importing", R.string.general_error)); activity.finish(); diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/services/BaseImportExportService.java b/app/src/main/java/org/schabi/newpipe/local/subscription/services/BaseImportExportService.java index f485844ea..9b9a55afb 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/services/BaseImportExportService.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/services/BaseImportExportService.java @@ -37,6 +37,7 @@ import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; import org.schabi.newpipe.local.subscription.SubscriptionManager; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.ExceptionUtils; @@ -153,7 +154,7 @@ public abstract class BaseImportExportService extends Service { protected void stopAndReportError(@Nullable final Throwable error, final String request) { stopService(); - final ErrorActivity.ErrorInfo errorInfo = ErrorActivity.ErrorInfo + final ErrorInfo errorInfo = ErrorInfo .make(UserAction.SUBSCRIPTION, "unknown", request, R.string.general_error); ErrorActivity.reportError(this, error != null ? Collections.singletonList(error) : Collections.emptyList(), null, null, errorInfo); diff --git a/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java b/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java index b31e3a31e..311cb8a80 100644 --- a/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java +++ b/app/src/main/java/org/schabi/newpipe/report/AcraReportSender.java @@ -33,7 +33,7 @@ public class AcraReportSender implements ReportSender { @Override public void send(@NonNull final Context context, @NonNull final CrashReportData report) { ErrorActivity.reportError(context, report, - ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR, "none", + ErrorInfo.make(UserAction.UI_ERROR, "none", "App crash, UI failure", R.string.app_ui_crash)); } } diff --git a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java index 259dff44d..3213821cd 100644 --- a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java @@ -9,8 +9,6 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; -import android.os.Parcel; -import android.os.Parcelable; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; @@ -22,7 +20,6 @@ import android.widget.TextView; import android.widget.Toast; import androidx.annotation.Nullable; -import androidx.annotation.StringRes; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; @@ -230,8 +227,8 @@ public class ErrorActivity extends AppCompatActivity { // normal bugreport buildInfo(errorInfo); - if (errorInfo.message != 0) { - errorMessageView.setText(errorInfo.message); + if (errorInfo.getMessage() != 0) { + errorMessageView.setText(errorInfo.getMessage()); } else { errorMessageView.setVisibility(View.GONE); findViewById(R.id.messageWhatHappenedView).setVisibility(View.GONE); @@ -348,12 +345,12 @@ public class ErrorActivity extends AppCompatActivity { infoLabelView.setText(getString(R.string.info_labels).replace("\\n", "\n")); - text += getUserActionString(info.userAction) + "\n" - + info.request + "\n" + text += getUserActionString(info.getUserAction()) + "\n" + + info.getRequest() + "\n" + getContentLanguageString() + "\n" + getContentCountryString() + "\n" + getAppLanguage() + "\n" - + info.serviceName + "\n" + + info.getServiceName() + "\n" + currentTimeStamp + "\n" + getPackageName() + "\n" + BuildConfig.VERSION_NAME + "\n" @@ -366,12 +363,12 @@ public class ErrorActivity extends AppCompatActivity { try { return JsonWriter.string() .object() - .value("user_action", getUserActionString(errorInfo.userAction)) - .value("request", errorInfo.request) + .value("user_action", getUserActionString(errorInfo.getUserAction())) + .value("request", errorInfo.getRequest()) .value("content_language", getContentLanguageString()) .value("content_country", getContentCountryString()) .value("app_language", getAppLanguage()) - .value("service", errorInfo.serviceName) + .value("service", errorInfo.getServiceName()) .value("package", getPackageName()) .value("version", BuildConfig.VERSION_NAME) .value("os", getOsString()) @@ -401,12 +398,12 @@ public class ErrorActivity extends AppCompatActivity { htmlErrorReport .append("## Exception") .append("\n* __User Action:__ ") - .append(getUserActionString(errorInfo.userAction)) - .append("\n* __Request:__ ").append(errorInfo.request) + .append(getUserActionString(errorInfo.getUserAction())) + .append("\n* __Request:__ ").append(errorInfo.getRequest()) .append("\n* __Content Country:__ ").append(getContentCountryString()) .append("\n* __Content Language:__ ").append(getContentLanguageString()) .append("\n* __App Language:__ ").append(getAppLanguage()) - .append("\n* __Service:__ ").append(errorInfo.serviceName) + .append("\n* __Service:__ ").append(errorInfo.getServiceName()) .append("\n* __Version:__ ").append(BuildConfig.VERSION_NAME) .append("\n* __OS:__ ").append(getOsString()).append("\n"); @@ -494,57 +491,4 @@ public class ErrorActivity extends AppCompatActivity { return df.format(new Date()); } - public static class ErrorInfo implements Parcelable { - public static final Parcelable.Creator CREATOR - = new Parcelable.Creator() { - @Override - public ErrorInfo createFromParcel(final Parcel source) { - return new ErrorInfo(source); - } - - @Override - public ErrorInfo[] newArray(final int size) { - return new ErrorInfo[size]; - } - }; - - final UserAction userAction; - public final String request; - final String serviceName; - @StringRes - public final int message; - - private ErrorInfo(final UserAction userAction, final String serviceName, - final String request, @StringRes final int message) { - this.userAction = userAction; - this.serviceName = serviceName; - this.request = request; - this.message = message; - } - - protected ErrorInfo(final Parcel in) { - this.userAction = UserAction.valueOf(in.readString()); - this.request = in.readString(); - this.serviceName = in.readString(); - this.message = in.readInt(); - } - - public static ErrorInfo make(final UserAction userAction, final String serviceName, - final String request, @StringRes final int message) { - return new ErrorInfo(userAction, serviceName, request, message); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(final Parcel dest, final int flags) { - dest.writeString(this.userAction.name()); - dest.writeString(this.request); - dest.writeString(this.serviceName); - dest.writeInt(this.message); - } - } } diff --git a/app/src/main/java/org/schabi/newpipe/report/ErrorInfo.kt b/app/src/main/java/org/schabi/newpipe/report/ErrorInfo.kt new file mode 100644 index 000000000..894506109 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/report/ErrorInfo.kt @@ -0,0 +1,23 @@ +package org.schabi.newpipe.report + +import android.os.Parcelable +import androidx.annotation.StringRes +import kotlinx.android.parcel.Parcelize + +@Parcelize +class ErrorInfo private constructor( + val userAction: UserAction?, + val serviceName: String, + val request: String, + @field:StringRes @param:StringRes val message: Int +) : Parcelable { + companion object { + @JvmStatic + fun make( + userAction: UserAction?, + serviceName: String, + request: String, + @StringRes message: Int + ) = ErrorInfo(userAction, serviceName, request, message) + } +} diff --git a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java index 3fba6890a..17e130967 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java @@ -25,6 +25,7 @@ import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.localization.ContentCountry; import org.schabi.newpipe.extractor.localization.Localization; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.FilePickerActivityHelper; import org.schabi.newpipe.util.ZipHelper; @@ -357,7 +358,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment { ErrorActivity.reportError(activity, e, activity.getClass(), null, - ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR, + ErrorInfo.make(UserAction.UI_ERROR, "none", "", R.string.app_ui_crash)); } } diff --git a/app/src/main/java/org/schabi/newpipe/settings/HistorySettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/HistorySettingsFragment.java index 893e7c740..e0cf2e4ad 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/HistorySettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/HistorySettingsFragment.java @@ -10,6 +10,7 @@ import androidx.preference.Preference; import org.schabi.newpipe.R; import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.InfoCache; @@ -64,7 +65,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment { throwable -> ErrorActivity.reportError(getContext(), throwable, SettingsActivity.class, null, - ErrorActivity.ErrorInfo.make( + ErrorInfo.make( UserAction.DELETE_FROM_HISTORY, "none", "Delete playback states", @@ -79,7 +80,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment { throwable -> ErrorActivity.reportError(getContext(), throwable, SettingsActivity.class, null, - ErrorActivity.ErrorInfo.make( + ErrorInfo.make( UserAction.DELETE_FROM_HISTORY, "none", "Delete view history", @@ -93,7 +94,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment { throwable -> ErrorActivity.reportError(getContext(), throwable, SettingsActivity.class, null, - ErrorActivity.ErrorInfo.make( + ErrorInfo.make( UserAction.DELETE_FROM_HISTORY, "none", "Delete search history", @@ -122,7 +123,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment { throwable -> ErrorActivity.reportError(getContext(), throwable, SettingsActivity.class, null, - ErrorActivity.ErrorInfo.make( + ErrorInfo.make( UserAction.DELETE_FROM_HISTORY, "none", "Delete playback states", @@ -148,7 +149,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment { throwable -> ErrorActivity.reportError(getContext(), throwable, SettingsActivity.class, null, - ErrorActivity.ErrorInfo.make( + ErrorInfo.make( UserAction.DELETE_FROM_HISTORY, "none", "Delete search history", diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectChannelFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectChannelFragment.java index 96e2781f5..f87b5cd2a 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SelectChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SelectChannelFragment.java @@ -22,6 +22,7 @@ import org.schabi.newpipe.R; import org.schabi.newpipe.database.subscription.SubscriptionEntity; import org.schabi.newpipe.local.subscription.SubscriptionManager; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.ThemeHelper; @@ -178,7 +179,7 @@ public class SelectChannelFragment extends DialogFragment { protected void onError(final Throwable e) { final Activity activity = getActivity(); - ErrorActivity.reportError(activity, e, activity.getClass(), null, ErrorActivity.ErrorInfo + ErrorActivity.reportError(activity, e, activity.getClass(), null, ErrorInfo .make(UserAction.UI_ERROR, "none", "", R.string.app_ui_crash)); } diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java index 9d0fece4f..fc974607b 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java @@ -19,6 +19,7 @@ import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.ServiceHelper; @@ -114,7 +115,7 @@ public class SelectKioskFragment extends DialogFragment { protected void onError(final Throwable e) { final Activity activity = getActivity(); - ErrorActivity.reportError(activity, e, activity.getClass(), null, ErrorActivity.ErrorInfo + ErrorActivity.reportError(activity, e, activity.getClass(), null, ErrorInfo .make(UserAction.UI_ERROR, "none", "", R.string.app_ui_crash)); } diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectPlaylistFragment.java index 153adf4c0..f2876f1ee 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SelectPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SelectPlaylistFragment.java @@ -27,6 +27,7 @@ import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity; import org.schabi.newpipe.local.playlist.LocalPlaylistManager; import org.schabi.newpipe.local.playlist.RemotePlaylistManager; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import java.util.List; @@ -114,7 +115,7 @@ public class SelectPlaylistFragment extends DialogFragment { protected void onError(final Throwable e) { final Activity activity = requireActivity(); - ErrorActivity.reportError(activity, e, activity.getClass(), null, ErrorActivity.ErrorInfo + ErrorActivity.reportError(activity, e, activity.getClass(), null, ErrorInfo .make(UserAction.UI_ERROR, "none", "load_playlists", R.string.app_ui_crash)); } diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java index 26e72722e..9042559c9 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java @@ -8,7 +8,7 @@ import androidx.preference.PreferenceManager; import org.schabi.newpipe.R; import org.schabi.newpipe.report.ErrorActivity; -import org.schabi.newpipe.report.ErrorActivity.ErrorInfo; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import static org.schabi.newpipe.MainActivity.DEBUG; diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java index 44406abac..cbc47392b 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java @@ -29,6 +29,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.settings.SelectChannelFragment; import org.schabi.newpipe.settings.SelectKioskFragment; @@ -184,7 +185,7 @@ public class ChooseTabsFragment extends Fragment { if (type == null) { ErrorActivity.reportError(requireContext(), new IllegalStateException("Tab id not found: " + tabId), null, null, - ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", + ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Choosing tabs on settings", 0)); return; } diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java index aaac03232..ce3874f39 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java @@ -26,6 +26,7 @@ import org.schabi.newpipe.local.history.StatisticsPlaylistFragment; import org.schabi.newpipe.local.playlist.LocalPlaylistFragment; import org.schabi.newpipe.local.subscription.SubscriptionFragment; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.ServiceHelper; @@ -483,7 +484,7 @@ public abstract class Tab { kioskId = service.getKioskList().getDefaultKioskId(); } catch (final ExtractionException e) { ErrorActivity.reportError(context, e, null, null, - ErrorActivity.ErrorInfo.make(UserAction.REQUESTED_KIOSK, "none", + ErrorInfo.make(UserAction.REQUESTED_KIOSK, "none", "Loading default kiosk from selected service", 0)); } return kioskId; diff --git a/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java b/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java index e6dffaec4..91a38d8d8 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java @@ -51,6 +51,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import java.util.Collections; @@ -298,7 +299,7 @@ public final class ExtractorHelper { : exception instanceof ParsingException ? R.string.parsing_error : R.string.general_error; ErrorActivity.reportError(handler, context, exception, MainActivity.class, null, - ErrorActivity.ErrorInfo.make(userAction, serviceId == -1 ? "none" + ErrorInfo.make(userAction, serviceId == -1 ? "none" : NewPipe.getNameOfService(serviceId), url + (optionalErrorMessage == null ? "" : optionalErrorMessage), errorId)); diff --git a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java index f3fb64a5d..07fe2fcc4 100644 --- a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java +++ b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java @@ -39,6 +39,7 @@ import org.schabi.newpipe.BuildConfig; import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.report.ErrorActivity; +import org.schabi.newpipe.report.ErrorInfo; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.NavigationHelper; @@ -575,7 +576,7 @@ public class MissionAdapter extends Adapter implements Handler.Callb mission.errObject, null, null, - ErrorActivity.ErrorInfo.make(action, service, request.toString(), reason) + ErrorInfo.make(action, service, request.toString(), reason) ); }