Completely remove return activity, now outdated
This commit is contained in:
parent
0263125e11
commit
463dd8ea74
|
@ -227,7 +227,7 @@ public class App extends MultiDexApplication {
|
||||||
ACRA.init(this, acraConfig);
|
ACRA.init(this, acraConfig);
|
||||||
} catch (final ACRAConfigurationException exception) {
|
} catch (final ACRAConfigurationException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
ErrorActivity.reportError(this, null, null, new ErrorInfo(exception,
|
ErrorActivity.reportError(this, new ErrorInfo(exception,
|
||||||
UserAction.SOMETHING_ELSE, "Could not initialize ACRA crash report"));
|
UserAction.SOMETHING_ELSE, "Could not initialize ACRA crash report"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public final class CheckForNewAppVersion {
|
||||||
packageInfo = application.getPackageManager().getPackageInfo(
|
packageInfo = application.getPackageManager().getPackageInfo(
|
||||||
application.getPackageName(), PackageManager.GET_SIGNATURES);
|
application.getPackageName(), PackageManager.GET_SIGNATURES);
|
||||||
} catch (final PackageManager.NameNotFoundException e) {
|
} catch (final PackageManager.NameNotFoundException e) {
|
||||||
ErrorActivity.reportError(application, null, null, new ErrorInfo(e,
|
ErrorActivity.reportError(application, new ErrorInfo(e,
|
||||||
UserAction.CHECK_FOR_NEW_APP_VERSION, "Could not find package info"));
|
UserAction.CHECK_FOR_NEW_APP_VERSION, "Could not find package info"));
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public final class CheckForNewAppVersion {
|
||||||
final CertificateFactory cf = CertificateFactory.getInstance("X509");
|
final CertificateFactory cf = CertificateFactory.getInstance("X509");
|
||||||
c = (X509Certificate) cf.generateCertificate(input);
|
c = (X509Certificate) cf.generateCertificate(input);
|
||||||
} catch (final CertificateException e) {
|
} catch (final CertificateException e) {
|
||||||
ErrorActivity.reportError(application, null, null, new ErrorInfo(e,
|
ErrorActivity.reportError(application, new ErrorInfo(e,
|
||||||
UserAction.CHECK_FOR_NEW_APP_VERSION, "Certificate error"));
|
UserAction.CHECK_FOR_NEW_APP_VERSION, "Certificate error"));
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public final class CheckForNewAppVersion {
|
||||||
final byte[] publicKey = md.digest(c.getEncoded());
|
final byte[] publicKey = md.digest(c.getEncoded());
|
||||||
return byte2HexFormatted(publicKey);
|
return byte2HexFormatted(publicKey);
|
||||||
} catch (NoSuchAlgorithmException | CertificateEncodingException e) {
|
} catch (NoSuchAlgorithmException | CertificateEncodingException e) {
|
||||||
ErrorActivity.reportError(application, null, null, new ErrorInfo(e,
|
ErrorActivity.reportError(application, new ErrorInfo(e,
|
||||||
UserAction.CHECK_FOR_NEW_APP_VERSION, "Could not retrieve SHA1 key"));
|
UserAction.CHECK_FOR_NEW_APP_VERSION, "Could not retrieve SHA1 key"));
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
try {
|
try {
|
||||||
setupDrawer();
|
setupDrawer();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(this, null, "Setting up drawer", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Setting up drawer", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DeviceUtils.isTv(this)) {
|
if (DeviceUtils.isTv(this)) {
|
||||||
|
@ -238,7 +238,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
try {
|
try {
|
||||||
tabSelected(item);
|
tabSelected(item);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(this, null, "Selecting main page tab", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Selecting main page tab", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.menu_options_about_group:
|
case R.id.menu_options_about_group:
|
||||||
|
@ -340,7 +340,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
try {
|
try {
|
||||||
showTabs();
|
showTabs();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(this, null, "Showing main page tabs", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Showing main page tabs", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
drawerHeaderBinding.drawerHeaderActionButton.setContentDescription(
|
drawerHeaderBinding.drawerHeaderActionButton.setContentDescription(
|
||||||
getString(R.string.drawer_header_description) + selectedServiceName);
|
getString(R.string.drawer_header_description) + selectedServiceName);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(this, null, "Setting up service toggle", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Setting up service toggle", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SharedPreferences sharedPreferences
|
final SharedPreferences sharedPreferences
|
||||||
|
@ -796,7 +796,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
NavigationHelper.gotoMainFragment(getSupportFragmentManager());
|
NavigationHelper.gotoMainFragment(getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(this, null, "Handling intent", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Handling intent", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class RouterActivity extends AppCompatActivity {
|
||||||
// unfortunately we cannot tell if the error is really caused by an unsupported url
|
// unfortunately we cannot tell if the error is really caused by an unsupported url
|
||||||
((RouterActivity) context).showUnsupportedUrlDialog(errorInfo.getRequest());
|
((RouterActivity) context).showUnsupportedUrlDialog(errorInfo.getRequest());
|
||||||
} else {
|
} else {
|
||||||
ErrorActivity.reportError(context, MainActivity.class, null, errorInfo);
|
ErrorActivity.reportError(context, errorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context instanceof RouterActivity) {
|
if (context instanceof RouterActivity) {
|
||||||
|
|
|
@ -693,7 +693,7 @@ public class DownloadDialog extends DialogFragment
|
||||||
mainStorage.getTag());
|
mainStorage.getTag());
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportError(context, null, null,
|
ErrorActivity.reportErrorInSnackbar(this,
|
||||||
new ErrorInfo(e, UserAction.DOWNLOAD_FAILED, "Getting storage"));
|
new ErrorInfo(e, UserAction.DOWNLOAD_FAILED, "Getting storage"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class AcraReportSender implements ReportSender {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(@NonNull final Context context, @NonNull final CrashReportData report) {
|
public void send(@NonNull final Context context, @NonNull final CrashReportData report) {
|
||||||
ErrorActivity.reportError(context, null, null, new ErrorInfo(
|
ErrorActivity.reportError(context, new ErrorInfo(
|
||||||
new String[]{report.getString(ReportField.STACK_TRACE)},
|
new String[]{report.getString(ReportField.STACK_TRACE)},
|
||||||
UserAction.UI_ERROR,
|
UserAction.UI_ERROR,
|
||||||
ErrorInfo.SERVICE_NONE,
|
ErrorInfo.SERVICE_NONE,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -18,7 +17,7 @@ import android.view.View;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.app.NavUtils;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.grack.nanojson.JsonWriter;
|
import com.grack.nanojson.JsonWriter;
|
||||||
|
@ -74,64 +73,67 @@ public class ErrorActivity extends AppCompatActivity {
|
||||||
= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Singleton:
|
|
||||||
* Used to send data between certain Activity/Services within the same process.
|
|
||||||
* This can be considered as an ugly hack inside the Android universe.
|
|
||||||
**/
|
|
||||||
@Nullable private static Class savedReturnActivity = null;
|
|
||||||
|
|
||||||
private ErrorInfo errorInfo;
|
private ErrorInfo errorInfo;
|
||||||
private String currentTimeStamp;
|
private String currentTimeStamp;
|
||||||
|
|
||||||
private ActivityErrorBinding activityErrorBinding;
|
private ActivityErrorBinding activityErrorBinding;
|
||||||
|
|
||||||
public static void reportUiError(final Context context,
|
public static void reportError(final Context context, final ErrorInfo errorInfo) {
|
||||||
@Nullable final View rootView,
|
final Intent intent = new Intent(context, ErrorActivity.class);
|
||||||
final String request,
|
intent.putExtra(ERROR_INFO, errorInfo);
|
||||||
final Throwable throwable) {
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
reportError(context, (context instanceof Activity ? context.getClass() : null), rootView,
|
context.startActivity(intent);
|
||||||
new ErrorInfo(throwable, UserAction.UI_ERROR, request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reportError(final Context context,
|
public static void reportErrorInSnackbar(final Context context, final ErrorInfo errorInfo) {
|
||||||
final Class returnActivity,
|
final View rootView = context instanceof Activity
|
||||||
|
? ((Activity) context).findViewById(android.R.id.content) : null;
|
||||||
|
reportErrorInSnackbar(context, rootView, errorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void reportErrorInSnackbar(final Fragment fragment, final ErrorInfo errorInfo) {
|
||||||
|
View rootView = fragment.getView();
|
||||||
|
if (rootView == null && fragment.getActivity() != null) {
|
||||||
|
rootView = fragment.getActivity().findViewById(android.R.id.content);
|
||||||
|
}
|
||||||
|
reportErrorInSnackbar(fragment.requireContext(), rootView, errorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void reportUiErrorInSnackbar(final Context context,
|
||||||
|
final String request,
|
||||||
|
final Throwable throwable) {
|
||||||
|
reportErrorInSnackbar(context, new ErrorInfo(throwable, UserAction.UI_ERROR, request));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void reportUiErrorInSnackbar(final Fragment fragment,
|
||||||
|
final String request,
|
||||||
|
final Throwable throwable) {
|
||||||
|
reportErrorInSnackbar(fragment, new ErrorInfo(throwable, UserAction.UI_ERROR, request));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Utils
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
private static void reportErrorInSnackbar(final Context context,
|
||||||
@Nullable final View rootView,
|
@Nullable final View rootView,
|
||||||
final ErrorInfo errorInfo) {
|
final ErrorInfo errorInfo) {
|
||||||
if (rootView != null) {
|
if (rootView != null) {
|
||||||
Snackbar.make(rootView, R.string.error_snackbar_message, Snackbar.LENGTH_LONG)
|
Snackbar.make(rootView, R.string.error_snackbar_message, Snackbar.LENGTH_LONG)
|
||||||
.setActionTextColor(Color.YELLOW)
|
.setActionTextColor(Color.YELLOW)
|
||||||
.setAction(context.getString(R.string.error_snackbar_action).toUpperCase(), v ->
|
.setAction(context.getString(R.string.error_snackbar_action).toUpperCase(), v ->
|
||||||
startErrorActivity(returnActivity, context, errorInfo)).show();
|
reportError(context, errorInfo)).show();
|
||||||
} else {
|
} else {
|
||||||
startErrorActivity(returnActivity, context, errorInfo);
|
reportError(context, errorInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// async call
|
|
||||||
public static void reportError(final Handler handler,
|
|
||||||
final Context context,
|
|
||||||
final Class returnActivity,
|
|
||||||
final View rootView,
|
|
||||||
final ErrorInfo errorInfo) {
|
|
||||||
handler.post(() -> reportError(context, returnActivity, rootView, errorInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// UTILS
|
// Activity lifecycle
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private static void startErrorActivity(@Nullable final Class returnActivity,
|
|
||||||
final Context context,
|
|
||||||
final ErrorInfo errorInfo) {
|
|
||||||
savedReturnActivity = returnActivity;
|
|
||||||
final Intent intent = new Intent(context, ErrorActivity.class);
|
|
||||||
intent.putExtra(ERROR_INFO, errorInfo);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
assureCorrectAppLanguage(this);
|
assureCorrectAppLanguage(this);
|
||||||
|
@ -189,7 +191,7 @@ public class ErrorActivity extends AppCompatActivity {
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
final int id = item.getItemId();
|
final int id = item.getItemId();
|
||||||
if (id == android.R.id.home) {
|
if (id == android.R.id.home) {
|
||||||
goToReturnActivity();
|
onBackPressed();
|
||||||
} else if (id == R.id.menu_item_share_error) {
|
} else if (id == R.id.menu_item_share_error) {
|
||||||
ShareUtils.shareText(this, getString(R.string.error_report_title), buildJson());
|
ShareUtils.shareText(this, getString(R.string.error_report_title), buildJson());
|
||||||
} else {
|
} else {
|
||||||
|
@ -258,18 +260,6 @@ public class ErrorActivity extends AppCompatActivity {
|
||||||
return checkedReturnActivity;
|
return checkedReturnActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void goToReturnActivity() {
|
|
||||||
final Class<? extends Activity> checkedReturnActivity =
|
|
||||||
getReturnActivity(savedReturnActivity);
|
|
||||||
if (checkedReturnActivity == null) {
|
|
||||||
super.onBackPressed();
|
|
||||||
} else {
|
|
||||||
final Intent intent = new Intent(this, checkedReturnActivity);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
NavUtils.navigateUpTo(this, intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buildInfo(final ErrorInfo info) {
|
private void buildInfo(final ErrorInfo info) {
|
||||||
String text = "";
|
String text = "";
|
||||||
|
|
||||||
|
@ -409,10 +399,4 @@ public class ErrorActivity extends AppCompatActivity {
|
||||||
text += "\n" + getString(R.string.guru_meditation);
|
text += "\n" + getString(R.string.guru_meditation);
|
||||||
activityErrorBinding.errorSorryView.setText(text);
|
activityErrorBinding.errorSorryView.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
//super.onBackPressed();
|
|
||||||
goToReturnActivity();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,7 @@ class ErrorPanelHelper(
|
||||||
} else {
|
} else {
|
||||||
errorButtonAction.setText(R.string.error_snackbar_action)
|
errorButtonAction.setText(R.string.error_snackbar_action)
|
||||||
errorButtonAction.setOnClickListener {
|
errorButtonAction.setOnClickListener {
|
||||||
ErrorActivity.reportError(
|
ErrorActivity.reportError(context, errorInfo)
|
||||||
context,
|
|
||||||
MainActivity::class.java,
|
|
||||||
null,
|
|
||||||
errorInfo
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide retry button by default, then show only if not unavailable/unsupported content
|
// hide retry button by default, then show only if not unavailable/unsupported content
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.schabi.newpipe.fragments;
|
package org.schabi.newpipe.fragments;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -10,7 +9,6 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.schabi.newpipe.BaseFragment;
|
import org.schabi.newpipe.BaseFragment;
|
||||||
import org.schabi.newpipe.MainActivity;
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.error.ErrorActivity;
|
import org.schabi.newpipe.error.ErrorActivity;
|
||||||
import org.schabi.newpipe.error.ErrorInfo;
|
import org.schabi.newpipe.error.ErrorInfo;
|
||||||
|
@ -157,7 +155,7 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC
|
||||||
errorPanelHelper.showError(errorInfo);
|
errorPanelHelper.showError(errorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void showTextError(final @NonNull String errorString) {
|
public final void showTextError(@NonNull final String errorString) {
|
||||||
handleError();
|
handleError();
|
||||||
|
|
||||||
if (isDetached() || isRemoving()) {
|
if (isDetached() || isRemoving()) {
|
||||||
|
@ -180,7 +178,7 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a SnackBar and only call
|
* Show a SnackBar and only call
|
||||||
* {@link ErrorActivity#reportError(Context, Class, View, ErrorInfo)}
|
* {@link ErrorActivity.reportErrorInSnackbar(androidx.fragment.app.Fragment, ErrorInfo)}
|
||||||
* IF we a find a valid view (otherwise the error screen appears).
|
* IF we a find a valid view (otherwise the error screen appears).
|
||||||
*
|
*
|
||||||
* @param errorInfo The error information
|
* @param errorInfo The error information
|
||||||
|
@ -189,14 +187,6 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "showSnackBarError() called with: errorInfo = [" + errorInfo + "]");
|
Log.d(TAG, "showSnackBarError() called with: errorInfo = [" + errorInfo + "]");
|
||||||
}
|
}
|
||||||
View rootView = activity != null ? activity.findViewById(android.R.id.content) : null;
|
ErrorActivity.reportErrorInSnackbar(this, errorInfo);
|
||||||
if (rootView == null) {
|
|
||||||
rootView = getView();
|
|
||||||
}
|
|
||||||
if (rootView == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorActivity.reportError(requireContext(), MainActivity.class, rootView, errorInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
NavigationHelper.openSearchFragment(getFM(),
|
NavigationHelper.openSearchFragment(getFM(),
|
||||||
ServiceHelper.getSelectedServiceId(activity), "");
|
ServiceHelper.getSelectedServiceId(activity), "");
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null, "Opening search fragment", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Opening search fragment", e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
}
|
}
|
||||||
|
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
ErrorActivity.reportUiError(context, null, "Getting fragment item", throwable);
|
ErrorActivity.reportUiErrorInSnackbar(context, "Getting fragment item", throwable);
|
||||||
return new BlankFragment();
|
return new BlankFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ public final class VideoDetailFragment
|
||||||
NavigationHelper.openChannelFragment(getFM(), currentInfo.getServiceId(),
|
NavigationHelper.openChannelFragment(getFM(), currentInfo.getServiceId(),
|
||||||
subChannelUrl, subChannelName);
|
subChannelUrl, subChannelName);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null, "Opening channel fragment", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Opening channel fragment", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1596,8 +1596,7 @@ public final class VideoDetailFragment
|
||||||
|
|
||||||
downloadDialog.show(activity.getSupportFragmentManager(), "downloadDialog");
|
downloadDialog.show(activity.getSupportFragmentManager(), "downloadDialog");
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportError(activity, activity.getClass(),
|
ErrorActivity.reportErrorInSnackbar(activity,
|
||||||
activity.findViewById(android.R.id.content),
|
|
||||||
new ErrorInfo(e, UserAction.DOWNLOAD_OPEN_DIALOG, "Showing download dialog",
|
new ErrorInfo(e, UserAction.DOWNLOAD_OPEN_DIALOG, "Showing download dialog",
|
||||||
currentInfo));
|
currentInfo));
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,8 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
|
||||||
selectedItem.getUrl(),
|
selectedItem.getUrl(),
|
||||||
selectedItem.getName());
|
selectedItem.getName());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null, "Opening channel fragment", e);
|
ErrorActivity.reportUiErrorInSnackbar(
|
||||||
|
BaseListFragment.this, "Opening channel fragment", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -306,7 +307,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
|
||||||
selectedItem.getUrl(),
|
selectedItem.getUrl(),
|
||||||
selectedItem.getName());
|
selectedItem.getName());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null,
|
ErrorActivity.reportUiErrorInSnackbar(BaseListFragment.this,
|
||||||
"Opening playlist fragment", e);
|
"Opening playlist fragment", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,8 +403,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
||||||
currentInfo.getParentChannelUrl(),
|
currentInfo.getParentChannelUrl(),
|
||||||
currentInfo.getParentChannelName());
|
currentInfo.getParentChannelName());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null,
|
ErrorActivity.reportUiErrorInSnackbar(this, "Opening channel fragment", e);
|
||||||
"Opening channel fragment", e);
|
|
||||||
}
|
}
|
||||||
} else if (DEBUG) {
|
} else if (DEBUG) {
|
||||||
Log.i(TAG, "Can't open parent channel because we got no channel URL");
|
Log.i(TAG, "Can't open parent channel because we got no channel URL");
|
||||||
|
|
|
@ -286,8 +286,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||||
NavigationHelper.openChannelFragment(getFM(), result.getServiceId(),
|
NavigationHelper.openChannelFragment(getFM(), result.getServiceId(),
|
||||||
result.getUploaderUrl(), result.getUploaderName());
|
result.getUploaderUrl(), result.getUploaderName());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null,
|
ErrorActivity.reportUiErrorInSnackbar(this, "Opening channel fragment", e);
|
||||||
"Opening channel fragment", e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,8 +257,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
||||||
try {
|
try {
|
||||||
service = NewPipe.getService(serviceId);
|
service = NewPipe.getService(serviceId);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(),
|
ErrorActivity.reportUiErrorInSnackbar(this,
|
||||||
requireActivity().findViewById(android.R.id.content),
|
|
||||||
"Getting service for id " + serviceId, e);
|
"Getting service for id " + serviceId, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
item.getUploaderUrl(),
|
item.getUploaderUrl(),
|
||||||
item.getUploaderName());
|
item.getUploaderName());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(activity, null, "Opening channel fragment", e);
|
ErrorActivity.reportUiErrorInSnackbar(activity, "Opening channel fragment", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class SubscriptionsImportFragment extends BaseFragment {
|
||||||
|
|
||||||
setupServiceVariables();
|
setupServiceVariables();
|
||||||
if (supportedSources.isEmpty() && currentServiceId != Constants.NO_SERVICE_ID) {
|
if (supportedSources.isEmpty() && currentServiceId != Constants.NO_SERVICE_ID) {
|
||||||
ErrorActivity.reportError(activity, null, null,
|
ErrorActivity.reportErrorInSnackbar(activity,
|
||||||
new ErrorInfo(new String[]{}, UserAction.SUBSCRIPTION_IMPORT_EXPORT,
|
new ErrorInfo(new String[]{}, UserAction.SUBSCRIPTION_IMPORT_EXPORT,
|
||||||
NewPipe.getNameOfService(currentServiceId),
|
NewPipe.getNameOfService(currentServiceId),
|
||||||
"Service does not support importing subscriptions",
|
"Service does not support importing subscriptions",
|
||||||
|
|
|
@ -153,7 +153,7 @@ public abstract class BaseImportExportService extends Service {
|
||||||
|
|
||||||
protected void stopAndReportError(final Throwable throwable, final String request) {
|
protected void stopAndReportError(final Throwable throwable, final String request) {
|
||||||
stopService();
|
stopService();
|
||||||
ErrorActivity.reportError(this, null, null, new ErrorInfo(
|
ErrorActivity.reportError(this, new ErrorInfo(
|
||||||
throwable, UserAction.SUBSCRIPTION_IMPORT_EXPORT, request));
|
throwable, UserAction.SUBSCRIPTION_IMPORT_EXPORT, request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
|
|
||||||
Toast.makeText(getContext(), R.string.export_complete_toast, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), R.string.export_complete_toast, Toast.LENGTH_SHORT).show();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null, "Exporting database", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Exporting database", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null, "Importing database", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Importing database", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
howManyDeleted -> Toast.makeText(context,
|
howManyDeleted -> Toast.makeText(context,
|
||||||
R.string.watch_history_states_deleted, Toast.LENGTH_SHORT).show(),
|
R.string.watch_history_states_deleted, Toast.LENGTH_SHORT).show(),
|
||||||
throwable -> ErrorActivity.reportError(context, SettingsActivity.class,
|
throwable -> ErrorActivity.reportError(context,
|
||||||
null, new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
||||||
"Delete playback states")));
|
"Delete playback states")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
howManyDeleted -> Toast.makeText(context,
|
howManyDeleted -> Toast.makeText(context,
|
||||||
R.string.watch_history_deleted, Toast.LENGTH_SHORT).show(),
|
R.string.watch_history_deleted, Toast.LENGTH_SHORT).show(),
|
||||||
throwable -> ErrorActivity.reportError(context, SettingsActivity.class,
|
throwable -> ErrorActivity.reportError(context,
|
||||||
null, new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
||||||
"Delete from history")));
|
"Delete from history")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
howManyDeleted -> { },
|
howManyDeleted -> { },
|
||||||
throwable -> ErrorActivity.reportError(context, SettingsActivity.class,
|
throwable -> ErrorActivity.reportError(context,
|
||||||
null, new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
||||||
"Clear orphaned records")));
|
"Clear orphaned records")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,8 +104,8 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
howManyDeleted -> Toast.makeText(context,
|
howManyDeleted -> Toast.makeText(context,
|
||||||
R.string.search_history_deleted, Toast.LENGTH_SHORT).show(),
|
R.string.search_history_deleted, Toast.LENGTH_SHORT).show(),
|
||||||
throwable -> ErrorActivity.reportError(context, SettingsActivity.class,
|
throwable -> ErrorActivity.reportError(context,
|
||||||
null, new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
|
||||||
"Delete search history")));
|
"Delete search history")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class SelectChannelFragment extends DialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull final Throwable exception) {
|
public void onError(@NonNull final Throwable exception) {
|
||||||
ErrorActivity.reportUiError(requireContext(), null,
|
ErrorActivity.reportUiErrorInSnackbar(SelectChannelFragment.this,
|
||||||
"Loading subscription", exception);
|
"Loading subscription", exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class SelectKioskFragment extends DialogFragment {
|
||||||
try {
|
try {
|
||||||
selectKioskAdapter = new SelectKioskAdapter();
|
selectKioskAdapter = new SelectKioskAdapter();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ErrorActivity.reportUiError(getActivity(), null, "Selecting kiosk", e);
|
ErrorActivity.reportUiErrorInSnackbar(this, "Selecting kiosk", e);
|
||||||
}
|
}
|
||||||
recyclerView.setAdapter(selectKioskAdapter);
|
recyclerView.setAdapter(selectKioskAdapter);
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class SelectPlaylistFragment extends DialogFragment {
|
||||||
|
|
||||||
protected void onError(final Throwable e) {
|
protected void onError(final Throwable e) {
|
||||||
final Activity activity = requireActivity();
|
final Activity activity = requireActivity();
|
||||||
ErrorActivity.reportError(activity, activity.getClass(), null, new ErrorInfo(e,
|
ErrorActivity.reportErrorInSnackbar(activity, new ErrorInfo(e,
|
||||||
UserAction.UI_ERROR, "Loading playlists"));
|
UserAction.UI_ERROR, "Loading playlists"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class SettingMigrations {
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
// save the version with the last successful migration and report the error
|
// save the version with the last successful migration and report the error
|
||||||
sp.edit().putInt(lastPrefVersionKey, currentVersion).apply();
|
sp.edit().putInt(lastPrefVersionKey, currentVersion).apply();
|
||||||
ErrorActivity.reportError(context, SettingMigrations.class, null, new ErrorInfo(
|
ErrorActivity.reportError(context, new ErrorInfo(
|
||||||
e,
|
e,
|
||||||
UserAction.PREFERENCES_MIGRATION,
|
UserAction.PREFERENCES_MIGRATION,
|
||||||
"Migrating preferences from version " + lastPrefVersion + " to "
|
"Migrating preferences from version " + lastPrefVersion + " to "
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class ChooseTabsFragment extends Fragment {
|
||||||
final Tab.Type type = typeFrom(tabId);
|
final Tab.Type type = typeFrom(tabId);
|
||||||
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
ErrorActivity.reportError(requireContext(), null, null,
|
ErrorActivity.reportErrorInSnackbar(this,
|
||||||
new ErrorInfo(new IllegalStateException("Tab id not found: " + tabId),
|
new ErrorInfo(new IllegalStateException("Tab id not found: " + tabId),
|
||||||
UserAction.SOMETHING_ELSE, "Choosing tabs on settings"));
|
UserAction.SOMETHING_ELSE, "Choosing tabs on settings"));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -483,7 +483,7 @@ public abstract class Tab {
|
||||||
final StreamingService service = NewPipe.getService(kioskServiceId);
|
final StreamingService service = NewPipe.getService(kioskServiceId);
|
||||||
kioskId = service.getKioskList().getDefaultKioskId();
|
kioskId = service.getKioskList().getDefaultKioskId();
|
||||||
} catch (final ExtractionException e) {
|
} catch (final ExtractionException e) {
|
||||||
ErrorActivity.reportError(context, null, null, new ErrorInfo(e,
|
ErrorActivity.reportErrorInSnackbar(context, new ErrorInfo(e,
|
||||||
UserAction.REQUESTED_KIOSK, "Loading default kiosk for selected service"));
|
UserAction.REQUESTED_KIOSK, "Loading default kiosk for selected service"));
|
||||||
}
|
}
|
||||||
return kioskId;
|
return kioskId;
|
||||||
|
|
|
@ -586,7 +586,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
||||||
service = ErrorInfo.SERVICE_NONE;
|
service = ErrorInfo.SERVICE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorActivity.reportError(mContext, null, null,
|
ErrorActivity.reportError(mContext,
|
||||||
new ErrorInfo(ErrorInfo.Companion.throwableToStringList(mission.errObject), action,
|
new ErrorInfo(ErrorInfo.Companion.throwableToStringList(mission.errObject), action,
|
||||||
service, request.toString(), reason, null));
|
service, request.toString(), reason, null));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue