Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

refactor(DeckPicker): simplify type inference and null handling

Open rochelledsz opened this issue 1 month ago • 1 comments

Purpose / Description

Refactoring DeckPickerViewModel.kt to remove redundant types and use idiomatic Kotlin null-safety.

Fixes

  • Part of #13282

Approach

  • Type Inference: Removed <OpChanges> from undoableOp (compiler infers this automatically).
  • Null Safety: Replaced if (auth == null) with the Elvis operator ?: for cleaner null safety checks.

How Has This Been Tested?

  • Built the project successfully in Android Studio (Otter).
  • Verified that Android Studio no longer shows warnings for these lines.

Learning (optional, can help others)

Describe the research stage

Links to blog posts, patterns, libraries or addons used to solve this problem

Checklist

Please, go through these checks before submitting the PR.

  • [x] 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
  • [x] 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

rochelledsz avatar Dec 06 '25 00:12 rochelledsz

Built the project successfully in Android Studio (Otter). Verified that Android Studio no longer shows warnings for these lines.

Did you test the functionality still works? opChanges has cases where this would cause a crash

david-allison avatar Dec 06 '25 00:12 david-allison