Skip to content

Commit 4778733

Browse files
Williamraicooltey
andauthored
Explore Feed Survey (#6126)
* - adds explore feed survey * - string update * - code fixes * - code update --------- Co-authored-by: Cooltey Feng <[email protected]>
1 parent f5f0502 commit 4778733

File tree

8 files changed

+49
-2
lines changed

8 files changed

+49
-2
lines changed

app/src/main/java/org/wikipedia/feed/FeedFragment.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package org.wikipedia.feed
22

3+
import android.app.Activity
34
import android.net.Uri
45
import android.os.Bundle
56
import android.util.Pair
67
import android.view.LayoutInflater
78
import android.view.View
89
import android.view.ViewGroup
910
import androidx.activity.result.contract.ActivityResultContracts
11+
import androidx.core.net.toUri
1012
import androidx.fragment.app.Fragment
1113
import androidx.lifecycle.lifecycleScope
1214
import androidx.recyclerview.widget.RecyclerView
@@ -41,6 +43,7 @@ import org.wikipedia.settings.SettingsActivity
4143
import org.wikipedia.settings.languages.WikipediaLanguagesActivity
4244
import org.wikipedia.util.FeedbackUtil
4345
import org.wikipedia.util.UriUtil
46+
import java.time.LocalDate
4447

4548
class FeedFragment : Fragment() {
4649
private var _binding: FragmentFeedBinding? = null
@@ -379,5 +382,27 @@ class FeedFragment : Fragment() {
379382
retainInstance = true
380383
}
381384
}
385+
386+
fun maybeShowExploreFeedSurvey(activity: Activity) {
387+
if (Prefs.exploreFeedSurveyShown || WikipediaApp.instance.languageState.systemLanguageCode != "en") return
388+
389+
val currentDate = LocalDate.now()
390+
val startDate = LocalDate.of(2025, 11, 24)
391+
val endDate = LocalDate.of(2025, 11, 30)
392+
393+
if (currentDate !in startDate..endDate) {
394+
return
395+
}
396+
397+
MaterialAlertDialogBuilder(activity)
398+
.setTitle(R.string.explore_feed_survey_dialog_title)
399+
.setMessage(R.string.explore_feed_survey_dialog_message)
400+
.setPositiveButton(R.string.explore_feed_survey_dialog_positive_button_label) { _, _ ->
401+
UriUtil.handleExternalLink(activity, activity.getString(R.string.explore_feed_survey_url).toUri())
402+
}
403+
.setNegativeButton(R.string.explore_feed_survey_dialog_negative_button_label) { _, _ -> }
404+
.show()
405+
Prefs.exploreFeedSurveyShown = true
406+
}
382407
}
383408
}

