Skip to content

Commit bc21311

Browse files
authored
Merge pull request #232 from Taewan-P/fix/select-mode
Fix selection mode behavior
2 parents 74de25b + 0554900 commit bc21311

File tree

13 files changed

+46
-52
lines changed

13 files changed

+46
-52
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ android {
1919
applicationId = "dev.chungjungsoo.gptmobile"
2020
minSdk = 31
2121
targetSdk = 36
22-
versionCode = 16
23-
versionName = "0.7.0"
22+
versionCode = 17
23+
versionName = "0.7.1"
2424

2525
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2626
vectorDrawables {

app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/database/entity/PlatformV2.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import androidx.room.ColumnInfo
44
import androidx.room.Entity
55
import androidx.room.PrimaryKey
66
import dev.chungjungsoo.gptmobile.data.model.ClientType
7-
import java.util.UUID
7+
import java.util.*
88

99
@Entity(tableName = "platform_v2")
1010
data class PlatformV2(

app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/dto/anthropic/request/MessageRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import kotlinx.serialization.SerialName
66
import kotlinx.serialization.Serializable
77

88
/**
9-
When certain value is used in the future, use @EncodeDefault or remove default values
9+
When certain value is used in the future, use @EncodeDefault or remove default values
1010
*/
1111

1212
@OptIn(ExperimentalSerializationApi::class)

app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/dto/openai/request/ResponsesRequest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ object ResponseInputContentSerializer : KSerializer<ResponseInputContent> {
116116

117117
override fun deserialize(decoder: Decoder): ResponseInputContent {
118118
val jsonDecoder = decoder as JsonDecoder
119-
val element = jsonDecoder.decodeJsonElement()
120-
return when (element) {
119+
return when (val element = jsonDecoder.decodeJsonElement()) {
121120
is JsonPrimitive -> ResponseInputContent.Text(element.jsonPrimitive.content)
122121

123122
is JsonArray -> {

app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/network/OpenAIAPIImpl.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package dev.chungjungsoo.gptmobile.data.network
22

3-
import android.util.Log
43
import dev.chungjungsoo.gptmobile.data.ModelConstants
54
import dev.chungjungsoo.gptmobile.data.dto.openai.request.ChatCompletionRequest
65
import dev.chungjungsoo.gptmobile.data.dto.openai.request.ResponsesRequest

app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatBubble.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import androidx.compose.ui.input.pointer.pointerInput
4141
import androidx.compose.ui.res.painterResource
4242
import androidx.compose.ui.res.stringResource
4343
import androidx.compose.ui.res.vectorResource
44-
import androidx.compose.ui.text.style.TextAlign
4544
import androidx.compose.ui.text.style.TextOverflow
4645
import androidx.compose.ui.tooling.preview.Preview
4746
import androidx.compose.ui.unit.dp

app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ class ChatViewModel @Inject constructor(
364364
val sortedAssistantMessages = assistantMessages.map { assistantMessage ->
365365
assistantMessage.sortedWith(
366366
compareBy(
367-
{ it -> platformOrderMap[it.platformType] ?: Int.MAX_VALUE },
368-
{ it -> it.platformType }
367+
{ platformOrderMap[it.platformType] ?: Int.MAX_VALUE },
368+
{ it.platformType }
369369
)
370370
)
371371
}

app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/home/HomeScreen.kt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.height
1111
import androidx.compose.foundation.layout.heightIn
1212
import androidx.compose.foundation.layout.padding
1313
import androidx.compose.foundation.layout.systemBarsPadding
14-
import androidx.compose.foundation.layout.width
1514
import androidx.compose.foundation.layout.widthIn
1615
import androidx.compose.foundation.layout.wrapContentHeight
1716
import androidx.compose.foundation.lazy.LazyColumn
@@ -142,15 +141,17 @@ fun HomeScreen(
142141
)
143142
},
144143
floatingActionButton = {
145-
NewChatButton(expanded = listState.isScrollingUp(), onClick = {
146-
val enabledApiTypes = platformState.filter { it.enabled }.map { it.uid }
147-
if (enabledApiTypes.size == 1) {
148-
// Navigate to new chat directly if only one platform is enabled
149-
navigateToNewChat(enabledApiTypes)
150-
} else {
151-
homeViewModel.openSelectModelDialog()
152-
}
153-
})
144+
if (!chatListState.isSelectionMode && !chatListState.isSearchMode) {
145+
NewChatButton(expanded = listState.isScrollingUp(), onClick = {
146+
val enabledApiTypes = platformState.filter { it.enabled }.map { it.uid }
147+
if (enabledApiTypes.size == 1) {
148+
// Navigate to new chat directly if only one platform is enabled
149+
navigateToNewChat(enabledApiTypes)
150+
} else {
151+
homeViewModel.openSelectModelDialog()
152+
}
153+
})
154+
}
154155
}
155156
) { innerPadding ->
156157
LazyColumn(
@@ -180,8 +181,10 @@ fun HomeScreen(
180181
.fillMaxWidth()
181182
.combinedClickable(
182183
onLongClick = {
183-
homeViewModel.enableSelectionMode()
184-
homeViewModel.selectChat(idx)
184+
if (!chatListState.isSearchMode) {
185+
homeViewModel.enableSelectionMode()
186+
homeViewModel.selectChat(idx)
187+
}
185188
},
186189
onClick = {
187190
if (chatListState.isSelectionMode) {

app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/home/HomeViewModel.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ class HomeViewModel @Inject constructor(
138138
fun disableSearchMode() {
139139
_chatListState.update { it.copy(isSearchMode = false) }
140140
_searchQuery.update { "" }
141-
fetchChats()
142141
}
143142

144143
fun enableSelectionMode() {

app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setting/SettingViewModelV2.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import androidx.lifecycle.ViewModel
44
import androidx.lifecycle.viewModelScope
55
import dagger.hilt.android.lifecycle.HiltViewModel
66
import dev.chungjungsoo.gptmobile.data.database.entity.PlatformV2
7-
import dev.chungjungsoo.gptmobile.data.model.ClientType
87
import dev.chungjungsoo.gptmobile.data.repository.SettingRepository
98
import javax.inject.Inject
109
import kotlinx.coroutines.flow.MutableStateFlow

0 commit comments

Comments
 (0)