Generalize setup help

pull/160/head
M66B 5 years ago
parent dfed6cd8b0
commit 2d76845fe0

@ -377,7 +377,8 @@ You might get the alert "*Please log in via your web browser*".
This happens when Google considers the network that connects you to the internet (this could be a VPN) to to be unsafe.
This can be prevented by using an app specific password.
See [here](https://support.google.com/mail/accounts/answer/78754) for troubleshooting.
See [here](https://support.google.com/mail/answer/7126229) for Google's instructions
and [here](https://support.google.com/mail/accounts/answer/78754) for troubleshooting.
See [this FAQ](#user-content-faq111) about why OAuth is not being used.
@ -522,6 +523,8 @@ Searching messages is a pro feature.
To use Outlook or Hotmail with two factor authentication enabled, you need to create an app password.
See [here](https://support.microsoft.com/en-us/help/12409/microsoft-account-app-passwords-two-step-verification) for the details.
See [here](https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040) for Microsoft's instructions.
<br />
<a name="faq15"></a>

@ -55,10 +55,10 @@ import java.util.concurrent.Future;
public class EmailProvider {
public String name;
public int order;
public int keepalive;
public String link;
public int order;
public String type;
public int keepalive;
public String imap_host;
public boolean imap_starttls;
public int imap_port;
@ -66,8 +66,7 @@ public class EmailProvider {
public int smtp_port;
public boolean smtp_starttls;
public UserType user = UserType.EMAIL;
public String helpUrl = null;
public StringBuilder documentation = null; // html
public StringBuilder documentation; // html
enum UserType {LOCAL, EMAIL}
@ -117,7 +116,6 @@ public class EmailProvider {
throw new IllegalAccessException(name);
} else if (eventType == XmlPullParser.END_TAG) {
if ("provider".equals(xml.getName())) {
addSpecials(context, provider);
result.add(provider);
provider = null;
}
@ -146,9 +144,11 @@ public class EmailProvider {
}
static EmailProvider fromDomain(Context context, String domain) throws IOException {
EmailProvider autoconfig = fromDomainInternal(context, domain);
EmailProvider autoconfig = _fromDomain(context, domain);
// Always prefer built-in profiles (ISPDB is not always correct)
// Always prefer built-in profiles
// - ISPDB is not always correct
// - documentation links
List<EmailProvider> providers = loadProfiles(context);
for (EmailProvider provider : providers)
if (provider.imap_host.equals(autoconfig.imap_host) ||
@ -160,23 +160,23 @@ public class EmailProvider {
return autoconfig;
}
private static EmailProvider fromDomainInternal(Context context, String domain) throws IOException {
private static EmailProvider _fromDomain(Context context, String domain) throws IOException {
try {
// Assume the provider knows best
Log.i("Provider from DNS domain=" + domain);
return addSpecials(context, fromDNS(context, domain));
return fromDNS(context, domain);
} catch (Throwable ex) {
Log.w(ex);
try {
// Check ISPDB
Log.i("Provider from ISPDB domain=" + domain);
return addSpecials(context, fromISPDB(context, domain));
return fromISPDB(context, domain);
} catch (Throwable ex1) {
Log.w(ex1);
try {
// Scan ports
Log.i("Provider from template domain=" + domain);
return addSpecials(context, fromTemplate(context, domain));
return fromTemplate(context, domain);
} catch (Throwable ex2) {
Log.w(ex2);
throw new UnknownHostException(context.getString(R.string.title_setup_no_settings, domain));
@ -501,20 +501,6 @@ public class EmailProvider {
provider.documentation.append("<a href=\"").append(href).append("\">").append(title).append("</a>");
}
private static EmailProvider addSpecials(Context context, EmailProvider provider) {
if ("imap.gmail.com".equals(provider.imap_host))
provider.helpUrl = Helper.FAQ_URI + "#user-content-faq6";
if (provider.imap_host.endsWith("office365.com") ||
provider.imap_host.endsWith("live.com"))
provider.helpUrl = Helper.FAQ_URI + "#user-content-faq14";
if (provider.imap_host.endsWith("yahoo.com"))
provider.helpUrl = Helper.FAQ_URI + "#user-content-faq88";
return provider;
}
private static SRVRecord lookup(Context context, String record) throws TextParseException, UnknownHostException {
Lookup lookup = new Lookup(record, Type.SRV);

@ -1077,8 +1077,8 @@ public class FragmentAccount extends FragmentBase {
tvError.setVisibility(View.VISIBLE);
final EmailProvider provider = (EmailProvider) spProvider.getSelectedItem();
if (provider != null && provider.helpUrl != null) {
Uri uri = Uri.parse(provider.helpUrl);
if (provider != null && provider.link != null) {
Uri uri = Uri.parse(provider.link);
btnHelp.setTag(uri);
btnHelp.setVisibility(View.VISIBLE);
}
@ -1093,7 +1093,7 @@ public class FragmentAccount extends FragmentBase {
public void run() {
if (provider != null && provider.documentation != null)
scroll.smoothScrollTo(0, tvInstructions.getBottom());
else if (provider != null && provider.helpUrl != null)
else if (provider != null && provider.link != null)
scroll.smoothScrollTo(0, btnHelp.getBottom());
else
scroll.smoothScrollTo(0, tvError.getBottom());

@ -769,8 +769,8 @@ public class FragmentIdentity extends FragmentBase {
tvError.setVisibility(View.VISIBLE);
final EmailProvider provider = (EmailProvider) spProvider.getSelectedItem();
if (provider != null && provider.helpUrl != null) {
Uri uri = Uri.parse(provider.helpUrl);
if (provider != null && provider.link != null) {
Uri uri = Uri.parse(provider.link);
btnHelp.setTag(uri);
btnHelp.setVisibility(View.VISIBLE);
}
@ -785,7 +785,7 @@ public class FragmentIdentity extends FragmentBase {
public void run() {
if (provider != null && provider.documentation != null)
scroll.smoothScrollTo(0, tvInstructions.getBottom());
else if (provider != null && provider.helpUrl != null)
else if (provider != null && provider.link != null)
scroll.smoothScrollTo(0, btnHelp.getBottom());
else
scroll.smoothScrollTo(0, tvError.getBottom());

@ -238,8 +238,8 @@ public class FragmentQuickSetup extends FragmentBase {
String[] dparts = email.split("@");
EmailProvider provider = EmailProvider.fromDomain(context, dparts[1]);
if (provider.helpUrl != null)
args.putString("help", provider.helpUrl);
if (provider.link != null)
args.putString("link", provider.link);
if (provider.documentation != null)
args.putString("documentation", provider.documentation.toString());
@ -442,8 +442,8 @@ public class FragmentQuickSetup extends FragmentBase {
tvError.setVisibility(View.VISIBLE);
}
if (args.containsKey("help")) {
Uri uri = Uri.parse(args.getString("help"));
if (args.containsKey("link")) {
Uri uri = Uri.parse(args.getString("link"));
btnHelp.setTag(uri);
btnHelp.setVisibility(View.VISIBLE);
}
@ -458,7 +458,7 @@ public class FragmentQuickSetup extends FragmentBase {
public void run() {
if (args.containsKey("documentation"))
scroll.smoothScrollTo(0, tvInstructions.getBottom());
else if (args.containsKey("help"))
else if (args.containsKey("link"))
scroll.smoothScrollTo(0, btnHelp.getBottom());
else if (tvError.getVisibility() == View.VISIBLE)
scroll.smoothScrollTo(0, tvError.getBottom());

@ -2,7 +2,7 @@
<providers>
<provider
name="Gmail"
link="https://support.google.com/mail/answer/7126229"
link="https://github.com/M66B/FairEmail/blob/master/FAQ.md#user-content-faq6"
order="1"
type="com.google">
<imap
@ -16,7 +16,7 @@
</provider>
<provider
name="Outlook/Office365"
link="https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040"
link="https://github.com/M66B/FairEmail/blob/master/FAQ.md#user-content-faq14"
order="2">
<imap
host="outlook.office365.com"
@ -43,7 +43,7 @@
<!-- no IMAP IDLE -->
<provider
name="Yahoo!"
link="https://help.yahoo.com/kb/SLN4075.html">
link="https://github.com/M66B/FairEmail/blob/master/FAQ.md#user-content-faq88">
<imap
host="imap.mail.yahoo.com"
port="993"

Loading…
Cancel
Save