ui: better icon for channel filter, remove separate copy button from link on iOS (#6856)

This commit is contained in:
Evgeny authored and GitHub committed 2026-04-22 08:35:13 +01:00
1 parent 360aba3e8f
commit b40c5a4f3e
3 files changed
+27 -35

No files matched your search

@@ -839,11 +839,11 @@ struct TagsView: View {
nil
}
let active = tag == selectedPresetTag
let (icon, text) = presetTagLabel(tag: tag, active: active)
let (icon, menuIcon, text) = presetTagLabel(tag: tag, active: active)
let color: Color = active ? .accentColor : .secondary
HStack(spacing: 4) {
Image(systemName: icon)
Image(systemName: menuIcon ?? icon)
.foregroundColor(color)
ZStack {
Text(text).fontWeight(.semibold).foregroundColor(.clear)
@@ -886,9 +886,9 @@ struct TagsView: View {
Button {
setActiveFilter(filter: .presetTag(tag))
} label: {
let (systemName, text) = presetTagLabel(tag: tag, active: tag == selectedPresetTag)
let (icon, _, text) = presetTagLabel(tag: tag, active: tag == selectedPresetTag)
HStack {
Image(systemName: systemName)
Image(systemName: icon)
Text(text)
}
}
@@ -896,8 +896,8 @@ struct TagsView: View {
}
} label: {
if let tag = selectedPresetTag, tag.сollapse {
let (systemName, _) = presetTagLabel(tag: tag, active: true)
Image(systemName: systemName)
let (icon, menuIcon, _) = presetTagLabel(tag: tag, active: true)
Image(systemName: menuIcon ?? icon)
.foregroundColor(.accentColor)
} else {
Image(systemName: "list.bullet")
@@ -907,15 +907,15 @@ struct TagsView: View {
.frame(minWidth: 28)
}
private func presetTagLabel(tag: PresetTag, active: Bool) -> (String, LocalizedStringKey) {
private func presetTagLabel(tag: PresetTag, active: Bool) -> (item: String, menu: String?, label: LocalizedStringKey) {
switch tag {
case .groupReports: (active ? "flag.fill" : "flag", "Reports")
case .favorites: (active ? "star.fill" : "star", "Favorites")
case .contacts: (active ? "person.fill" : "person", "Contacts")
case .groups: (active ? "person.2.fill" : "person.2", "Groups")
case .channels: (active ? "antenna.radiowaves.left.and.right.circle.fill" : "antenna.radiowaves.left.and.right.circle", "Channels")
case .business: (active ? "briefcase.fill" : "briefcase", "Businesses")
case .notes: (active ? "folder.fill" : "folder", "Notes")
case .groupReports: (item: active ? "flag.fill" : "flag", menu: nil, label: "Reports")
case .favorites: (item: active ? "star.fill" : "star", menu: nil, label: "Favorites")
case .contacts: (item: active ? "person.fill" : "person", menu: nil, label: "Contacts")
case .groups: (item: active ? "person.2.fill" : "person.2", menu: nil, label: "Groups")
case .channels: (item: active ? "antenna.radiowaves.left.and.right.circle.fill" : "antenna.radiowaves.left.and.right", menu: "antenna.radiowaves.left.and.right", label: "Channels")
case .business: (item: active ? "briefcase.fill" : "briefcase", menu: nil, label: "Businesses")
case .notes: (item: active ? "folder.fill" : "folder", menu: nil, label: "Notes")
}
}
@@ -338,14 +338,6 @@ private struct InviteView: View {
HStack(spacing: 8) {
let link = connLinkInvitation.simplexChatUri(short: showShortLink)
linkTextView(link)
Button {
UIPasteboard.general.string = link
setInvitationUsed()
} label: {
Image(systemName: "doc.on.doc")
.padding(.top, -7)
.padding(.horizontal, 8)
}
Button {
showShareSheet(items: [link])
setInvitationUsed()
@@ -1144,7 +1144,7 @@ private fun ExpandedTagFilterView(tag: PresetTagKind) {
is ActiveFilter.PresetTag -> af.tag == tag
else -> false
}
val (icon, text) = presetTagLabel(tag, active)
val (icon, menuIcon, text) = presetTagLabel(tag, active)
val color = if (active) MaterialTheme.colors.primary else MaterialTheme.colors.secondary
Row(
@@ -1164,7 +1164,7 @@ private fun ExpandedTagFilterView(tag: PresetTagKind) {
horizontalArrangement = Arrangement.Center
) {
Icon(
painterResource(icon),
painterResource(menuIcon ?: icon),
stringResource(text),
Modifier.size(18.sp.toDp()),
tint = color
@@ -1206,9 +1206,9 @@ private fun CollapsedTagsFilterView(searchText: MutableState<TextFieldValue>) {
contentAlignment = Alignment.Center
) {
if (selectedPresetTag != null) {
val (icon, text) = presetTagLabel(selectedPresetTag, true)
val (icon, menuIcon, text) = presetTagLabel(selectedPresetTag, true)
Icon(
painterResource(icon),
painterResource(menuIcon ?: icon),
stringResource(text),
Modifier.size(18.sp.toDp()),
tint = MaterialTheme.colors.primary
@@ -1254,7 +1254,7 @@ fun ItemPresetFilterAction(
showMenu: MutableState<Boolean>,
onCloseMenuAction: MutableState<(() -> Unit)>
) {
val (icon, text) = presetTagLabel(presetTag, active)
val (icon, _, text) = presetTagLabel(presetTag, active)
ItemAction(
stringResource(text),
painterResource(icon),
@@ -1336,15 +1336,15 @@ fun presetTagMatchesChat(tag: PresetTagKind, chatInfo: ChatInfo, chatStats: Chat
}
}
private fun presetTagLabel(tag: PresetTagKind, active: Boolean): Pair<ImageResource, StringResource> =
private fun presetTagLabel(tag: PresetTagKind, active: Boolean): Triple<ImageResource, ImageResource?, StringResource> =
when (tag) {
PresetTagKind.GROUP_REPORTS -> (if (active) MR.images.ic_flag_filled else MR.images.ic_flag) to MR.strings.chat_list_group_reports
PresetTagKind.FAVORITES -> (if (active) MR.images.ic_star_filled else MR.images.ic_star) to MR.strings.chat_list_favorites
PresetTagKind.CONTACTS -> (if (active) MR.images.ic_person_filled else MR.images.ic_person) to MR.strings.chat_list_contacts
PresetTagKind.GROUPS -> (if (active) MR.images.ic_group_filled else MR.images.ic_group) to MR.strings.chat_list_groups
PresetTagKind.CHANNELS -> (if (active) MR.images.ic_bigtop_updates_circle_filled else MR.images.ic_bigtop_updates) to MR.strings.chat_list_channels
PresetTagKind.BUSINESS -> (if (active) MR.images.ic_work_filled else MR.images.ic_work) to MR.strings.chat_list_businesses
PresetTagKind.NOTES -> (if (active) MR.images.ic_folder_closed_filled else MR.images.ic_folder_closed) to MR.strings.chat_list_notes
PresetTagKind.GROUP_REPORTS -> Triple(if (active) MR.images.ic_flag_filled else MR.images.ic_flag, null, MR.strings.chat_list_group_reports)
PresetTagKind.FAVORITES -> Triple(if (active) MR.images.ic_star_filled else MR.images.ic_star, null, MR.strings.chat_list_favorites)
PresetTagKind.CONTACTS -> Triple(if (active) MR.images.ic_person_filled else MR.images.ic_person, null, MR.strings.chat_list_contacts)
PresetTagKind.GROUPS -> Triple(if (active) MR.images.ic_group_filled else MR.images.ic_group, null, MR.strings.chat_list_groups)
PresetTagKind.CHANNELS -> Triple(if (active) MR.images.ic_bigtop_updates_circle_filled else MR.images.ic_bigtop_updates, MR.images.ic_bigtop_updates, MR.strings.chat_list_channels)
PresetTagKind.BUSINESS -> Triple(if (active) MR.images.ic_work_filled else MR.images.ic_work, null, MR.strings.chat_list_businesses)
PresetTagKind.NOTES -> Triple(if (active) MR.images.ic_folder_closed_filled else MR.images.ic_folder_closed, null, MR.strings.chat_list_notes)
}
private fun presetCanBeCollapsed(tag: PresetTagKind): Boolean = when (tag) {