mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-08-08 06:46:11 +00:00
Merge ca992d169c9dea9b3d330a80624011863044f930 into 094657efa0aabbb6f71c9050149d1d01aee96400
This commit is contained in:
commit
7fd29e04e4
@ -1,5 +1,6 @@
|
||||
package com.bitchat.android.ui
|
||||
|
||||
import com.bitchat.android.geohash.ChannelID
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.security.MessageDigest
|
||||
@ -16,7 +17,8 @@ class ChannelManager(
|
||||
private val state: ChatState,
|
||||
private val messageManager: MessageManager,
|
||||
private val dataManager: DataManager,
|
||||
private val coroutineScope: CoroutineScope
|
||||
private val coroutineScope: CoroutineScope,
|
||||
private val onSwitchToMeshLocation: () -> Unit = {}
|
||||
) {
|
||||
|
||||
// Channel encryption and security
|
||||
@ -109,6 +111,8 @@ class ChannelManager(
|
||||
fun switchToChannel(channel: String?) {
|
||||
state.setCurrentChannel(channel)
|
||||
state.setSelectedPrivateChatPeer(null)
|
||||
state.setSelectedLocationChannel(ChannelID.Mesh)
|
||||
onSwitchToMeshLocation()
|
||||
|
||||
// Clear unread count
|
||||
channel?.let { ch ->
|
||||
|
||||
@ -140,7 +140,17 @@ class ChatViewModel(
|
||||
private val conversationListPreferences =
|
||||
com.bitchat.android.services.ConversationListPreferences.getInstance(getApplication())
|
||||
private val messageManager = MessageManager(state)
|
||||
private val channelManager = ChannelManager(state, messageManager, dataManager, viewModelScope)
|
||||
private val channelManager = ChannelManager(
|
||||
state,
|
||||
messageManager,
|
||||
dataManager,
|
||||
viewModelScope,
|
||||
onSwitchToMeshLocation = {
|
||||
com.bitchat.android.geohash.LocationChannelManager
|
||||
.getInstance(getApplication())
|
||||
.select(com.bitchat.android.geohash.ChannelID.Mesh)
|
||||
}
|
||||
)
|
||||
|
||||
// Create Noise session delegate for clean dependency injection
|
||||
private val noiseSessionDelegate = object : NoiseSessionDelegate {
|
||||
|
||||
@ -163,6 +163,23 @@ class CommandProcessorTest() {
|
||||
assertEquals(0, chatState.getMessagesValue().size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `join command leaves active geohash selection for mesh channel routing`() {
|
||||
chatState.setSelectedLocationChannel(
|
||||
ChannelID.Location(GeohashChannel(GeohashChannelLevel.REGION, "9q"))
|
||||
)
|
||||
|
||||
commandProcessor.processCommand(
|
||||
command = "/join backchannel",
|
||||
meshService = meshService,
|
||||
myPeerID = "peer-id",
|
||||
onSendMessage = { _, _, _ -> },
|
||||
viewModel = null
|
||||
)
|
||||
|
||||
assertEquals("#backchannel", chatState.getCurrentChannelValue())
|
||||
assertEquals(ChannelID.Mesh, chatState.selectedLocationChannel.value)
|
||||
|
||||
@Test
|
||||
fun `clearSuggestions hides the command suggestion popup`() {
|
||||
// Typing "/" opens the command popup.
|
||||
@ -187,5 +204,6 @@ class CommandProcessorTest() {
|
||||
commandProcessor.clearSuggestions()
|
||||
assertFalse(chatState.getShowMentionSuggestionsValue())
|
||||
assertTrue(chatState.getMentionSuggestionsValue().isEmpty())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2147,6 +2147,9 @@
|
||||
<artifact name="aapt2-9.3.1-15703166-osx.jar">
|
||||
<sha256 value="1e35bc2ce18c3aae840be2a29659ce50d6043e907a44d98ee1cf375d044fa29c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="aapt2-9.3.1-15703166-windows.jar">
|
||||
<sha256 value="b1006ecec7e5936257e95e97f3eba7ef439d3e44178967cc048f86c9119fb231" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="aapt2-9.3.1-15703166.pom">
|
||||
<sha256 value="edb82dcbe738ca78b31612cb307bf99e5f02f25c8125048f933e792fd7778beb" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
@ -4903,6 +4906,9 @@
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit" name="junit-bom" version="5.9.2">
|
||||
<artifact name="junit-bom-5.9.2.module">
|
||||
<sha256 value="ab137ba5a8e32c9b066bf9126a1c76dd5614b724ba5c0b02549772b5e9f4cf1f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-bom-5.9.2.pom">
|
||||
<sha256 value="2ed07d65845131f5336a86476c9a4056b59d0b58b9815ab3679bb0f36f35f705" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user