Fixes issue #174 - Error message for 2FA accounts is unhelpful
This commit is contained in:
parent
02cb619f2f
commit
1ea3f21f40
|
@ -15,6 +15,7 @@
|
||||||
package fr.gouv.etalab.mastodon.activities;
|
package fr.gouv.etalab.mastodon.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
@ -22,8 +23,13 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.TextInputLayout;
|
import android.support.design.widget.TextInputLayout;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.SpannableString;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.text.style.UnderlineSpan;
|
||||||
|
import android.text.util.Linkify;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -49,6 +55,7 @@ import fr.gouv.etalab.mastodon.client.HttpsConnection;
|
||||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
|
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||||
|
import static fr.gouv.etalab.mastodon.helper.Helper.convertDpToPixel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,6 +193,33 @@ public class LoginActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
final TextView login_issue = findViewById(R.id.login_issue);
|
||||||
|
SpannableString content = new SpannableString(getString(R.string.issue_login_title));
|
||||||
|
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
||||||
|
login_issue.setText(content);
|
||||||
|
login_issue.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
|
||||||
|
builder.setTitle(R.string.issue_login_title);
|
||||||
|
TextView message = new TextView(LoginActivity.this);
|
||||||
|
final SpannableString s =
|
||||||
|
new SpannableString(getText(R.string.issue_login_message));
|
||||||
|
Linkify.addLinks(s, Linkify.WEB_URLS);
|
||||||
|
message.setText(s);
|
||||||
|
message.setPadding((int) convertDpToPixel(10,LoginActivity.this), (int) convertDpToPixel(10,LoginActivity.this), (int) convertDpToPixel(10,LoginActivity.this), (int) convertDpToPixel(10,LoginActivity.this));
|
||||||
|
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
builder.setView(message);
|
||||||
|
builder.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setIcon(android.R.drawable.ic_dialog_alert).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,13 @@
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:id="@+id/login_issue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/login_button"
|
android:id="@+id/login_button"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
|
|
|
@ -72,6 +72,13 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:id="@+id/login_issue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/login_button"
|
android:id="@+id/login_button"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
|
|
|
@ -468,4 +468,15 @@
|
||||||
<string name="account_moved_to">%1$s has moved to %2$s</string>
|
<string name="account_moved_to">%1$s has moved to %2$s</string>
|
||||||
|
|
||||||
<string name="show_boost_count">Show boosts/favourites count</string>
|
<string name="show_boost_count">Show boosts/favourites count</string>
|
||||||
|
|
||||||
|
<string name="issue_login_title">Authentication does not work?</string>
|
||||||
|
<string name="issue_login_message">
|
||||||
|
<b>Here are some checks that might help:</b>\n\n
|
||||||
|
- Check there is no spelling mistakes in the instance name\n\n
|
||||||
|
- Check that your instance is not down\n\n
|
||||||
|
- If you use the two-factor authentication (2FA), please use the link at the bottom (once the instance name is filled)\n\n
|
||||||
|
- You can also use this link without using the 2FA\n\n
|
||||||
|
- If it still does not work, please raise an issue on Github at https://github.com/stom79/mastalab/issues
|
||||||
|
</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue