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

Handle 'Support older Anki Versions' when exporting #17536

Open
NameLessGO opened this issue Dec 2, 2024 · 12 comments · May be fixed by #17626
Open

Handle 'Support older Anki Versions' when exporting #17536

NameLessGO opened this issue Dec 2, 2024 · 12 comments · May be fixed by #17626

Comments

@NameLessGO
Copy link

NameLessGO commented Dec 2, 2024

This bug report is crossposted from Anking repo to Ankidroid

@david-allison
Copy link
Member

The difference is due to this option being enabled in AnkiDroid by default. image

To confirm, enable the option, export on desktop and compare the size with the AnkiDroid export.

  • abdo

@david-allison david-allison self-assigned this Dec 4, 2024
@david-allison david-allison changed the title [BUG]: Size difference when exporting Anking note type: Anki vs Ankidroid Handle 'Support older Anki Versions' when exporting Dec 4, 2024
@david-allison
Copy link
Member

david-allison commented Dec 4, 2024

This can be implemented in the following file

https://github.com/ankidroid/Anki-Android/blob/09a45359ec70fd76c76d7115b14a4127aea6cc13/AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt

Steps

1) remove = true defaults on legacy in the underlying functions

fun Collection.exportAnkiPackage(
outPath: String,
withScheduling: Boolean,
withDeckConfigs: Boolean,
withMedia: Boolean,
limit: ExportLimit,
legacy: Boolean = true

fun Collection.exportCollectionPackage(
outPath: String,
includeMedia: Boolean,
legacy: Boolean = true
) {

2) Add a Checkbox to obtain the user-selected value in the Fragment

Use TR. to obtain the translated string which Anki Desktop uses

Only show the checkbox when either collection/deck exports are selected

3) Ensure the default user-selected value is false for both apkg and colpkg

4) Add appropriate unit tests

Suggestions:

  • Checkbox is only available on two selections
  • Checkbox defaults to false
  • Checkbox value is provided to the correct export functions (true/false)

@MorenoTropical

This comment has been minimized.

@david-allison david-allison removed their assignment Dec 6, 2024
@david-allison

This comment has been minimized.

@Haz3-jolt
Copy link
Contributor

Hi I'd like to work on this

@Haz3-jolt
Copy link
Contributor

Haz3-jolt commented Dec 18, 2024

Ok some help with this if possible,

  1. What is the user-selected value we are looking for? is it the value for legacy being true or false?
  2. For the string, I can't find the relevant string for this? Does it already exist or are we supposed to create it?

@david-allison
Copy link
Member

david-allison commented Dec 18, 2024

Image

Anki Desktop default is disabled (for both apkg and colpkg). legacy = false is the default.

The string is: TR.exportingSupportOlderAnkiVersions()

@Haz3-jolt
Copy link
Contributor

Cool got it.

@Haz3-jolt
Copy link
Contributor

@david-allison I'm pretty much done implementing the feature except for the unit Tests, I'll have to create a new Unit test file since ExportDialogFragment does not have unit Tests yet. Is it fine to put a @NeedsTest decorator and push in a separate PR?

@david-allison
Copy link
Member

david-allison commented Dec 18, 2024

Sure! Alternately, you can create the test file in the PR

@Haz3-jolt
Copy link
Contributor

Sure! Got some other work for tomorrow, so might not be able to get to it immediately, but wanted something out so I can get feedback.

@david-allison
Copy link
Member

No rush! Your time is greatly appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants