Skip to content

[Contributions dashboard] survey dialog #5044

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

Merged
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
4 changes: 4 additions & 0 deletions app/src/main/java/org/wikipedia/settings/Prefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 contributionsDashboardSurveyDialogShown
get() = PrefsIoUtil.getBoolean(R.string.preference_key_contributions_dashboard_survey_dialog_shown, false)
set(value) = PrefsIoUtil.setBoolean(R.string.preference_key_contributions_dashboard_survey_dialog_shown, value)
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class SuggestedEditsTasksFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupTestingButtons()

binding.userStatsViewsGroup.addOnClickListener {
startActivity(UserContribListActivity.newIntent(requireActivity(), AccountUtil.userName))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
package org.wikipedia.usercontrib

import android.content.Context
import android.net.Uri
import android.os.Handler
import android.os.Looper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import org.wikipedia.R
import org.wikipedia.WikipediaApp
import org.wikipedia.settings.Prefs
import org.wikipedia.util.GeoUtil
import org.wikipedia.util.ReleaseUtil
import org.wikipedia.util.UriUtil
import java.time.LocalDate

class ContributionsDashboardHelper {
Expand All @@ -17,6 +25,27 @@ class ContributionsDashboardHelper {
"fr", "nl", "en"
)

fun maybeShowContributionsDashboardSurveyDialog(context: Context, delay: Long = 0) {
if (!Prefs.contributionsDashboardSurveyDialogShown || Prefs.hasDonorHistorySaved) {
Handler(Looper.getMainLooper()).postDelayed({
MaterialAlertDialogBuilder(context, R.style.AlertDialogTheme_Icon)
.setTitle(R.string.contributions_dashboard_survey_dialog_title)
.setMessage(R.string.contributions_dashboard_survey_dialog_message)
.setIcon(R.drawable.ic_feedback)
.setCancelable(false)
.setPositiveButton(R.string.contributions_dashboard_survey_dialog_ok) { _, _ ->
UriUtil.visitInExternalBrowser(
context,
Uri.parse(context.getString(R.string.contributions_dashboard_survey_url))
)
}
.setNegativeButton(R.string.contributions_dashboard_survey_dialog_cancel, null)
.show()
Prefs.contributionsDashboardSurveyDialogShown = true
}, delay)
}
}

val contributionsDashboardEnabled get() = ReleaseUtil.isPreBetaRelease ||
(enabledCountries.contains(GeoUtil.geoIPCountry.orEmpty()) &&
enabledLanguages.contains(WikipediaApp.instance.languageState.appLanguageCode) &&
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_feedback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,15C12.283,15 12.521,14.904 12.712,14.712C12.904,14.521 13,14.283 13,14C13,13.717 12.904,13.479 12.712,13.288C12.521,13.096 12.283,13 12,13C11.717,13 11.479,13.096 11.288,13.288C11.096,13.479 11,13.717 11,14C11,14.283 11.096,14.521 11.288,14.712C11.479,14.904 11.717,15 12,15ZM11,11H13V5H11V11ZM2,22V4C2,3.45 2.196,2.979 2.588,2.588C2.979,2.196 3.45,2 4,2H20C20.55,2 21.021,2.196 21.413,2.588C21.804,2.979 22,3.45 22,4V16C22,16.55 21.804,17.021 21.413,17.413C21.021,17.804 20.55,18 20,18H6L2,22ZM5.15,16H20V4H4V17.125L5.15,16Z"
android:fillColor="#000000"/>
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/values/preference_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,5 @@
<string name="preference_key_recommended_content_survey_shown">recommendedContentSurveyShown</string>
<string name="preference_key_donor_history_saved">hasDonorHistorySaved</string>
<string name="preference_key_is_recurring_donor">isRecurringDonor</string>
<string name="preference_key_contributions_dashboard_survey_dialog_shown">contributionsDashboardSurveyDialogShown</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings_no_translate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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="contributions_dashboard_survey_url">https://docs.google.com/forms/d/1wIJWp75MMyp2e51kSaPH9ctByUzbyhazEOaJTxQhKqs/edit</string>

<!-- Accounts -->
<string name="account_name">@string/wikimedia</string>
Expand Down
Loading