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

feat(sync-conflict): Add link to manual #17580

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading