mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Add AEAP info dialog & strings
This commit is contained in:
@@ -446,6 +446,8 @@
|
||||
<string name="tab_webxdc_empty_hint">Webxdc content shared in this chat will appear here.</string>
|
||||
<string name="media_preview">Media Preview</string>
|
||||
<string name="send_message">Send Message</string>
|
||||
<string name="aeap_addr_changed">%1$s changed their address from %2$s to %3$s</string>
|
||||
<string name="aeap_explanation">You changed your email address.\n\nContacts using Delta Chat will automatically replace you in the groups you send a message to.\n\nIf possible, set up your old email provider to forward all emails to your new email address.</string>
|
||||
|
||||
<!-- Connectivity -->
|
||||
<!-- Headline for the "Inbox" eg. in the "Connectivity" view -->
|
||||
|
||||
@@ -61,10 +61,13 @@ import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
|
||||
import org.thoughtcrime.securesms.util.views.ProgressDialog;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class RegistrationActivity extends BaseActionBarActivity implements DcEventCenter.DcEventDelegate {
|
||||
|
||||
private static final String AEAP_BLOG_LINK = "https://delta.chat/550/en/2022-07-10-aeap";
|
||||
|
||||
private enum VerificationType {
|
||||
EMAIL,
|
||||
SERVER,
|
||||
@@ -233,23 +236,20 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.do_register) {
|
||||
// "log in" button clicked - even if oauth2DeclinedByUser is true,
|
||||
// we will ask for oauth2 to allow reverting the decision.
|
||||
checkOauth2start().addListener(new ListenableFuture.Listener<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(Boolean oauth2started) {
|
||||
if(!oauth2started) {
|
||||
updateProviderInfo();
|
||||
onLogin();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(ExecutionException e) {
|
||||
updateProviderInfo();
|
||||
onLogin();
|
||||
}
|
||||
});
|
||||
String oldAddr = DcHelper.getSelfAddr(this);
|
||||
String newAddr = emailInput.getText().toString();
|
||||
if (!TextUtils.isEmpty(oldAddr)
|
||||
&& !TextUtils.equals(oldAddr.toLowerCase(Locale.ROOT), newAddr.toLowerCase(Locale.ROOT))) {
|
||||
// Tell the user about AEAP if they are about to change their address
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.aeap_explanation)
|
||||
.setNeutralButton(R.string.more_info_desktop, (d, w) -> IntentUtils.showBrowserIntent(this, AEAP_BLOG_LINK))
|
||||
.setNegativeButton(R.string.cancel, (d, w) -> {})
|
||||
.setPositiveButton(R.string.perm_continue, (d, w) -> do_register())
|
||||
.show();
|
||||
} else {
|
||||
do_register();
|
||||
}
|
||||
return true;
|
||||
} else if (id == android.R.id.home) {
|
||||
// handle close button click here
|
||||
@@ -259,6 +259,26 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void do_register() {
|
||||
// "log in" button clicked - even if oauth2DeclinedByUser is true,
|
||||
// we will ask for oauth2 to allow reverting the decision.
|
||||
checkOauth2start().addListener(new ListenableFuture.Listener<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(Boolean oauth2started) {
|
||||
if(!oauth2started) {
|
||||
updateProviderInfo();
|
||||
onLogin();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(ExecutionException e) {
|
||||
updateProviderInfo();
|
||||
onLogin();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -39,6 +39,7 @@ public class DcHelper {
|
||||
private static final String TAG = DcHelper.class.getSimpleName();
|
||||
|
||||
public static final String CONFIG_ADDRESS = "addr";
|
||||
public static final String CONFIG_CONFIGURED_ADDRESS = "configured_addr";
|
||||
public static final String CONFIG_MAIL_SERVER = "mail_server";
|
||||
public static final String CONFIG_MAIL_USER = "mail_user";
|
||||
public static final String CONFIG_MAIL_PASSWORD = "mail_pw";
|
||||
@@ -97,6 +98,10 @@ public class DcHelper {
|
||||
return dcContext.isConfigured() == 1;
|
||||
}
|
||||
|
||||
public static String getSelfAddr(Context context) {
|
||||
DcContext dcContext = getContext(context);
|
||||
return dcContext.getConfig(CONFIG_CONFIGURED_ADDRESS);
|
||||
}
|
||||
|
||||
public static int getInt(Context context, String key) {
|
||||
DcContext dcContext = getContext(context);
|
||||
@@ -207,6 +212,8 @@ public class DcHelper {
|
||||
// cmp. https://github.com/deltachat/deltachat-android/issues/2187
|
||||
dcContext.setStockTranslation(120, context.getString(R.string.qrshow_join_group_hint).replace("\"", ""));
|
||||
dcContext.setStockTranslation(121, context.getString(R.string.connectivity_not_connected));
|
||||
dcContext.setStockTranslation(122, context.getString(R.string.aeap_addr_changed));
|
||||
dcContext.setStockTranslation(123, context.getString(R.string.aeap_explanation));
|
||||
}
|
||||
|
||||
public static File getImexDir() {
|
||||
|
||||
@@ -45,7 +45,11 @@ public abstract class ProgressDialogAsyncTask<Params, Progress, Result> extends
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Result result) {
|
||||
if (progress != null) progress.dismiss();
|
||||
try {
|
||||
if (progress != null) progress.dismiss();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Context getContext() {
|
||||
|
||||
Reference in New Issue
Block a user