app/src/main/java/org/wikipedia/main/MainFragment.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,11 @@ class MainFragment : Fragment(), BackPressedHandler, MenuProvider, FeedFragment.
183183
return@setOnItemSelectedListener false
184184
}
185185
val fragment = currentFragment
186-
if (fragment is FeedFragment && item.order == 0) {
187-
fragment.scrollToTop()
186+
if (item.order == NavTab.EXPLORE.code()) {
187+
FeedFragment.maybeShowExploreFeedSurvey(requireActivity())
188+
if (fragment is FeedFragment) {
189+
fragment.scrollToTop()
190+
}
188191
}
189192
if (fragment is HistoryFragment && item.order == NavTab.SEARCH.code()) {
190193
openSearchActivity(InvokeSource.NAV_MENU, null, null)

app/src/main/java/org/wikipedia/settings/Prefs.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,4 +871,8 @@ object Prefs {
871871
var yearInReviewReadingListSurveyShown
872872
get() = PrefsIoUtil.getBoolean(R.string.preference_key_yir_reading_list_survey_shown, false)
873873
set(value) = PrefsIoUtil.setBoolean(R.string.preference_key_yir_reading_list_survey_shown, value)
874+
875+
var exploreFeedSurveyShown
876+
get() = PrefsIoUtil.getBoolean(R.string.preference_key_explore_feed_survey_shown, false)
877+
set(value) = PrefsIoUtil.setBoolean(R.string.preference_key_explore_feed_survey_shown, value)
874878
}

app/src/main/res/values-qq/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,4 +2089,8 @@
20892089
<string name="donation_reminders_settings_report_button">Menu label for providing feedback on the overflow menu in the Donation reminders settings screen.</string>
20902090
<string name="donation_reminders_settings_report_email_subject">Subject heading for sending a report about a problem with the Donation reminders feature.</string>
20912091
<string name="donation_reminders_settings_report_email_body">Body of email for sending a report about a problem with the Donation reminders feature.</string>
2092+
<string name="explore_feed_survey_dialog_title">Title label for the explore feed survey dialog.</string>
2093+
<string name="explore_feed_survey_dialog_message">Message label for the explore feed survey dialog.</string>
2094+
<string name="explore_feed_survey_dialog_positive_button_label">Positive label for the button that confirms taking explore feed survey.</string>
2095+
<string name="explore_feed_survey_dialog_negative_button_label">Negative label for the button that dismisses explore feed survey.</string>
20922096
</resources>

app/src/main/res/values/preference_keys.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,6 @@
206206
<string name="preference_key_yir_model_data">yirModelData</string>
207207
<string name="preference_key_yir_reading_list_visit_count">yirReadingListVisitCount</string>
208208
<string name="preference_key_yir_reading_list_survey_shown">yirReadingListSurveyShown</string>
209+
<string name="preference_key_explore_feed_survey_shown">exploreFeedSurveyShown</string>
209210

210211
</resources>

app/src/main/res/values/strings.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,4 +2335,9 @@
23352335
<string name="donation_reminders_settings_report_email_subject">Issue Report-Donation Reminders</string>
23362336
<string name="donation_reminders_settings_report_email_body">I have encountered a problem with the Donation reminders feature:\n- [Describe specific problem]\n- [Screenshots or links]\n\nThe behavior I would like to see is:\n- [Describe proposed solution]</string>
23372337
<string name="donation_reminders_snackbar_modify_button_label">Modify</string>
2338+
<string name="explore_feed_survey_dialog_title">Help us improve Explore</string>
2339+
<string name="explore_feed_survey_dialog_message">Please take a short survey about the Explore feed. Your feedback will help shape upcoming app improvements.</string>
2340+
<string name="explore_feed_survey_dialog_positive_button_label">Take survey</string>
2341+
<string name="explore_feed_survey_dialog_negative_button_label">No Thanks</string>
2342+
23382343
</resources>

app/src/main/res/values/strings_no_translate.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<string name="editing_learn_more_url">https://www.mediawiki.org/wiki/Special:MyLanguage/Wikimedia_Apps/Android_FAQ#Editing</string>
4040
<string name="apps_about_wmf_url">https://www.mediawiki.org/wiki/Special:MyLanguage/Wikimedia_Apps/About_the_Wikimedia_Foundation</string>
4141
<string name="forget_password_link">https://%s.wikipedia.org/wiki/Special:PasswordReset</string>
42+
<string name="explore_feed_survey_url">https://wikimedia.qualtrics.com/jfe/form/SV_4V0kURVL6q5Da6y</string>
4243

4344
<!-- Accounts -->
4445
<string name="account_name">@string/wikimedia</string>

app/src/main/res/xml/developer_preferences.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,10 @@
445445
android:key="@string/preference_key_feed_yir_onboarding_card_enabled"
446446
android:title="Year-in-review Feed Card" />
447447

448+
<org.wikipedia.settings.SwitchPreferenceMultiLine
449+
android:key="@string/preference_key_explore_feed_survey_shown"
450+
android:title="@string/preference_key_explore_feed_survey_shown"/>
451+
448452
</PreferenceCategory>
449453

450454
<PreferenceCategory android:title="On this day game">

0 commit comments

Comments
 (0)