mirror of https://github.com/M66B/FairEmail.git
Display start errors
This commit is contained in:
parent
0371a8f8b2
commit
d6792fcf2c
|
@ -531,6 +531,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
Log.logExtras(intent);
|
||||
super.startActivity(intent);
|
||||
} catch (Throwable ex) {
|
||||
if (this instanceof ActivityMain)
|
||||
throw ex;
|
||||
Helper.reportNoViewer(this, intent, ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,15 +21,19 @@ package eu.faircode.email;
|
|||
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
@ -240,7 +244,36 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getSupportFragmentManager(), ex);
|
||||
// Log.unexpectedError() won't work here
|
||||
Log.e(ex);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(ActivityMain.this);
|
||||
View dview = inflater.inflate(R.layout.dialog_unexpected, null);
|
||||
TextView tvError = dview.findViewById(R.id.tvError);
|
||||
|
||||
String message = Log.formatThrowable(ex, false);
|
||||
tvError.setText(message);
|
||||
|
||||
new AlertDialog.Builder(ActivityMain.this)
|
||||
.setView(dview)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setNeutralButton(R.string.menu_faq, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Uri uri = Helper.getSupportUri(ActivityMain.this, "Main:error")
|
||||
.buildUpon()
|
||||
.appendQueryParameter("message", Log.formatThrowable(ex, false))
|
||||
.build();
|
||||
Helper.view(ActivityMain.this, uri, true);
|
||||
}
|
||||
})
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue