Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Drag & Drop Support for TEXT/CSV Files in DeckPicker #17865

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SanjaySargam
Copy link
Contributor

Purpose / Description

Implement Drag&Drop TEXT file in DeckPicker

Fixes

Approach

Modify the drag-and-drop handler to check for .txt and .csv files. If valid, call the onSelectedCsvForImport function to handle the import process.

How Has This Been Tested?

Physical Device ( Redmi Note 11 )

WhatsApp.Video.2025-01-25.at.1.46.32.AM.mp4

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, cheers!

Is this feasible to test, or could a @NeedsTest be added

AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt Outdated Show resolved Hide resolved
@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Jan 26, 2025
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to re-request approval if only minor changes are made, still good to go :)

@@ -99,6 +100,11 @@ object ImportUtils {
fun isFileAValidDeck(fileName: String): Boolean =
FileImporter.hasExtension(fileName, "apkg") || FileImporter.hasExtension(fileName, "colpkg")

fun isValidTextOrDataFile(fileName: String): Boolean =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use mime types for that? They aren't used for apkg and colpkg because they don't have a mime type that is consistently recognized by Android, but that isn't the case for CSV files

@BrayanDSO BrayanDSO added the Needs Author Reply Waiting for a reply from the original author label Jan 29, 2025
@SanjaySargam SanjaySargam removed the Needs Author Reply Waiting for a reply from the original author label Jan 30, 2025
@SanjaySargam
Copy link
Contributor Author

Unit tests deferred for a faster merge; will be added later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Second Approval Has one approval, one more approval to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Implement Drag&Drop TEXT file in DeckPicker
3 participants