0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00

Mark TODOs as to be looked at BEFORE-MERGE or BEFORE-RELEASE

As requested. Terminology:

* TODO BEFORE-MERGE means that the TODO SHOULD be resolved before the
  commit is merged into main;

* TODO BEFORE-RELEASE means that the TODO SHOULD be resolved before the
  release of the new stable version;

* If the tag is followed by an exclamation mark, e.g.
  TODO BEFORE-MERGE!, replace SHOULD with MUST, as per RFC 2119.
This commit is contained in:
oakkitten 2023-04-09 17:27:34 +01:00 committed by David Allison
parent c9562999ed
commit 7134cca7bf
2 changed files with 14 additions and 13 deletions

View File

@ -614,7 +614,7 @@ open class DeckPicker :
* relying instead on modifying it directly and/or using [onPrepareOptionsMenu]. * relying instead on modifying it directly and/or using [onPrepareOptionsMenu].
* Note an issue with the latter: https://github.com/ankidroid/Anki-Android/issues/7755 * Note an issue with the latter: https://github.com/ankidroid/Anki-Android/issues/7755
* *
* TODO Add tooltip text to the image button. * TODO BEFORE-RELEASE Add tooltip text to the image button.
* Menu items normally have titles that are shown on long tap. * Menu items normally have titles that are shown on long tap.
* As this menu item delegates the UI to the action view, it is up to that to handle presses. * As this menu item delegates the UI to the action view, it is up to that to handle presses.
* When we decide on the text, use `TooltipCompat.setTooltipText` on the button to set it. * When we decide on the text, use `TooltipCompat.setTooltipText` on the button to set it.
@ -634,7 +634,7 @@ open class DeckPicker :
this.progress = (progress.ratio * Int.MAX_VALUE).toInt() this.progress = (progress.ratio * Int.MAX_VALUE).toInt()
} }
// TODO Perhaps handle the cases of success & failure differently? // TODO BEFORE-RELEASE Perhaps handle the cases of success & failure differently?
is MigrationService.Progress.Done -> { is MigrationService.Progress.Done -> {
updateMenuState() updateMenuState()
updateMenuFromState(menu) updateMenuFromState(menu)

View File

@ -67,7 +67,7 @@ class MigrationService : ServiceWithALifecycleScope(), ServiceWithASimpleBinder<
private var serviceHasBeenStarted = false private var serviceHasBeenStarted = false
// TODO Emit the according `flowOfProgress` here. // TODO BEFORE-MERGE! Emit the according `flowOfProgress` here.
// I think it would simplify things if we could always bind to the service, // I think it would simplify things if we could always bind to the service,
// even if `onStartCommand` is not going to be called. // even if `onStartCommand` is not going to be called.
// This way the UI elements that need service progress can always get it // This way the UI elements that need service progress can always get it
@ -84,9 +84,9 @@ class MigrationService : ServiceWithALifecycleScope(), ServiceWithASimpleBinder<
serviceHasBeenStarted = true serviceHasBeenStarted = true
// TODO `MigrateUserData.createInstance` is doing I/O and can throw I/O errors. // TODO BEFORE-MERGE `MigrateUserData.createInstance` is doing I/O and can throw I/O errors.
// Figure out what's going on and move all I/O into a thread. // Figure out what's going on and move all I/O into a thread.
// TODO Previous code re-threw MigrateUserData.MissingDirectoryException. // TODO BEFORE-MERGE Previous code re-threw MigrateUserData.MissingDirectoryException.
// Figure out why. // Figure out why.
val migrateUserDataTask = try { val migrateUserDataTask = try {
MigrateUserData.createInstance(AnkiDroidApp.getSharedPrefs(this)) MigrateUserData.createInstance(AnkiDroidApp.getSharedPrefs(this))
@ -96,7 +96,8 @@ class MigrationService : ServiceWithALifecycleScope(), ServiceWithASimpleBinder<
return START_STICKY return START_STICKY
} }
// TODO Instead of returning `null,` have `MigrateUserData.createInstance` throw an exception. // TODO BEFORE-MERGE Instead of returning `null`,
// have `MigrateUserData.createInstance` throw an exception.
if (migrateUserDataTask == null) { if (migrateUserDataTask == null) {
Timber.w("MigrationService started when a migration was not taking place") Timber.w("MigrationService started when a migration was not taking place")
stopSelf() stopSelf()
@ -117,7 +118,7 @@ class MigrationService : ServiceWithALifecycleScope(), ServiceWithASimpleBinder<
flowOfProgress.tryEmit(Progress.Transferring(transferredBytes, totalBytesToTransfer)) flowOfProgress.tryEmit(Progress.Transferring(transferredBytes, totalBytesToTransfer))
}) })
// TODO This is probably not supposed to be here // TODO BEFORE-MERGE This is probably not supposed to be here
AnkiDroidApp.getSharedPrefs(this@MigrationService).edit { AnkiDroidApp.getSharedPrefs(this@MigrationService).edit {
remove(PREF_MIGRATION_DESTINATION) remove(PREF_MIGRATION_DESTINATION)
remove(PREF_MIGRATION_SOURCE) remove(PREF_MIGRATION_SOURCE)
@ -134,7 +135,7 @@ class MigrationService : ServiceWithALifecycleScope(), ServiceWithASimpleBinder<
flowOfProgress.collect { progress -> flowOfProgress.collect { progress ->
startForeground(2, makeMigrationProgressNotification(progress)) startForeground(2, makeMigrationProgressNotification(progress))
// TODO Replace the toast with a dialog that is shown either // TODO BEFORE-RELEASE Replace the toast with a dialog that is shown either
// * now, if deck picker is shown, // * now, if deck picker is shown,
// * whenever the deck picker is shown, if not, perhaps even after app death. // * whenever the deck picker is shown, if not, perhaps even after app death.
if (progress is Progress.Success) { if (progress is Progress.Success) {
@ -157,12 +158,12 @@ class MigrationService : ServiceWithALifecycleScope(), ServiceWithASimpleBinder<
return START_STICKY return START_STICKY
} }
// TODO This is inadequate, instead of calculating the remaining transfer size // TODO BEFORE-RELEASE! This is inadequate, instead of calculating the remaining transfer size
// every time migration is started, // every time migration is started,
// we should be calculating this size only when starting migration for the first time, // we should be calculating this size only when starting migration for the first time,
// and keeping track of the transferred and the remaining files. // and keeping track of the transferred and the remaining files.
// TODO Between this call and the subsequent migration the contents of the folder can change. // TODO BEFORE-RELEASE! Between this call and the subsequent migration
// This can lead to inconsistent readings in the UI. // the contents of the folder can change. This can lead to inconsistent readings in the UI.
private fun getRemainingTransferSize(task: MigrateUserData): Long { private fun getRemainingTransferSize(task: MigrateUserData): Long {
val ignoredFiles = MigrateEssentialFiles.iterateEssentialFiles(task.source) + val ignoredFiles = MigrateEssentialFiles.iterateEssentialFiles(task.source) +
File(task.source.directory, MoveConflictedFile.CONFLICT_DIRECTORY) File(task.source.directory, MoveConflictedFile.CONFLICT_DIRECTORY)
@ -193,7 +194,7 @@ class MigrationService : ServiceWithALifecycleScope(), ServiceWithASimpleBinder<
} }
private fun Context.makeMigrationProgressNotification(progress: MigrationService.Progress): Notification { private fun Context.makeMigrationProgressNotification(progress: MigrationService.Progress): Notification {
val builder = NotificationCompat.Builder(this, Channel.SCOPED_STORAGE_MIGRATION.id ) val builder = NotificationCompat.Builder(this, Channel.SCOPED_STORAGE_MIGRATION.id)
.setSmallIcon(R.drawable.ic_star_notify) .setSmallIcon(R.drawable.ic_star_notify)
.setContentTitle(getString(R.string.migration__migrating_data)) .setContentTitle(getString(R.string.migration__migrating_data))
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW)
@ -220,7 +221,7 @@ private fun Context.makeMigrationProgressNotification(progress: MigrationService
builder.setContentText(getString(R.string.migration_successful_message)) builder.setContentText(getString(R.string.migration_successful_message))
} }
// TODO: Add a “Get help” button // TODO BEFORE-RELEASE Add a “Get help” button
is MigrationService.Progress.Failure -> { is MigrationService.Progress.Failure -> {
val copyDebugInfoIntent = IntentHandler val copyDebugInfoIntent = IntentHandler
.copyStringToClipboardIntent(this, progress.e.stackTraceToString()) .copyStringToClipboardIntent(this, progress.e.stackTraceToString())