Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@master
Expand Down
5 changes: 3 additions & 2 deletions BetterChannelIcons/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version = "1.3.7"
version = "1.3.8"
description = "Adds an array of new channel icons"

aliucord.changelog.set(
"""
Improved {improved marginTop}
======================
* Added support for startswith:, endswith:, and contains: for channel name matching. -firepup650

* Discord v126.18
""".trimIndent()
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ public static Integer getChannelIcon(ChannelWrapper channel) throws Throwable {
if(icons.containsKey(name)) return com.aliucord.Utils.getResId(icons.get(name), "drawable");
if(name.endsWith("-logs") || name.endsWith("-log")) return R.e.ic_channels_24dp;
if(name.endsWith("-support") || name.endsWith("-help")) return R.e.ic_help_24dp;
for (String key : icons.keySet()) {
if (key.startsWith("startswith:") && name.startsWith(key.split(":", 2)[1])) return com.aliucord.Utils.getResId(icons.get(key), "drawable");
if (key.startsWith("endswith:") && name.endsWith(key.split(":", 2)[1])) return com.aliucord.Utils.getResId(icons.get(key), "drawable");
if (key.startsWith("contains:") && name.contains(key.split(":", 2)[1])) return com.aliucord.Utils.getResId(icons.get(key), "drawable");
}
if(channel.getId() == 824357609778708580L) return R.e.ic_theme_24dp;
if(channel.getType() == Channel.GUILD_VOICE) {
if(name.startsWith("discord.gg/") || name.startsWith(".gg/") || name.startsWith("gg/") || name.startsWith("dsc.gg/")) return R.e.ic_diag_link_24dp;
if(name.startsWith("member count") || name.startsWith("members") || name.startsWith("member count")) return R.e.ic_people_white_24dp;
return voiceChannelIcons.get(name);
if(name.startsWith("discord.gg/") || name.startsWith(".gg/") || name.startsWith("gg/") || name.startsWith("dsc.gg/")) return R.e.ic_diag_link_24dp;
if(name.startsWith("member count") || name.startsWith("members") || name.startsWith("member count")) return R.e.ic_people_white_24dp;
return voiceChannelIcons.get(name);
}
return channelIcons.get(name);
}
Expand Down Expand Up @@ -115,11 +120,11 @@ public static Map<String, String> convertToNewFormat(Map<String, Integer> icons)
Map<String, String> newIcons = new HashMap<>();
Map<Integer, String> iconNameMap = Constants.getIconNameMap();
List<String> keys = new ArrayList<>(icons.keySet());
for(String key : keys){
Integer iconIndex = icons.get(key);
Integer icon = Constants.getIcons().get(iconIndex);
newIcons.put(key, iconNameMap.get(icon));
for(String key : keys) {
Integer iconIndex = icons.get(key);
Integer icon = Constants.getIcons().get(iconIndex);
newIcons.put(key, iconNameMap.get(icon));
}
return newIcons;
}
}
}