view user history in chat

This commit is contained in:
NekoInverter 2020-01-11 11:50:05 +08:00 committed by Riko Sakurauchi
parent 83fd50b770
commit 8cc6285d47
No known key found for this signature in database
GPG Key ID: 25AC0345B92902AF
8 changed files with 43 additions and 5 deletions

View File

@ -729,7 +729,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private final static int chat_enc_timer = 13;
private final static int chat_menu_attach = 14;
private final static int clear_history = 15;
private final static int delete_history = 92;
private final static int delete_history = 26;
private final static int delete_chat = 16;
private final static int share_contact = 17;
private final static int mute = 18;
@ -13726,6 +13726,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean allowPrpr = currentUser != null
|| (currentChat != null && ChatObject.canSendMessages(currentChat) && !currentChat.broadcast &&
message.isFromUser());
boolean allowViewHistory = currentUser == null
&& (currentChat != null && !currentChat.broadcast && message.isFromUser());
if (allowRepeat) {
items.add(LocaleController.getString("Repeat", R.string.Repeat));
options.add(94);
@ -13733,9 +13736,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (allowPrpr && NekoConfig.showPrPr) {
items.add(LocaleController.getString("Prpr", R.string.Prpr));
options.add(27);
options.add(92);
icons.add(R.drawable.msg_prpr);
}
if (allowViewHistory && NekoConfig.showViewHistory) {
items.add(LocaleController.getString("ViewUserHistory", R.string.ViewHistory));
options.add(90);
icons.add(R.drawable.menu_recent);
}
}
if (allowUnpin) {
items.add(LocaleController.getString("UnpinMessage", R.string.UnpinMessage));
@ -14685,7 +14693,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
break;
} case 27: {
} case 90: {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.from_id);
getMediaDataController().searchMessagesInChat("", dialog_id, mergeDialogId, classGuid, 0, user);
showMessagesSearchListView(true);
break;
} case 92: {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.from_id);
if (user.username != null) {
SendMessagesHelper.getInstance(currentAccount).sendMessage("/prpr@" + user.username, dialog_id, selectedObject, null, false,

View File

@ -25,6 +25,7 @@ public class NekoConfig {
public static boolean showAddToSavedMessages = true;
public static boolean showReport = false;
public static boolean showPrPr = true;
public static boolean showViewHistory = true;
public static boolean showAdminActions = true;
public static boolean showChangePermissions = true;
public static boolean showDeleteDownloadedFile = true;
@ -59,6 +60,7 @@ public class NekoConfig {
editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages);
editor.putBoolean("showReport", showReport);
editor.putBoolean("showPrPr", showPrPr);
editor.putBoolean("showViewHistory", showViewHistory);
editor.putBoolean("showAdminActions", showAdminActions);
editor.putBoolean("showChangePermissions", showChangePermissions);
editor.putBoolean("showDeleteDownloadedFile", showDeleteDownloadedFile);
@ -94,6 +96,7 @@ public class NekoConfig {
showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true);
showReport = preferences.getBoolean("showReport", false);
showPrPr = preferences.getBoolean("showPrPr", true);
showViewHistory = preferences.getBoolean("showViewHistory", true);
showAdminActions = preferences.getBoolean("showAdminActions", true);
showChangePermissions = preferences.getBoolean("showChangePermissions", true);
showDeleteDownloadedFile = preferences.getBoolean("showDeleteDownloadedFile", true);
@ -122,6 +125,14 @@ public class NekoConfig {
}
public static void toggleShowViewHistory() {
showViewHistory = !showViewHistory;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showViewHistory", showViewHistory);
editor.commit();
}
public static void toggleShowPrPr() {
showPrPr = !showPrPr;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);

View File

@ -63,6 +63,7 @@ public class NekoSettingsActivity extends BaseFragment {
private int showAddToSavedMessagesRow;
private int showReportRow;
private int showPrPrRow;
private int showViewHistoryRow;
private int showAdminActionsRow;
private int showChangePermissionsRow;
private int showDeleteDownloadedFileRow;
@ -180,6 +181,11 @@ public class NekoSettingsActivity extends BaseFragment {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.showPrPr);
}
} else if (position == showViewHistoryRow) {
NekoConfig.toggleShowViewHistory();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.showViewHistory);
}
} else if (position == showReportRow) {
NekoConfig.toggleShowReport();
if (view instanceof TextCheckCell) {
@ -335,6 +341,7 @@ public class NekoSettingsActivity extends BaseFragment {
messageMenuRow = rowCount++;
showAddToSavedMessagesRow = rowCount++;
showPrPrRow = rowCount++;
showViewHistoryRow = rowCount++;
showReportRow = rowCount++;
showAdminActionsRow = rowCount++;
showChangePermissionsRow = rowCount++;
@ -454,6 +461,8 @@ public class NekoSettingsActivity extends BaseFragment {
textCell.setTextAndCheck(LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages), NekoConfig.showAddToSavedMessages, true);
} else if (position == showPrPrRow) {
textCell.setTextAndCheck(LocaleController.getString("Prpr", R.string.Prpr), NekoConfig.showPrPr, true);
} else if (position == showViewHistoryRow) {
textCell.setTextAndCheck(LocaleController.getString("ViewHistory", R.string.ViewHistory), NekoConfig.showViewHistory, true);
} else if (position == showReportRow) {
textCell.setTextAndCheck(LocaleController.getString("ReportChat", R.string.ReportChat), NekoConfig.showReport, true);
} else if (position == showAdminActionsRow) {
@ -518,7 +527,7 @@ public class NekoSettingsActivity extends BaseFragment {
return position == hidePhoneRow || position == inappCameraRow || position == ignoreBlockedRow ||
position == useSystemEmojiRow || position == ipv6Row || position == typefaceRow ||
position == showChangePermissionsRow || position == showDeleteDownloadedFileRow || position == showAdminActionsRow || position == showReportRow ||
position == showPrPrRow || position == showAddToSavedMessagesRow ||
position == showPrPrRow || position == showViewHistoryRow || position == showAddToSavedMessagesRow ||
position == nameOrderRow || position == forceTabletRow || position == mapPreviewRow ||
position == xmasRow || position == newYearRow || position == newYearEveRow || position == fireworksRow ||
position == transparentStatusBarRow || position == hideProxySponsorChannelRow;
@ -569,7 +578,7 @@ public class NekoSettingsActivity extends BaseFragment {
} else if (position == ipv6Row || position == hidePhoneRow || position == inappCameraRow ||
position == showAddToSavedMessagesRow || position == showPrPrRow || position == showReportRow ||
position == showAdminActionsRow || position == showChangePermissionsRow || position == showDeleteDownloadedFileRow ||
position == transparentStatusBarRow || position == hideProxySponsorChannelRow ||
position == transparentStatusBarRow || position == hideProxySponsorChannelRow || position == showViewHistoryRow ||
position == ignoreBlockedRow || position == useSystemEmojiRow || position == typefaceRow ||
position == forceTabletRow || position == xmasRow || position == newYearRow || position == newYearEveRow ||
position == fireworksRow) {

View File

@ -50,4 +50,5 @@
<string name="TestBackendOn">Questo account si connetterà al server di test.</string>
<string name="TestBackendOff">Questo account si connetterà al server principale.</string>
<string name="HideProxySponsorChannel">Nascondi canale sponsor proxy</string>
<string name="ViewHistory">Visualizza la cronologia</string>
</resources>

View File

@ -50,4 +50,5 @@
<string name="TestBackendOn">このアカウントは、テストバックエンドに接続します。</string>
<string name="TestBackendOff">このアカウントは、本番バックエンドに接続します。</string>
<string name="HideProxySponsorChannel">Proxy sponsor channel を非表示</string>
<string name="ViewHistory">履歴を見る</string>
</resources>

View File

@ -50,4 +50,5 @@
<string name="TestBackendOn">此账户将连接至测试后端服务器。</string>
<string name="TestBackendOff">此账户将连接至生产后端服务器。</string>
<string name="HideProxySponsorChannel">隐藏代理赞助商频道</string>
<string name="ViewHistory">显示历史消息</string>
</resources>

View File

@ -50,4 +50,5 @@
<string name="TestBackendOn">此賬戶將連接至測試後端伺服器。</string>
<string name="TestBackendOff">此賬戶將連接至生產後端伺服器。</string>
<string name="HideProxySponsorChannel">隱藏代理贊助商頻道</string>
<string name="ViewHistory">顯示歷史消息</string>
</resources>

View File

@ -55,4 +55,5 @@
<string name="TestBackendOn">This account will connect to the test backend.</string>
<string name="TestBackendOff">This account will connect to the production backend.</string>
<string name="HideProxySponsorChannel">Hide proxy sponsor channel</string>
<string name="ViewHistory">View history</string>
</resources>