mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Option to show/hide unknown senders.
This commit is contained in:
@@ -215,6 +215,15 @@ JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrMailboxGetConfig(JNIEn
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxGetConfigInt(JNIEnv *env, jclass c, jlong hMailbox, jstring key, jint def)
|
||||
{
|
||||
CHAR_REF(key);
|
||||
jint ret = mrmailbox_get_config_int((mrmailbox_t*)hMailbox, keyPtr, def);
|
||||
CHAR_UNREF(key);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* MrMailbox - misc. */
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrMailboxGetInfo(JNIEnv *env, jclass c, jlong hMailbox)
|
||||
|
||||
@@ -299,6 +299,11 @@ public class ApplicationLoader extends Application {
|
||||
MrMailbox.hMailbox = MrMailbox.MrMailboxNew();
|
||||
MrMailbox.MrStockAddStr(2, LocaleController.getString("FromYou", R.string.FromYou));
|
||||
MrMailbox.MrStockAddStr(3, LocaleController.getString("Draft", R.string.Draft));
|
||||
MrMailbox.MrStockAddStr(4, LocaleController.getString("MemberSg", R.string.MemberSg));
|
||||
MrMailbox.MrStockAddStr(5, LocaleController.getString("MemberPl", R.string.MemberPl));
|
||||
MrMailbox.MrStockAddStr(6, LocaleController.getString("ContactSg", R.string.ContactSg));
|
||||
MrMailbox.MrStockAddStr(7, LocaleController.getString("ContactPl", R.string.ContactPl));
|
||||
MrMailbox.MrStockAddStr(8, LocaleController.getString("Strangers", R.string.Strangers));
|
||||
|
||||
applicationHandler = new Handler(applicationContext.getMainLooper());
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ public class MrMailbox {
|
||||
|
||||
public native static int MrMailboxSetConfig (long hMailbox, String key, String value); // value may be NULL
|
||||
public native static String MrMailboxGetConfig (long hMailbox, String key, String def); // def may be NULL, returns empty string as NULL
|
||||
public native static int MrMailboxGetConfigInt (long hMailbox, String key, int def); // def may be NULL, returns empty string as NULL
|
||||
|
||||
public native static String MrMailboxGetInfo (long hMailbox);
|
||||
public native static String MrMailboxExecute (long hMailbox, String cmd);
|
||||
|
||||
@@ -9,27 +9,20 @@
|
||||
package org.telegram.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.MrMailbox;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.RequestDelegate;
|
||||
import org.telegram.tgnet.TLObject;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.ui.ActionBar.ActionBar;
|
||||
@@ -49,6 +42,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
|
||||
private int privacySectionRow;
|
||||
private int blockedRow;
|
||||
private int showUnknownSendersRow;
|
||||
private int lastSeenRow;
|
||||
private int groupsRow;
|
||||
private int groupsDetailRow;
|
||||
@@ -65,35 +59,34 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
private int secretDetailRow;
|
||||
private int rowCount;
|
||||
|
||||
private int typeTextCheck = 3;
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
|
||||
ContactsController.getInstance().loadPrivacySettings();
|
||||
|
||||
// EDIT BY MR
|
||||
rowCount = 0;
|
||||
privacySectionRow = -1; //rowCount++;
|
||||
blockedRow = rowCount++;
|
||||
lastSeenRow = -1; // EDIT BY MR -- rowCount++;
|
||||
groupsRow = -1; // EDIT BY MR -- rowCount++;
|
||||
groupsDetailRow = -1; // EDIT BY MR -- rowCount++;
|
||||
securitySectionRow = -1; // EDIT BY MR -- rowCount++;
|
||||
passcodeRow = rowCount++;
|
||||
passwordRow = -1; // EDIT BY MR -- rowCount++;
|
||||
sessionsRow = -1; // EDIT BY MR -- rowCount++;
|
||||
sessionsDetailRow = -1; // EDIT BY MR -- rowCount++;
|
||||
deleteAccountSectionRow = -1; // EDIT BY MR -- rowCount++;
|
||||
deleteAccountRow = -1; // EDIT BY MR -- rowCount++;
|
||||
deleteAccountDetailRow = -1; // EDIT BY MR -- rowCount++;
|
||||
//if (MessagesController.getInstance().secretWebpagePreview != 1) { EDIT BY MR
|
||||
secretSectionRow = -1; // EDIT BY MR -- rowCount++;
|
||||
secretWebpageRow = rowCount++;
|
||||
secretDetailRow = rowCount++; // EDIT BY MR -- rowCount++;
|
||||
//} else { EDIT BY MR
|
||||
// secretSectionRow = -1;
|
||||
// secretWebpageRow = -1;
|
||||
// secretDetailRow = -1;
|
||||
//} /EDIT BY MR
|
||||
privacySectionRow = -1;
|
||||
passcodeRow = rowCount++;
|
||||
blockedRow = rowCount++;
|
||||
showUnknownSendersRow = rowCount++;
|
||||
lastSeenRow = -1;
|
||||
groupsRow = -1;
|
||||
groupsDetailRow = -1;
|
||||
securitySectionRow = -1;
|
||||
passwordRow = -1;
|
||||
sessionsRow = -1;
|
||||
sessionsDetailRow = -1;
|
||||
deleteAccountSectionRow = -1;
|
||||
deleteAccountRow = -1;
|
||||
deleteAccountDetailRow = -1;
|
||||
secretSectionRow = -1;
|
||||
secretWebpageRow = rowCount++;
|
||||
secretDetailRow = rowCount++;
|
||||
// /EDIT BY MR
|
||||
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.privacyRulesUpdated);
|
||||
|
||||
@@ -227,6 +220,19 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
((TextCheckCell) view).setChecked(MessagesController.getInstance().secretWebpagePreview == 1);
|
||||
}
|
||||
}
|
||||
else if( i==showUnknownSendersRow) {
|
||||
int oldval = MrMailbox.MrMailboxGetConfigInt(MrMailbox.hMailbox, "show_strangers", 0);
|
||||
if( oldval == 1 ) {
|
||||
MrMailbox.MrMailboxSetConfig(MrMailbox.hMailbox, "show_strangers", "0");
|
||||
}
|
||||
else {
|
||||
MrMailbox.MrMailboxSetConfig(MrMailbox.hMailbox, "show_strangers", "1");
|
||||
}
|
||||
MrMailbox.MrCallback(MrMailbox.MR_EVENT_MSGS_UPDATED, 0, 0);
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(oldval == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -315,6 +321,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
@Override
|
||||
public boolean isEnabled(int i) {
|
||||
return i == passcodeRow || i == passwordRow || i == blockedRow || i == sessionsRow || i == secretWebpageRow ||
|
||||
i==showUnknownSendersRow ||
|
||||
i == groupsRow && !ContactsController.getInstance().getLoadingGroupInfo() ||
|
||||
i == lastSeenRow && !ContactsController.getInstance().getLoadingLastSeenInfo() ||
|
||||
i == deleteAccountRow && !ContactsController.getInstance().getLoadingDeleteInfo();
|
||||
@@ -426,7 +433,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
} else if (i == secretSectionRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("SecretChat", R.string.SecretChat));
|
||||
}
|
||||
} else if (type == 3) {
|
||||
} else if (type == typeTextCheck) {
|
||||
if (view == null) {
|
||||
view = new TextCheckCell(mContext);
|
||||
view.setBackgroundColor(0xffffffff);
|
||||
@@ -435,6 +442,12 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
if (i == secretWebpageRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SecretWebPage", R.string.SecretWebPage), MessagesController.getInstance().secretWebpagePreview == 1, true);
|
||||
}
|
||||
else if( i==showUnknownSendersRow) {
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("Strangers", R.string.Strangers),
|
||||
LocaleController.getString("StrangersExplain", R.string.StrangersExplain),
|
||||
MrMailbox.MrMailboxGetConfigInt(MrMailbox.hMailbox, "show_strangers", 0)==0? false : true,
|
||||
false, true);
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
@@ -447,8 +460,8 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
return 1;
|
||||
} else if (i == securitySectionRow || i == deleteAccountSectionRow || i == privacySectionRow || i == secretSectionRow) {
|
||||
return 2;
|
||||
} else if (i == secretWebpageRow) {
|
||||
return 3;
|
||||
} else if (i == secretWebpageRow || i==showUnknownSendersRow) {
|
||||
return typeTextCheck;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -972,4 +972,11 @@
|
||||
<string name="NotSet">Nicht gesetzt</string>
|
||||
<string name="NewChat">Neuer Chat</string>
|
||||
<string name="NewSecretChat">Neuer geheimer Chat</string>
|
||||
<string name="ContactPl">_ Kontakte</string>
|
||||
<string name="ContactSg">_ Kontakt</string>
|
||||
<string name="MemberSg">_ Mitglied</string>
|
||||
<string name="MemberPl">_ Mitglieder</string>
|
||||
<string name="Stranger">Unbekannte Absender</string>
|
||||
<string name="Strangers">Unbekannte Benutzer</string>
|
||||
<string name="StrangersExplain">Nachrichten von unbekannten Adressen anzeigen</string>
|
||||
</resources>
|
||||
|
||||
@@ -972,4 +972,11 @@
|
||||
<string name="AboutThisProgram">About LibreChat</string>
|
||||
<string name="NotSet">Not set</string>
|
||||
<string name="NewChat">New chat</string>
|
||||
<string name="MemberSg">_ member</string>
|
||||
<string name="MemberPl">_ members</string>
|
||||
<string name="ContactSg">_ contact</string>
|
||||
<string name="ContactPl">_ contacts</string>
|
||||
<string name="Stranger">Unknown senders</string>
|
||||
<string name="Strangers">Unknown users</string>
|
||||
<string name="StrangersExplain">Show messages from unknown addresses</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user