[tbb-commits] [Git][tpo/applications/fenix][tor-browser-88.1.3-10.5-1] Bug 40165: Announce v2 onion service deprecation on about:tor
Matthew Finkel (@sysrqb)
gitlab at torproject.org
Tue May 25 22:08:49 UTC 2021
Matthew Finkel pushed to branch tor-browser-88.1.3-10.5-1 at The Tor Project / Applications / fenix
Commits:
091f3e3d by Matthew Finkel at 2021-05-25T22:04:26+00:00
Bug 40165: Announce v2 onion service deprecation on about:tor
- - - - -
11 changed files:
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlAdapter.kt
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt
- app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlView.kt
- + app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TorInfoBannerViewHolder.kt
- app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
- + app/src/main/res/drawable/info_banner_padded_background.xml
- + app/src/main/res/drawable/tor_banner_warning_icon.png
- app/src/main/res/layout/fragment_home.xml
- + app/src/main/res/layout/tor_info_banner.xml
- app/src/main/res/values/colors.xml
Changes:
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlAdapter.kt
=====================================
@@ -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.PrivateBrowsingDescriptionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TorBootstrapPagerViewHolder
+import org.mozilla.fenix.home.sessioncontrol.viewholders.TorInfoBannerViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabInCollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSitePagerViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingAutomaticSignInViewHolder
@@ -80,6 +81,7 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
}
object PrivateBrowsingDescription : AdapterItem(PrivateBrowsingDescriptionViewHolder.LAYOUT_ID)
+ object TorInfoBanner : AdapterItem(TorInfoBannerViewHolder.LAYOUT_ID)
object NoCollectionsMessage : AdapterItem(NoCollectionsMessageViewHolder.LAYOUT_ID)
object TorBootstrap : AdapterItem(TorBootstrapPagerViewHolder.LAYOUT_ID)
@@ -179,6 +181,10 @@ class SessionControlAdapter(
view,
interactor
)
+ TorInfoBannerViewHolder.LAYOUT_ID -> TorInfoBannerViewHolder(
+ view,
+ interactor
+ )
TorBootstrapPagerViewHolder.LAYOUT_ID -> TorBootstrapPagerViewHolder(
view,
components,
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt
=====================================
@@ -93,6 +93,11 @@ interface SessionControlController {
*/
fun handlePrivateBrowsingLearnMoreClicked()
+ /**
+ * @see [TabSessionInteractor.onTorInfoBannerLaunchClicked]
+ */
+ fun handleTorInfoBannerLaunchClicked()
+
/**
* @see [TopSiteInteractor.onRenameTopSiteClicked]
*/
@@ -620,4 +625,12 @@ class DefaultSessionControlController(
override fun handleTorNetworkSettingsClicked() {
openTorNetworkSettings()
}
+
+ override fun handleTorInfoBannerLaunchClicked() {
+ activity.openToBrowserAndLoad(
+ searchTermOrURL = SupportUtils.TOR_INFO_BANNER_URL,
+ newTab = true,
+ from = BrowserDirection.FromHome
+ )
+ }
}
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt
=====================================
@@ -18,6 +18,12 @@ interface TabSessionInteractor {
* "Common myths about private browsing" link in private mode.
*/
fun onPrivateBrowsingLearnMoreClicked()
+
+ /**
+ * Shows the Info Banner web page in a new tab. Called when a user clicks on the
+ * "Learn More" button.
+ */
+ fun onTorInfoBannerLaunchClicked()
}
/**
@@ -361,4 +367,8 @@ class SessionControlInteractor(
override fun onTorBootstrapNetworkSettingsClicked() {
controller.handleTorNetworkSettingsClicked()
}
+
+ override fun onTorInfoBannerLaunchClicked() {
+ controller.handleTorInfoBannerLaunchClicked()
+ }
}
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlView.kt
=====================================
@@ -66,7 +66,7 @@ private fun showCollections(
}
}
-private fun privateModeAdapterItems() = listOf(AdapterItem.PrivateBrowsingDescription)
+private fun privateModeAdapterItems() = listOf(AdapterItem.TorInfoBanner)
private fun bootstrapAdapterItems() = listOf(AdapterItem.TorBootstrap)
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TorInfoBannerViewHolder.kt
=====================================
@@ -0,0 +1,40 @@
+/* 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.graphics.Typeface
+import android.text.SpannableString
+import android.text.Spanned
+import android.text.style.StyleSpan
+import android.view.View
+import androidx.recyclerview.widget.RecyclerView
+import kotlinx.android.synthetic.main.tor_info_banner.view.*
+import org.mozilla.fenix.R
+import org.mozilla.fenix.home.sessioncontrol.TabSessionInteractor
+
+class TorInfoBannerViewHolder(
+ view: View,
+ private val interactor: TabSessionInteractor
+) : RecyclerView.ViewHolder(view) {
+
+ init {
+ with(view.info_banner_launch_button) {
+ setOnClickListener {
+ interactor.onTorInfoBannerLaunchClicked()
+ }
+ }
+
+ with(view.info_banner_description) {
+ val spannedString: SpannableString = SpannableString(text)
+ spannedString.setSpan(StyleSpan(Typeface.BOLD), 120, 138,
+ Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
+ setText(spannedString)
+ }
+ }
+
+ companion object {
+ const val LAYOUT_ID = R.layout.tor_info_banner
+ }
+}
=====================================
app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
=====================================
@@ -38,6 +38,7 @@ object SupportUtils {
const val DONATE_URL = "https://donate.torproject.org/"
const val TB_MANUAL_URL = "https://tb-manual.torproject.org/mobile-tor"
const val TOR_RELEASES = "https://www.torproject.org/releases/"
+ const val TOR_INFO_BANNER_URL = "https://support.torproject.org/onionservices/#v2-deprecation"
enum class SumoTopic(internal val topicStr: String) {
FENIX_MOVING("sync-delist"),
=====================================
app/src/main/res/drawable/info_banner_padded_background.xml
=====================================
@@ -0,0 +1,13 @@
+<?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/info_banner_padded_background_color">
+ <item
+ android:bottom="6dp"
+ android:top="6dp">
+ <shape android:shape="rectangle">
+ <corners android:radius="4dp" />
+ </shape>
+ </item>
+</ripple>
=====================================
app/src/main/res/drawable/tor_banner_warning_icon.png
=====================================
Binary files /dev/null and b/app/src/main/res/drawable/tor_banner_warning_icon.png differ
=====================================
app/src/main/res/layout/fragment_home.xml
=====================================
@@ -94,7 +94,8 @@
android:textColor="#DEFFFFFF"
android:textSize="40sp"
android:lineSpacingMultiplier="1.1"
- app:layout_scrollFlags="scroll" />
+ app:layout_scrollFlags="scroll"
+ android:visibility="gone" />
</com.google.android.material.appbar.AppBarLayout>
=====================================
app/src/main/res/layout/tor_info_banner.xml
=====================================
@@ -0,0 +1,79 @@
+<?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/info_banner_wrapper"
+ style="@style/OnboardingCardLightWithPadding"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"
+ android:clipToPadding="false">
+
+ <LinearLayout
+ android:id="@+id/info_banner_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_info_banner_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_banner_warning_icon"/>
+
+ <TextView
+ android:id="@+id/info_banner_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="" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/info_banner_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/info_banner_header_wrapper"
+ android:scrollHorizontally="false"
+ android:textAlignment="viewStart"
+ android:textColor="?primaryText"
+ android:textSize="16sp"
+ android:text="Tor is ending its support for version 2 (v2) Onion Services, and v2 onion sites have since been deprecated. If you're a site administrator, upgrade to a v3 onion service immediately." />
+
+ <Button
+ style="@style/PositiveButton"
+ android:id="@+id/info_banner_launch_button"
+ android:text="Learn More"
+ android:layout_marginTop="16dp"
+ android:textSize="18dp"
+ android:textColor="@android:color/black"
+ android:background="@drawable/info_banner_padded_background"
+ android:fontFamily="Roboto-Medium"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/info_banner_description" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
=====================================
app/src/main/res/values/colors.xml
=====================================
@@ -425,4 +425,7 @@
<!-- Toolbar menu icon colors -->
<color name="toolbar_menu_transparent">@android:color/transparent</color>
+
+ <!-- Tor -->
+ <color name="info_banner_padded_background_color">#A76FFA</color>
</resources>
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/commit/091f3e3dea350fef9146cf04113952db181f2c8d
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/commit/091f3e3dea350fef9146cf04113952db181f2c8d
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20210525/f1ede034/attachment-0001.htm>
More information about the tbb-commits
mailing list