mirror of https://github.com/M66B/FairEmail.git
Check if internet on setup
This commit is contained in:
parent
af0fde7cb3
commit
d2b349a7b3
|
@ -29,6 +29,8 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -349,6 +351,11 @@ public class FragmentGmail extends FragmentBase {
|
||||||
if (TextUtils.isEmpty(password))
|
if (TextUtils.isEmpty(password))
|
||||||
throw new IllegalArgumentException(context.getString(R.string.title_no_password));
|
throw new IllegalArgumentException(context.getString(R.string.title_no_password));
|
||||||
|
|
||||||
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo ani = (cm == null ? null : cm.getActiveNetworkInfo());
|
||||||
|
if (ani == null || !ani.isConnected())
|
||||||
|
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
|
||||||
|
|
||||||
int at = user.indexOf('@');
|
int at = user.indexOf('@');
|
||||||
String username = user.substring(0, at);
|
String username = user.substring(0, at);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -453,6 +455,11 @@ public class FragmentOAuth extends FragmentBase {
|
||||||
if (!Helper.EMAIL_ADDRESS.matcher(primaryEmail).matches())
|
if (!Helper.EMAIL_ADDRESS.matcher(primaryEmail).matches())
|
||||||
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, primaryEmail));
|
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, primaryEmail));
|
||||||
|
|
||||||
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo ani = (cm == null ? null : cm.getActiveNetworkInfo());
|
||||||
|
if (ani == null || !ani.isConnected())
|
||||||
|
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
|
||||||
|
|
||||||
Log.i("OAuth email=" + primaryEmail);
|
Log.i("OAuth email=" + primaryEmail);
|
||||||
for (Pair<String, String> identity : identities)
|
for (Pair<String, String> identity : identities)
|
||||||
Log.i("OAuth identity=" + identity.first + "/" + identity.second);
|
Log.i("OAuth identity=" + identity.first + "/" + identity.second);
|
||||||
|
|
|
@ -21,6 +21,8 @@ package eu.faircode.email;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -274,6 +276,11 @@ public class FragmentQuickSetup extends FragmentBase {
|
||||||
if (TextUtils.isEmpty(smtp_fingerprint))
|
if (TextUtils.isEmpty(smtp_fingerprint))
|
||||||
smtp_fingerprint = null;
|
smtp_fingerprint = null;
|
||||||
|
|
||||||
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo ani = (cm == null ? null : cm.getActiveNetworkInfo());
|
||||||
|
if (ani == null || !ani.isConnected())
|
||||||
|
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
|
||||||
|
|
||||||
EmailProvider provider = EmailProvider.fromEmail(context, email, EmailProvider.Discover.ALL);
|
EmailProvider provider = EmailProvider.fromEmail(context, email, EmailProvider.Discover.ALL);
|
||||||
args.putBoolean("appPassword", provider.appPassword);
|
args.putBoolean("appPassword", provider.appPassword);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue