-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
base: contributions-dashboard-design
Are you sure you want to change the base?
Changes from all commits
05771ac
ee925f0
1569fe7
266d513
26ff91d
c52a05f
58e64d4
dae3fcb
dc398f1
c00a14e
b2b39c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,12 +3,16 @@ package org.wikipedia.suggestededits | |||||||||||||||||||||||
import android.app.Activity | ||||||||||||||||||||||||
import android.net.Uri | ||||||||||||||||||||||||
import android.os.Bundle | ||||||||||||||||||||||||
import android.os.Handler | ||||||||||||||||||||||||
import android.os.Looper | ||||||||||||||||||||||||
import android.view.LayoutInflater | ||||||||||||||||||||||||
import android.view.View | ||||||||||||||||||||||||
import android.view.View.GONE | ||||||||||||||||||||||||
import android.view.View.VISIBLE | ||||||||||||||||||||||||
import android.view.ViewGroup | ||||||||||||||||||||||||
import androidx.activity.result.contract.ActivityResultContracts | ||||||||||||||||||||||||
import androidx.annotation.DrawableRes | ||||||||||||||||||||||||
import androidx.annotation.StringRes | ||||||||||||||||||||||||
import androidx.constraintlayout.widget.Group | ||||||||||||||||||||||||
import androidx.core.view.isVisible | ||||||||||||||||||||||||
import androidx.core.widget.NestedScrollView | ||||||||||||||||||||||||
|
@@ -18,6 +22,7 @@ import androidx.lifecycle.Lifecycle | |||||||||||||||||||||||
import androidx.lifecycle.lifecycleScope | ||||||||||||||||||||||||
import androidx.lifecycle.repeatOnLifecycle | ||||||||||||||||||||||||
import androidx.recyclerview.widget.LinearLayoutManager | ||||||||||||||||||||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||||||||||||||||||||||||
import kotlinx.coroutines.launch | ||||||||||||||||||||||||
import org.wikipedia.Constants | ||||||||||||||||||||||||
import org.wikipedia.R | ||||||||||||||||||||||||
|
@@ -388,6 +393,32 @@ class SuggestedEditsTasksFragment : Fragment() { | |||||||||||||||||||||||
} | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
private fun showSurveyDialog( | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. apps-android-wikipedia/app/src/main/java/org/wikipedia/main/MainFragment.kt Lines 547 to 557 in 89412c1
|
||||||||||||||||||||||||
@StringRes titleId: Int = R.string.contributions_dashboard_survey_dialog_title, | ||||||||||||||||||||||||
@StringRes messageId: Int = R.string.contributions_dashboard_survey_dialog_message, | ||||||||||||||||||||||||
@DrawableRes iconId: Int = R.drawable.ic_feedback, | ||||||||||||||||||||||||
delayMillis: Long = 10000, | ||||||||||||||||||||||||
isCancellable: Boolean = false | ||||||||||||||||||||||||
) { | ||||||||||||||||||||||||
Handler(Looper.getMainLooper()).postDelayed({ | ||||||||||||||||||||||||
Prefs.contributionDashboardSurveyDialogShown = true | ||||||||||||||||||||||||
MaterialAlertDialogBuilder(requireContext(), R.style.AlertDialogTheme_Icon) | ||||||||||||||||||||||||
.setTitle(titleId) | ||||||||||||||||||||||||
.setMessage(messageId) | ||||||||||||||||||||||||
.setCancelable(isCancellable) | ||||||||||||||||||||||||
.setIcon(iconId) | ||||||||||||||||||||||||
.setPositiveButton(R.string.contributions_dashboard_survey_dialog_ok) { _, _ -> | ||||||||||||||||||||||||
UriUtil.visitInExternalBrowser( | ||||||||||||||||||||||||
requireContext(), | ||||||||||||||||||||||||
Uri.parse(getString(R.string.contribution_dashboard_survey_url)) | ||||||||||||||||||||||||
) | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
.setNegativeButton(R.string.contributions_dashboard_survey_dialog_cancel) { _, _ -> | ||||||||||||||||||||||||
// dismiss | ||||||||||||||||||||||||
}.show() | ||||||||||||||||||||||||
}, delayMillis) | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
private inner class TaskViewCallback : SuggestedEditsTaskView.Callback { | ||||||||||||||||||||||||
override fun onViewClick(task: SuggestedEditsTask, secondary: Boolean) { | ||||||||||||||||||||||||
if (WikipediaApp.instance.languageState.appLanguageCodes.size < Constants.MIN_LANGUAGES_TO_UNLOCK_TRANSLATION && secondary) { | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
<string name="donate_tax_url">https://donate.wikimedia.org/wiki/Special:LandingCheck?landing_page=Tax_deductibility&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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same: |
||
|
||
<!-- Accounts --> | ||
<string name="account_name">@string/wikimedia</string> | ||
|
There was a problem hiding this comment.
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.