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

[Contributions dashboard] survey dialog #5044

Open
wants to merge 11 commits into
base: contributions-dashboard-design
Choose a base branch
from

Conversation

Williamrai
Copy link
Collaborator

What does this do?

Adds a function to show material alert dialog with delay functionality.

Why is this needed?

This is needed after a user Saves an update to the Donor History page.

Phabricator:
https://phabricator.wikimedia.org/T376436

@Williamrai Williamrai changed the base branch from main to contributions-dashboard-design October 17, 2024 19:40
.setTitle(titleId)
.setMessage(messageId)
.setCancelable(isCancellable)
.setPositiveButton("Take Survey") { _, _ ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use this R.string.contributions_dashboard_survey_dialog_ok

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Uri.parse(activity.getString(R.string.contribution_dashboard_survey_url))
)
}
.setNegativeButton("No, Thanks") { _, _ ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use this R.string.contributions_dashboard_entry_dialog_cancel

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use R.string.contributions_dashboard_survey_dialog_cancel. Figma

Comment on lines 35 to 38
activity: AppCompatActivity,
@StringRes titleId: Int,
@StringRes messageId: Int,
@DrawableRes icon: Int? = null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will only need one survey verbiage for this experiment, maybe we can either set the title and message directly in the dialog, or set default values for title, message and icon?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed from here and moved to SuggestedEditsTasksFragment

)
}
.setNegativeButton("No, Thanks") { _, _ ->
// dismiss
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need a preference for this dialog, since we are going to show this once after saving the donor history.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure but did you use the icon from the Figma design or the material design library? If it was from the Figma design, I think we can import the icon from the material design library directly in case Sarah wants the exact design from her design.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon Sarah used was in the material design library, so i imported from there.

delayMillis: Long = 0,
isCancellable: Boolean = false
) {
activity.lifecycleScope.launch {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I know why we are using the Coroutine here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

Comment on lines 62 to 64
withContext(Dispatchers.Main) {
dialog.show()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

@@ -750,4 +750,8 @@ object Prefs {
var isRecurringDonor
get() = PrefsIoUtil.getBoolean(R.string.preference_key_is_recurring_donor, false)
set(value) = PrefsIoUtil.setBoolean(R.string.preference_key_is_recurring_donor, value)

var contributionDashboardSurveyDialogShown
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename contribution to plural.

@@ -22,6 +22,7 @@
<string name="donate_tax_url">https://donate.wikimedia.org/wiki/Special:LandingCheck?landing_page=Tax_deductibility&amp;basic=true</string>
<string name="donate_email">[email protected]</string>
<string name="donor_privacy_policy_url">https://foundation.wikimedia.org/wiki/Policy:Donor_privacy_policy</string>
<string name="contribution_dashboard_survey_url">https://docs.google.com/forms/d/1wIJWp75MMyp2e51kSaPH9ctByUzbyhazEOaJTxQhKqs/edit</string>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same: contribution -> contributions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are no changes in this file, would it be possible to reset the change and make another PR for the format updates?

@@ -388,6 +393,32 @@ class SuggestedEditsTasksFragment : Fragment() {
}
}

private fun showSurveyDialog(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this dialog will not be reused in other places, can we make this even simpler, just like this?

Please make sure to add a check for the preference for the one-time popup purpose.

private fun maybeShowImportReadingListsNewInstallDialog() {
if (!Prefs.importReadingListsNewInstallDialogShown) {
ReadingListsAnalyticsHelper.logReceiveStart(requireActivity())
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.shareable_reading_lists_new_install_dialog_title)
.setMessage(R.string.shareable_reading_lists_new_install_dialog_content)
.setNegativeButton(R.string.shareable_reading_lists_new_install_dialog_got_it, null)
.show()
Prefs.importReadingListsNewInstallDialogShown = true
}
}

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

Successfully merging this pull request may close these issues.

2 participants