Add support for select multiple request.#1130
Conversation
Add support for share selected Transaction as text and har file type. Add support for delete selected transaction only.
Fix Adapter parameters.
|
@cortinico what should i do next? |
| getClearDialogData(), | ||
| onPositiveClick = { | ||
| viewModel.clearTransactions() | ||
| if (selectedTransactions.isNotEmpty()) viewModel.clearSelectedTransactions(selectedTransactions) else viewModel.clearTransactions() |
There was a problem hiding this comment.
Can we move this logic inside hte ViewModel? Let's just have a viewModel.clearTransactions(selectedTransactions) that behaves differently wether the selectedTransactions is empty or not
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
|
Thanks @cortinico for review, i will try to fix that ASAP. |
|
@rohitjakhar Just to set expectations, I'll be able to take a look at this only next week. |
…are_multiple_request # Conflicts: # library/src/main/kotlin/com/chuckerteam/chucker/internal/ui/MainActivity.kt # library/src/main/kotlin/com/chuckerteam/chucker/internal/ui/transaction/TransactionAdapter.kt
|
@cortinico I resolve conflicts, test all corner cases. |
|
@rohitjakhar sorry I've been off for XMas vacation and haven't had time to look at this again. I can look into it this week so we can merge it. Could you fix the detekt/ktlint failures in the meanwhile? |
cortinico
left a comment
There was a problem hiding this comment.
Thanks again for sending this over @rohitjakhar
Please reformat the code with ./gradlew ktlintFormat as formatting is odd in a couple of places.
Also there is a problem with rotation of the device: the highlights is lost, but the selection still remains. Also clicking delete is deleting the wrong transaction. See the video I'm attaching.
| ) : ListAdapter< | ||
| HttpTransactionTuple, | ||
| TransactionAdapter.TransactionViewHolder>( | ||
| TransactionDiffCallback |
There was a problem hiding this comment.
The formatting here is odd and is causing ktlint to fail
| transactionId = transaction.id | ||
|
|
||
| if (selectedPos.find { it == adapterPosition } != null) { | ||
| itemView.setBackgroundColor(color400) |
There was a problem hiding this comment.
Let's not used this.
Let's create a new color resource as:
<color name="chucker_status_highlighted">#FF9800</color>| } | ||
| notifyItemChanged(adapterPosition) | ||
| true | ||
| } ?: kotlin.run { false } |
There was a problem hiding this comment.
| } ?: kotlin.run { false } | |
| } ?: false |
| context.theme.resolveAttribute( | ||
| android.R.attr.selectableItemBackground, | ||
| outValue, | ||
| true, | ||
| ) |
|
We're getting close to a mergeabble state :) |
Review Changes.
|
@cortinico I fix above issues. |
|
@cortinico can you give me next step to merge it? |
cortinico
left a comment
There was a problem hiding this comment.
Let's make sure the CI is green 👍 You also need to run ./gradlew ktlintFormat before resubmitting
| getExportDialogData( | ||
| if (viewModel.isItemSelected.value == true) { | ||
| R.string.chucker_export_text_selected_http_confirmation | ||
| } else { | ||
| R.string.chucker_export_text_http_confirmation | ||
| }, | ||
| ), |
There was a problem hiding this comment.
Because of this, the function is now getting too long and letting detekt fail:
> Task :library:detekt
/home/runner/work/chucker/chucker/library/src/main/kotlin/com/chuckerteam/chucker/internal/ui/MainActivity.kt:161:18: The function onOptionsItemSelected is too long (60). The maximum length is 60. [LongMethod]
You can see it in the CI signal.
Can you export this + lines 193/199 to separate functions
…into share_multiple_request
|
@cortinico I just update code and run ktlintformat. |
|
@cortinico should i supress TooManyFunctions ? |
Yes please do, it's reasonable to do so in |
|
@cortinico All are green |
|
@rohitjakhar thanks for following up. Sadly there are still a couple of bugs:
video-1718923534.mp4Can I ask you to look into those 2 problems and then we can merge it 👍 |
|
|
||
| suspend fun getAllTransactions(): List<HttpTransaction> { | ||
| return if (isItemSelected.value == true) { | ||
| RepositoryProvider.transaction().getSelectedTransactions(selectedItemId.value!!) |
There was a problem hiding this comment.
Can we add a safe check ? instead of !! ?
| RepositoryProvider.transaction().deleteAllTransactions() | ||
| if (isItemSelected.value == true) { | ||
| _isItemSelected.value = false | ||
| RepositoryProvider.transaction().deleteSelectedTransactions(selectedItemId.value!!) |
There was a problem hiding this comment.
Same as above, can we use safe check ? instead of !! ?
| fun getSelectedItem(): List<Int> { | ||
| return selectedPos | ||
| } |
There was a problem hiding this comment.
| fun getSelectedItem(): List<Int> { | |
| return selectedPos | |
| } | |
| fun getSelectedItem(): List<Int> = selectedPos |
|
@rohitjakhar if you can't continue working on this on please let me know 👍 perhaps @shivanandyadav11 you want to take it over? |
@cortinico Sure, I can pick this up. I'll start working on it this coming weekend. |
|
Let's wait for a couple of days for a response from @rohitjakhar |



📷 Screenshots
📄 Context
Issue link: Share Multiple Request at One Time
📝 Changes
Made change in TransactionAdapter to show color on Selected. Transaction, list of selected position, lambda for longClick on itemView.
Also Add query for get selected transaction data, delete transaction data.
🛠️ How to test
Long press at any transaction to select transaction, after that click other transaction to select them too.