Check for Microsoft send error

This commit is contained in:
M66B 2023-02-05 10:46:38 +01:00
parent 0a327f5777
commit bfaef41a25
2 changed files with 19 additions and 5 deletions

View File

@ -203,7 +203,7 @@ public class Helper {
static final String PRIVACY_URI = "https://github.com/M66B/FairEmail/blob/master/PRIVACY.md";
static final String TUTORIALS_URI = "https://github.com/M66B/FairEmail/tree/master/tutorials#main";
static final String XDA_URI = "https://forum.xda-developers.com/showthread.php?t=3824168";
static final String SUPPORT_URI = "https://contact.faircode.eu/";
static final String SUPPORT_URI = "https://contact.faircode.eu/?product=fairemailsupport";
static final String TEST_URI = "https://play.google.com/apps/testing/" + BuildConfig.APPLICATION_ID;
static final String BIMI_PRIVACY_URI = "https://datatracker.ietf.org/doc/html/draft-brotman-ietf-bimi-guidance-03#section-7.4";
static final String LT_PRIVACY_URI = "https://languagetool.org/legal/privacy";
@ -1223,7 +1223,6 @@ public class Helper {
return Uri.parse(SUPPORT_URI)
.buildUpon()
.appendQueryParameter("product", "fairemailsupport")
.appendQueryParameter("version", BuildConfig.VERSION_NAME + BuildConfig.REVISION)
.appendQueryParameter("locale", slocale.toString())
.appendQueryParameter("language", language == null ? "" : language)

View File

@ -33,6 +33,7 @@ import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.Uri;
import android.os.PowerManager;
import android.os.SystemClock;
import android.text.TextUtils;
@ -92,6 +93,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
private static final int PROGRESS_UPDATE_INTERVAL = 1000; // milliseconds
static final int PI_SEND = 1;
static final int PI_FIX = 2;
@Override
public void onCreate() {
@ -460,11 +462,24 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
try {
int tries_left = (unrecoverable ? 0 : RETRY_MAX - op.tries);
NotificationManager nm = Helper.getSystemService(this, NotificationManager.class);
if (NotificationHelper.areNotificationsEnabled(nm))
if (NotificationHelper.areNotificationsEnabled(nm)) {
NotificationCompat.Builder builder = getNotificationError(
MessageHelper.formatAddressesShort(message.to), ex, tries_left);
if (ex instanceof AuthenticationFailedException &&
ex.getMessage() != null &&
ex.getMessage().contains("535 5.7.3 Authentication unsuccessful")) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Helper.SUPPORT_URI))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent piFix = PendingIntentCompat.getActivity(
this, PI_FIX, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(piFix);
}
nm.notify("send:" + message.id,
NotificationHelper.NOTIFICATION_TAGGED,
getNotificationError(
MessageHelper.formatAddressesShort(message.to), ex, tries_left).build());
builder.build());
}
} catch (Throwable ex1) {
Log.w(ex1);
}