[tbb-commits] [Git][tpo/applications/fenix][tor-browser-91.0.0b5-11.0-1] 3 commits: squash! Add Tor integration and UI
Matthew Finkel (@sysrqb)
gitlab at torproject.org
Tue Aug 3 17:31:10 UTC 2021
Matthew Finkel pushed to branch tor-browser-91.0.0b5-11.0-1 at The Tor Project / Applications / fenix
Commits:
42cb015c by Matthew Finkel at 2021-08-03T16:43:39+00:00
squash! Add Tor integration and UI
Bug 40176: Re-render Home fragment on resume
- - - - -
f16690cd by Matthew Finkel at 2021-08-03T16:43:40+00:00
Revert "Bug 40165: Announce v2 onion service deprecation on about:tor"
This reverts commit 63c548710ea6438f829d7c51cc38b8ec9bcbc21f.
- - - - -
cdd226e6 by Matthew Finkel at 2021-08-03T16:43:42+00:00
Bug 40185: Use NimbusDisabled
- - - - -
13 changed files:
- app/src/main/java/org/mozilla/fenix/components/Analytics.kt
- app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
- 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/components/Analytics.kt
=====================================
@@ -14,6 +14,7 @@ import mozilla.components.lib.crash.service.GleanCrashReporterService
import mozilla.components.lib.crash.service.MozillaSocorroService
import mozilla.components.lib.crash.service.SentryService
import mozilla.components.service.nimbus.NimbusApi
+import mozilla.components.service.nimbus.NimbusDisabled
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.HomeActivity
@@ -101,7 +102,11 @@ class Analytics(
}
val experiments: NimbusApi by lazyMonitored {
- createNimbus(context, BuildConfig.NIMBUS_ENDPOINT)
+ if (BuildConfig.DATA_COLLECTION_DISABLED) {
+ NimbusDisabled()
+ } else {
+ createNimbus(context, BuildConfig.NIMBUS_ENDPOINT)
+ }
}
}
=====================================
app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
=====================================
@@ -835,6 +835,15 @@ class HomeFragment : Fragment() {
activity?.window?.setBackgroundDrawableResource(R.drawable.private_home_background_gradient)
}
+ // fenix#40176: Ensure the Home fragment is rendered correctly when we resume.
+ val localView = view
+ if (localView != null) {
+ val mode = currentMode.getCurrentMode()
+ adjustHomeFragmentView(mode, localView)
+ updateSessionControlView(localView)
+ showSessionControlView(localView)
+ }
+
hideToolbar()
}
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlAdapter.kt
=====================================
@@ -25,7 +25,6 @@ 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.ExperimentDefaultBrowserCardViewHolder
@@ -91,7 +90,6 @@ 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)
@@ -231,10 +229,6 @@ 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
=====================================
@@ -94,11 +94,6 @@ interface SessionControlController {
*/
fun handlePrivateBrowsingLearnMoreClicked()
- /**
- * @see [TabSessionInteractor.onTorInfoBannerLaunchClicked]
- */
- fun handleTorInfoBannerLaunchClicked()
-
/**
* @see [TopSiteInteractor.onRenameTopSiteClicked]
*/
@@ -652,12 +647,4 @@ 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
=====================================
@@ -23,12 +23,6 @@ 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()
}
/**
@@ -418,8 +412,4 @@ class SessionControlInteractor(
override fun onTorBootstrapNetworkSettingsClicked() {
controller.handleTorNetworkSettingsClicked()
}
-
- override fun onTorInfoBannerLaunchClicked() {
- controller.handleTorInfoBannerLaunchClicked()
- }
}
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlView.kt
=====================================
@@ -92,7 +92,7 @@ private fun showCollections(
}
}
-private fun privateModeAdapterItems() = listOf(AdapterItem.TorInfoBanner)
+private fun privateModeAdapterItems() = listOf(AdapterItem.PrivateBrowsingDescription)
private fun bootstrapAdapterItems() = listOf(AdapterItem.TorBootstrap)
=====================================
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TorInfoBannerViewHolder.kt deleted
=====================================
@@ -1,40 +0,0 @@
-/* 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
=====================================
@@ -40,7 +40,6 @@ 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 deleted
=====================================
@@ -1,13 +0,0 @@
-<?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 deleted
=====================================
Binary files a/app/src/main/res/drawable/tor_banner_warning_icon.png and /dev/null differ
=====================================
app/src/main/res/layout/fragment_home.xml
=====================================
@@ -94,8 +94,7 @@
android:textColor="#DEFFFFFF"
android:textSize="40sp"
android:lineSpacingMultiplier="1.1"
- app:layout_scrollFlags="scroll"
- android:visibility="gone" />
+ app:layout_scrollFlags="scroll" />
</com.google.android.material.appbar.AppBarLayout>
=====================================
app/src/main/res/layout/tor_info_banner.xml deleted
=====================================
@@ -1,79 +0,0 @@
-<?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
=====================================
@@ -424,7 +424,4 @@
<!-- 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/-/compare/a0debdae286014a53d3f4f4211d91b68fd0f820d...cdd226e671d2d499a759d7595ab136b5c82d8c5d
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/compare/a0debdae286014a53d3f4f4211d91b68fd0f820d...cdd226e671d2d499a759d7595ab136b5c82d8c5d
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/20210803/0202ee30/attachment-0001.htm>
More information about the tbb-commits
mailing list