fix location channel layout

This commit is contained in:
callebtc 2026-07-27 12:49:57 +02:00
parent fa43821cf4
commit 562aa787d6
2 changed files with 115 additions and 89 deletions

View File

@ -257,53 +257,129 @@ fun LocationChannelsSheet(
} }
} }
// Location channels: globe + title, geohash subtitle, nearby levels + teleport item(key = "location_channels_header") {
SheetIconSectionHeader(
icon = Icons.Outlined.Public,
title = stringResource(R.string.location_channels_heading),
subtitle = stringResource(R.string.location_channels_desc),
modifier = Modifier.padding(top = 20.dp)
)
}
selectedChannelOutsideNearby?.let { channel ->
item(key = "teleported_card") {
val coverage = coverageString(channel.geohash.length)
val name = bookmarkNames[channel.geohash]
val subtitle = "#${channel.geohash}$coverage" +
(name?.let { "${formattedNamePrefix(channel.level)}$it" } ?: "")
val participantCount = geohashParticipantCounts[channel.geohash] ?: 0
val isBookmarked = bookmarksStore.isBookmarked(channel.geohash)
Column {
AboutSectionLabel(text = stringResource(R.string.cd_teleported))
Surface(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = AboutHorizontalPadding),
color = palette.surface,
shape = AboutCardShape
) {
ChannelOptionRow(
title = geohashHashTitleWithCount(
channel.geohash,
participantCount
),
subtitle = subtitle,
isSelected = true,
participantCount = participantCount,
titleColor = standardGreen,
titleBold = participantCount > 0,
trailingContent = {
ChannelBookmarkButton(
bookmarked = isBookmarked,
onClick = {
bookmarksStore.toggle(channel.geohash)
}
)
},
onClick = {
locationManager.select(ChannelID.Location(channel))
onDismiss()
}
)
}
}
}
}
if (bookmarks.isNotEmpty()) {
item(key = "bookmarks_card") {
Column {
AboutSectionLabel(text = stringResource(R.string.bookmarked))
Surface(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = AboutHorizontalPadding),
color = palette.surface,
shape = AboutCardShape
) {
Column {
bookmarks.forEachIndexed { index, gh ->
if (index > 0) SheetCardDivider()
val level = levelForLength(gh.length)
val channel = GeohashChannel(level = level, geohash = gh)
val coverage = coverageString(gh.length)
val name = bookmarkNames[gh]
val subtitle = "#$gh$coverage" +
(name?.let { "${formattedNamePrefix(level)}$it" } ?: "")
val participantCount = geohashParticipantCounts[gh] ?: 0
ChannelOptionRow(
title = geohashHashTitleWithCount(gh, participantCount),
subtitle = subtitle,
isSelected = isChannelSelected(channel, selectedChannel),
participantCount = participantCount,
titleBold = participantCount > 0,
trailingContent = {
ChannelBookmarkButton(
bookmarked = true,
onClick = { bookmarksStore.toggle(gh) }
)
},
onClick = {
val inRegional =
availableChannels.any { it.geohash == gh }
locationManager.setTeleported(
!inRegional && availableChannels.isNotEmpty()
)
locationManager.select(ChannelID.Location(channel))
onDismiss()
}
)
LaunchedEffect(gh) {
bookmarksStore.resolveNameIfNeeded(gh)
}
}
}
}
}
}
}
// Nearby location channels and the control for teleporting somewhere new.
item(key = "channels_card") { item(key = "channels_card") {
Column { Column {
SheetIconSectionHeader( AboutSectionLabel(
icon = Icons.Outlined.Public, text = stringResource(R.string.location_channels_nearby)
title = stringResource(R.string.location_channels_heading),
subtitle = stringResource(R.string.location_channels_desc),
modifier = Modifier.padding(top = 20.dp)
) )
Surface( Surface(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = AboutHorizontalPadding) .padding(horizontal = AboutHorizontalPadding),
.padding(top = 10.dp),
color = palette.surface, color = palette.surface,
shape = AboutCardShape shape = AboutCardShape
) { ) {
Column { Column {
selectedChannelOutsideNearby?.let { channel ->
val coverage = coverageString(channel.geohash.length)
val name = bookmarkNames[channel.geohash]
val subtitle = "#${channel.geohash}$coverage" +
(name?.let { "${formattedNamePrefix(channel.level)}$it" } ?: "")
val participantCount = geohashParticipantCounts[channel.geohash] ?: 0
val isBookmarked = bookmarksStore.isBookmarked(channel.geohash)
ChannelOptionRow(
title = geohashTitleWithCount(channel, participantCount),
subtitle = subtitle,
isSelected = true,
participantCount = participantCount,
titleColor = standardGreen,
titleBold = participantCount > 0,
trailingContent = {
ChannelBookmarkButton(
bookmarked = isBookmarked,
onClick = { bookmarksStore.toggle(channel.geohash) }
)
},
onClick = {
locationManager.select(ChannelID.Location(channel))
onDismiss()
}
)
SheetCardDivider()
}
if (locationServicesEnabled) { if (locationServicesEnabled) {
if (nearbyChannels.isNotEmpty()) { if (nearbyChannels.isNotEmpty()) {
nearbyChannels.forEachIndexed { index, channel -> nearbyChannels.forEachIndexed { index, channel ->
@ -418,57 +494,6 @@ fun LocationChannelsSheet(
} }
} }
if (bookmarks.isNotEmpty()) {
item(key = "bookmarks_card") {
Column {
AboutSectionLabel(text = stringResource(R.string.bookmarked))
Surface(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = AboutHorizontalPadding),
color = palette.surface,
shape = AboutCardShape
) {
Column {
bookmarks.forEachIndexed { index, gh ->
if (index > 0) SheetCardDivider()
val level = levelForLength(gh.length)
val channel = GeohashChannel(level = level, geohash = gh)
val coverage = coverageString(gh.length)
val name = bookmarkNames[gh]
val subtitle = "#$gh$coverage" +
(name?.let { "${formattedNamePrefix(level)}$it" } ?: "")
val participantCount = geohashParticipantCounts[gh] ?: 0
ChannelOptionRow(
title = geohashHashTitleWithCount(gh, participantCount),
subtitle = subtitle,
isSelected = isChannelSelected(channel, selectedChannel),
participantCount = participantCount,
titleBold = participantCount > 0,
trailingContent = {
ChannelBookmarkButton(
bookmarked = true,
onClick = { bookmarksStore.toggle(gh) }
)
},
onClick = {
val inRegional = availableChannels.any { it.geohash == gh }
locationManager.setTeleported(
!inRegional && availableChannels.isNotEmpty()
)
locationManager.select(ChannelID.Location(channel))
onDismiss()
}
)
LaunchedEffect(gh) { bookmarksStore.resolveNameIfNeeded(gh) }
}
}
}
}
}
}
item(key = "tor_routing") { item(key = "tor_routing") {
val torProvider = remember { ArtiTorManager.getInstance() } val torProvider = remember { ArtiTorManager.getInstance() }
val torAvailable = remember { torProvider.isTorAvailable() } val torAvailable = remember { torProvider.isTorAvailable() }

View File

@ -303,7 +303,8 @@
<!-- Location channels sheet --> <!-- Location channels sheet -->
<string name="location_channels_title">Channels</string> <string name="location_channels_title">Channels</string>
<string name="location_channels_heading">Location Channels</string> <string name="location_channels_heading">Location Channels</string>
<string name="location_channels_desc">Chat nearby over geohash channels. Only a coarse location is shared, never exact GPS.</string> <string name="location_channels_desc">Chat by coarse location. Never shares exact GPS.</string>
<string name="location_channels_nearby">Nearby</string>
<string name="mesh_section_subtitle">Offline mesh via Bluetooth. No internet required.</string> <string name="mesh_section_subtitle">Offline mesh via Bluetooth. No internet required.</string>
<!-- Location channels sheet: sections and Tor routing --> <!-- Location channels sheet: sections and Tor routing -->