Skip to content

Commit

Permalink
feat(sync-conflict): Add link to manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Giyutomioka-SS committed Dec 9, 2024
1 parent d7f67ad commit 4538e02
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import com.ichi2.anki.R
import com.ichi2.anki.joinSyncMessages
import com.ichi2.anki.showError
import com.ichi2.anki.utils.ext.dismissAllDialogFragments
import com.ichi2.anki.utils.openUrl
import com.ichi2.utils.titleWithHelpIcon

class SyncErrorDialog : AsyncDialogFragment() {
interface SyncErrorDialogListener {
Expand Down Expand Up @@ -73,6 +75,9 @@ class SyncErrorDialog : AsyncDialogFragment() {
DIALOG_SYNC_CONFLICT_RESOLUTION -> {
// Sync conflict; allow user to cancel, or choose between local and remote versions
dialog.setIcon(R.drawable.ic_sync_problem)
.titleWithHelpIcon(stringRes = R.string.sync_conflict_title_new) {
requireActivity().openUrl(Uri.parse(getString(R.string.link_help_sync_conflict)))
}
.setPositiveButton(R.string.sync_conflict_keep_local_new) { _, _ ->
requireSyncErrorDialogListener().showSyncErrorDialog(DIALOG_SYNC_CONFLICT_CONFIRM_KEEP_LOCAL)
}
Expand Down
4 changes: 3 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/utils/AlertDialogFacade.kt
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ fun AlertDialog.Builder.titleWithHelpIcon(
@StringRes stringRes: Int? = null,
text: String? = null,
block: View.OnClickListener
) {
): AlertDialog.Builder {
// setup the view for the dialog
val customTitleView = LayoutInflater.from(context).inflate(R.layout.alert_dialog_title_with_help, null, false)
setCustomTitle(customTitleView)
Expand All @@ -399,4 +399,6 @@ fun AlertDialog.Builder.titleWithHelpIcon(
Timber.i("dialog help icon click")
block.onClick(v)
}
// Return the builder to support chaining
return this
}
1 change: 1 addition & 0 deletions AnkiDroid/src/main/res/values/constants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<string name="link_set_due_date_help">https://docs.ankiweb.net/browsing.html#cards</string>
<string name="link_full_storage_access">https://github.com/ankidroid/Anki-Android/wiki/Full-Storage-Access</string>
<string name="link_help_forget_cards">https://docs.ankiweb.net/studying.html#editing-and-more</string>
<string name="link_help_sync_conflict">https://docs.ankiweb.net/syncing.html#conflicts</string>

<string-array name="cram_deck_conf_order_values">
<item>0</item>
Expand Down

0 comments on commit 4538e02

Please sign in to comment.