Skip to content

Commit

Permalink
feat: Custom Search Hashtag Default Page
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Jun 27, 2024
1 parent 9c075fa commit 04e2ee0
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32953,8 +32953,18 @@ public void openHashtagSearch(String hashtag) {
}
if (ChatObject.isChannelAndNotMegaGroup(currentChat) && ChatObject.isPublic(currentChat) && searchingHashtag != null) {
defaultSearchPage = 2;

// ----- Nagram Hook Start -----
defaultSearchPage = NaConfig.INSTANCE.getSearchHashtagDefaultPageChannel().Int();
// ----- Nagram Hook End -----

} else {
defaultSearchPage = 0;

// ----- Nagram Hook Start -----
defaultSearchPage = NaConfig.INSTANCE.getSearchHashtagDefaultPageChat().Int();
// ----- Nagram Hook End -----

}
openSearchKeyboard = false;
if (searchItem != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ public class NekoChatSettingsActivity extends BaseNekoXSettingsActivity implemen
private final AbstractConfigCell repeatConfirmRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.repeatConfirm));
private final AbstractConfigCell dividerConfirms = cellGroup.appendCell(new ConfigCellDivider());

// search tag
private final AbstractConfigCell headerSearchTag = cellGroup.appendCell(new ConfigCellHeader(LocaleController.getString("SavedTagSearchHint")));
private final String[] searchPagesString = new String[]{
LocaleController.getString(R.string.SearchThisChat),
LocaleController.getString(R.string.SearchMyMessages),
LocaleController.getString(R.string.SearchPublicPosts),
};
private final AbstractConfigCell searchHashtagDefaultPageChannelRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getSearchHashtagDefaultPageChannel(), searchPagesString, null));
private final AbstractConfigCell searchHashtagDefaultPageChatRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getSearchHashtagDefaultPageChat(), searchPagesString, null));
private final AbstractConfigCell dividerSearchTag = cellGroup.appendCell(new ConfigCellDivider());

private ListAdapter listAdapter;
private ActionBarMenuItem menuItem;
private StickerSizeCell stickerSizeCell;
Expand Down
12 changes: 12 additions & 0 deletions TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,18 @@ object NaConfig {
ConfigItem.configTypeBool,
false
)
val searchHashtagDefaultPageChannel =
addConfig(
"SearchHashtagDefaultPageChannel",
ConfigItem.configTypeInt,
0
)
val searchHashtagDefaultPageChat =
addConfig(
"SearchHashtagDefaultPageChat",
ConfigItem.configTypeInt,
0
)

private fun addConfig(
k: String,
Expand Down
2 changes: 2 additions & 0 deletions TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,6 @@
您也可以使用纯文本,但请不要忘记使用转义符号。</string>
<string name="RegexFiltersAddError">正则表达式语法错误</string>
<string name="ShowTimeHint">点击消息时间显示详细信息</string>
<string name="SearchHashtagDefaultPageChannel">在频道点击标签默认搜索页面</string>
<string name="SearchHashtagDefaultPageChat">在其他对话点击标签默认搜索页面</string>
</resources>
2 changes: 2 additions & 0 deletions TMessagesProj/src/main/res/values/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,6 @@
You can also use plain text, but don\'t forget to escape brackets.</string>
<string name="RegexFiltersAddError">Regex syntax error</string>
<string name="ShowTimeHint">Click message time to display details</string>
<string name="SearchHashtagDefaultPageChannel">Channel Click Hashtag Default Search Page</string>
<string name="SearchHashtagDefaultPageChat">Chat Click Hashtag Default Search Page</string>
</resources>

0 comments on commit 04e2ee0

Please sign in to comment.