Unverified Commit 70683890 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug 40138: Add feedback survey card

parent 5604e2ec
Pipeline #4051 failed with stages
...@@ -23,6 +23,7 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.CollectionViewHolder ...@@ -23,6 +23,7 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.CollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.NoCollectionsMessageViewHolder import org.mozilla.fenix.home.sessioncontrol.viewholders.NoCollectionsMessageViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.PrivateBrowsingDescriptionViewHolder import org.mozilla.fenix.home.sessioncontrol.viewholders.PrivateBrowsingDescriptionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TorBootstrapPagerViewHolder import org.mozilla.fenix.home.sessioncontrol.viewholders.TorBootstrapPagerViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TorFeedbackSurveyViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabInCollectionViewHolder import org.mozilla.fenix.home.sessioncontrol.viewholders.TabInCollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSitePagerViewHolder import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSitePagerViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingAutomaticSignInViewHolder import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingAutomaticSignInViewHolder
...@@ -80,6 +81,7 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) { ...@@ -80,6 +81,7 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
} }
object PrivateBrowsingDescription : AdapterItem(PrivateBrowsingDescriptionViewHolder.LAYOUT_ID) object PrivateBrowsingDescription : AdapterItem(PrivateBrowsingDescriptionViewHolder.LAYOUT_ID)
object TorFeedbackSurvey : AdapterItem(TorFeedbackSurveyViewHolder.LAYOUT_ID)
object NoCollectionsMessage : AdapterItem(NoCollectionsMessageViewHolder.LAYOUT_ID) object NoCollectionsMessage : AdapterItem(NoCollectionsMessageViewHolder.LAYOUT_ID)
object TorBootstrap : AdapterItem(TorBootstrapPagerViewHolder.LAYOUT_ID) object TorBootstrap : AdapterItem(TorBootstrapPagerViewHolder.LAYOUT_ID)
...@@ -179,6 +181,10 @@ class SessionControlAdapter( ...@@ -179,6 +181,10 @@ class SessionControlAdapter(
view, view,
interactor interactor
) )
TorFeedbackSurveyViewHolder.LAYOUT_ID -> TorFeedbackSurveyViewHolder(
view,
interactor
)
TorBootstrapPagerViewHolder.LAYOUT_ID -> TorBootstrapPagerViewHolder( TorBootstrapPagerViewHolder.LAYOUT_ID -> TorBootstrapPagerViewHolder(
view, view,
components, components,
......
...@@ -92,6 +92,11 @@ interface SessionControlController { ...@@ -92,6 +92,11 @@ interface SessionControlController {
*/ */
fun handlePrivateBrowsingLearnMoreClicked() fun handlePrivateBrowsingLearnMoreClicked()
/**
* @see [TabSessionInteractor.onTorFeedbackSurveyLaunchClicked]
*/
fun handleTorFeedbackSurveyLaunchClicked()
/** /**
* @see [TopSiteInteractor.onRenameTopSiteClicked] * @see [TopSiteInteractor.onRenameTopSiteClicked]
*/ */
...@@ -620,4 +625,12 @@ class DefaultSessionControlController( ...@@ -620,4 +625,12 @@ class DefaultSessionControlController(
override fun handleTorNetworkSettingsClicked() { override fun handleTorNetworkSettingsClicked() {
openTorNetworkSettings() openTorNetworkSettings()
} }
override fun handleTorFeedbackSurveyLaunchClicked() {
activity.openToBrowserAndLoad(
searchTermOrURL = SupportUtils.TOR_FEEDBACK_SURVEY_URL,
newTab = true,
from = BrowserDirection.FromHome
)
}
} }
...@@ -18,6 +18,12 @@ interface TabSessionInteractor { ...@@ -18,6 +18,12 @@ interface TabSessionInteractor {
* "Common myths about private browsing" link in private mode. * "Common myths about private browsing" link in private mode.
*/ */
fun onPrivateBrowsingLearnMoreClicked() fun onPrivateBrowsingLearnMoreClicked()
/**
* Shows the Feedback Survey web page in a new tab. Called when a user clicks on the
* "Launch the Survey" button.
*/
fun onTorFeedbackSurveyLaunchClicked()
} }
/** /**
...@@ -361,4 +367,8 @@ class SessionControlInteractor( ...@@ -361,4 +367,8 @@ class SessionControlInteractor(
override fun onTorBootstrapNetworkSettingsClicked() { override fun onTorBootstrapNetworkSettingsClicked() {
controller.handleTorNetworkSettingsClicked() controller.handleTorNetworkSettingsClicked()
} }
override fun onTorFeedbackSurveyLaunchClicked() {
controller.handleTorFeedbackSurveyLaunchClicked()
}
} }
...@@ -66,7 +66,7 @@ private fun showCollections( ...@@ -66,7 +66,7 @@ private fun showCollections(
} }
} }
private fun privateModeAdapterItems() = listOf(AdapterItem.PrivateBrowsingDescription) private fun privateModeAdapterItems() = listOf(AdapterItem.TorFeedbackSurvey)
private fun bootstrapAdapterItems() = listOf(AdapterItem.TorBootstrap) private fun bootstrapAdapterItems() = listOf(AdapterItem.TorBootstrap)
......
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.home.sessioncontrol.viewholders
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.tor_feedback_survey.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.home.sessioncontrol.TabSessionInteractor
class TorFeedbackSurveyViewHolder(
view: View,
private val interactor: TabSessionInteractor
) : RecyclerView.ViewHolder(view) {
init {
// val resources = view.resources
// val appName = resources.getString(R.string.app_name)
// view.private_session_description.text = resources.getString(
// R.string.private_browsing_placeholder_description_2, appName
// )
with(view.feedback_survey_launch_button) {
setOnClickListener {
interactor.onTorFeedbackSurveyLaunchClicked()
}
}
}
companion object {
const val LAYOUT_ID = R.layout.tor_feedback_survey
}
}
...@@ -37,6 +37,7 @@ object SupportUtils { ...@@ -37,6 +37,7 @@ object SupportUtils {
const val DONATE_URL = "https://donate.torproject.org/" const val DONATE_URL = "https://donate.torproject.org/"
const val TB_MANUAL_URL = "https://tb-manual.torproject.org/mobile-tor" const val TB_MANUAL_URL = "https://tb-manual.torproject.org/mobile-tor"
const val TOR_RELEASES = "https://www.torproject.org/releases/" const val TOR_RELEASES = "https://www.torproject.org/releases/"
const val TOR_FEEDBACK_SURVEY_URL = "http://bogdyardcfurxcle.onion/index.php/491436"
enum class SumoTopic(internal val topicStr: String) { enum class SumoTopic(internal val topicStr: String) {
FENIX_MOVING("sync-delist"), FENIX_MOVING("sync-delist"),
......
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/feedback_survey_padded_background_color">
<item
android:bottom="6dp"
android:top="6dp">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
</shape>
</item>
</ripple>
...@@ -94,7 +94,8 @@ ...@@ -94,7 +94,8 @@
android:textColor="#DEFFFFFF" android:textColor="#DEFFFFFF"
android:textSize="40sp" android:textSize="40sp"
android:lineSpacingMultiplier="1.1" android:lineSpacingMultiplier="1.1"
app:layout_scrollFlags="scroll" /> app:layout_scrollFlags="scroll"
android:visibility="gone" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/feedback_survey_wrapper"
style="@style/OnboardingCardLightWithPadding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false">
<LinearLayout
android:id="@+id/feedback_survey_header_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:importantForAccessibility="no">
<ImageView
android:id="@+id/tor_feedback_icon"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_marginEnd="10dp"
android:adjustViewBounds="true"
android:clickable="false"
android:focusable="false"
android:importantForAccessibility="no"
app:srcCompat="@drawable/tor_survey_icon_3x"/>
<TextView
android:id="@+id/feedback_survey_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="none"
android:lineSpacingExtra="6dp"
android:paddingHorizontal="4dp"
android:paddingTop="4dp"
android:scrollHorizontally="false"
android:textAlignment="viewStart"
android:textColor="?primaryText"
android:textSize="20sp"
android:text="Do you use Snowflake?" />
</LinearLayout>
<TextView
android:id="@+id/feedback_survey_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="none"
android:lineSpacingExtra="6dp"
android:paddingHorizontal="4dp"
android:paddingTop="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/feedback_survey_header_wrapper"
android:scrollHorizontally="false"
android:textAlignment="viewStart"
android:textColor="?primaryText"
android:textSize="16sp"
android:text="Snowflake is a pluggable transport available in Tor Browser. Help us improve it by completing this short survey about your browsing experience:" />
<Button
style="@style/PositiveButton"
android:id="@+id/feedback_survey_launch_button"
android:text="Launch the Survey"
android:layout_marginTop="16dp"
android:textSize="18dp"
android:textColor="@android:color/black"
android:background="@drawable/feedback_survey_padded_background"
android:fontFamily="Roboto-Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/feedback_survey_description" />
</androidx.constraintlayout.widget.ConstraintLayout>
...@@ -425,4 +425,7 @@ ...@@ -425,4 +425,7 @@
<!-- Toolbar menu icon colors --> <!-- Toolbar menu icon colors -->
<color name="toolbar_menu_transparent">@android:color/transparent</color> <color name="toolbar_menu_transparent">@android:color/transparent</color>
<!-- Tor -->
<color name="feedback_survey_padded_background_color">#A76FFA</color>
</resources> </resources>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment