Matthew Finkel pushed to branch tor-browser-91.2.0-10.5-2 at The Tor Project / Applications / fenix

Commits:

11 changed files:

Changes:

  • app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlAdapter.kt
    ... ... @@ -25,6 +25,7 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.CollectionViewHolder
    25 25
     import org.mozilla.fenix.home.sessioncontrol.viewholders.NoCollectionsMessageViewHolder
    
    26 26
     import org.mozilla.fenix.home.sessioncontrol.viewholders.PrivateBrowsingDescriptionViewHolder
    
    27 27
     import org.mozilla.fenix.home.sessioncontrol.viewholders.TorBootstrapPagerViewHolder
    
    28
    +import org.mozilla.fenix.home.sessioncontrol.viewholders.TorInfoBannerViewHolder
    
    28 29
     import org.mozilla.fenix.home.sessioncontrol.viewholders.TabInCollectionViewHolder
    
    29 30
     import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSitePagerViewHolder
    
    30 31
     import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.ExperimentDefaultBrowserCardViewHolder
    
    ... ... @@ -90,6 +91,7 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
    90 91
         }
    
    91 92
     
    
    92 93
         object PrivateBrowsingDescription : AdapterItem(PrivateBrowsingDescriptionViewHolder.LAYOUT_ID)
    
    94
    +    object TorInfoBanner : AdapterItem(TorInfoBannerViewHolder.LAYOUT_ID)
    
    93 95
         object NoCollectionsMessage : AdapterItem(NoCollectionsMessageViewHolder.LAYOUT_ID)
    
    94 96
     
    
    95 97
         object TorBootstrap : AdapterItem(TorBootstrapPagerViewHolder.LAYOUT_ID)
    
    ... ... @@ -229,6 +231,10 @@ class SessionControlAdapter(
    229 231
                     view,
    
    230 232
                     interactor
    
    231 233
                 )
    
    234
    +            TorInfoBannerViewHolder.LAYOUT_ID -> TorInfoBannerViewHolder(
    
    235
    +                view,
    
    236
    +                interactor
    
    237
    +            )
    
    232 238
                 TorBootstrapPagerViewHolder.LAYOUT_ID -> TorBootstrapPagerViewHolder(
    
    233 239
                     view,
    
    234 240
                     components,
    

  • app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt
    ... ... @@ -94,6 +94,11 @@ interface SessionControlController {
    94 94
          */
    
    95 95
         fun handlePrivateBrowsingLearnMoreClicked()
    
    96 96
     
    
    97
    +    /**
    
    98
    +     * @see [TabSessionInteractor.onTorInfoBannerLaunchClicked]
    
    99
    +     */
    
    100
    +    fun handleTorInfoBannerLaunchClicked()
    
    101
    +
    
    97 102
         /**
    
    98 103
          * @see [TopSiteInteractor.onRenameTopSiteClicked]
    
    99 104
          */
    
    ... ... @@ -647,4 +652,12 @@ class DefaultSessionControlController(
    647 652
         override fun handleTorNetworkSettingsClicked() {
    
    648 653
             openTorNetworkSettings()
    
    649 654
         }
    
    655
    +
    
    656
    +    override fun handleTorInfoBannerLaunchClicked() {
    
    657
    +        activity.openToBrowserAndLoad(
    
    658
    +            searchTermOrURL = SupportUtils.TOR_INFO_BANNER_URL,
    
    659
    +            newTab = true,
    
    660
    +            from = BrowserDirection.FromHome
    
    661
    +        )
    
    662
    +    }
    
    650 663
     }

  • app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt
    ... ... @@ -23,6 +23,12 @@ interface TabSessionInteractor {
    23 23
          * "Common myths about private browsing" link in private mode.
    
    24 24
          */
    
    25 25
         fun onPrivateBrowsingLearnMoreClicked()
    
    26
    +
    
    27
    +    /**
    
    28
    +     * Shows the Info Banner web page in a new tab. Called when a user clicks on the
    
    29
    +     * "Learn More" button.
    
    30
    +     */
    
    31
    +    fun onTorInfoBannerLaunchClicked()
    
    26 32
     }
    
    27 33
     
    
    28 34
     /**
    
    ... ... @@ -412,4 +418,8 @@ class SessionControlInteractor(
    412 418
         override fun onTorBootstrapNetworkSettingsClicked() {
    
    413 419
             controller.handleTorNetworkSettingsClicked()
    
    414 420
         }
    
    421
    +
    
    422
    +    override fun onTorInfoBannerLaunchClicked() {
    
    423
    +        controller.handleTorInfoBannerLaunchClicked()
    
    424
    +    }
    
    415 425
     }

  • app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlView.kt
    ... ... @@ -92,7 +92,7 @@ private fun showCollections(
    92 92
         }
    
    93 93
     }
    
    94 94
     
    
    95
    -private fun privateModeAdapterItems() = listOf(AdapterItem.PrivateBrowsingDescription)
    
    95
    +private fun privateModeAdapterItems() = listOf(AdapterItem.TorInfoBanner)
    
    96 96
     
    
    97 97
     private fun bootstrapAdapterItems() = listOf(AdapterItem.TorBootstrap)
    
    98 98
     
    

  • app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TorInfoBannerViewHolder.kt
    1
    +/* This Source Code Form is subject to the terms of the Mozilla Public
    
    2
    + * License, v. 2.0. If a copy of the MPL was not distributed with this
    
    3
    + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    
    4
    +
    
    5
    +package org.mozilla.fenix.home.sessioncontrol.viewholders
    
    6
    +
    
    7
    +import android.graphics.Typeface
    
    8
    +import android.text.SpannableString
    
    9
    +import android.text.Spanned
    
    10
    +import android.text.style.StyleSpan
    
    11
    +import android.view.View
    
    12
    +import androidx.recyclerview.widget.RecyclerView
    
    13
    +import kotlinx.android.synthetic.main.tor_info_banner.view.*
    
    14
    +import org.mozilla.fenix.R
    
    15
    +import org.mozilla.fenix.home.sessioncontrol.TabSessionInteractor
    
    16
    +
    
    17
    +class TorInfoBannerViewHolder(
    
    18
    +    view: View,
    
    19
    +    private val interactor: TabSessionInteractor
    
    20
    +) : RecyclerView.ViewHolder(view) {
    
    21
    +
    
    22
    +    init {
    
    23
    +        with(view.info_banner_launch_button) {
    
    24
    +            setOnClickListener {
    
    25
    +                interactor.onTorInfoBannerLaunchClicked()
    
    26
    +            }
    
    27
    +        }
    
    28
    +    }
    
    29
    +
    
    30
    +    companion object {
    
    31
    +        const val LAYOUT_ID = R.layout.tor_info_banner
    
    32
    +    }
    
    33
    +}

  • app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
    ... ... @@ -40,6 +40,7 @@ object SupportUtils {
    40 40
         const val DONATE_URL = "https://donate.torproject.org/"
    
    41 41
         const val TB_MANUAL_URL = "https://tb-manual.torproject.org/mobile-tor"
    
    42 42
         const val TOR_RELEASES = "https://www.torproject.org/releases/"
    
    43
    +    const val TOR_INFO_BANNER_URL = "http://eh5esdnd6fkbkapfc6nuyvkjgbtnzq2is72lmpwbdbxepd2z7zbgzsqd.onion/index.php/664393"
    
    43 44
     
    
    44 45
         enum class SumoTopic(internal val topicStr: String) {
    
    45 46
             FENIX_MOVING("sync-delist"),
    

  • app/src/main/res/drawable/info_banner_padded_background.xml
    1
    +<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
    
    2
    +   - License, v. 2.0. If a copy of the MPL was not distributed with this
    
    3
    +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
    
    4
    +<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    
    5
    +    android:color="@color/info_banner_padded_background_color">
    
    6
    +    <item
    
    7
    +        android:bottom="6dp"
    
    8
    +        android:top="6dp">
    
    9
    +        <shape android:shape="rectangle">
    
    10
    +            <corners android:radius="4dp" />
    
    11
    +        </shape>
    
    12
    +    </item>
    
    13
    +</ripple>

  • app/src/main/res/drawable/vpn_survey_icon.png
    No preview for this file type
  • app/src/main/res/layout/fragment_home.xml
    ... ... @@ -94,7 +94,8 @@
    94 94
                 android:textColor="#DEFFFFFF"
    
    95 95
                 android:textSize="40sp"
    
    96 96
                 android:lineSpacingMultiplier="1.1"
    
    97
    -            app:layout_scrollFlags="scroll" />
    
    97
    +            app:layout_scrollFlags="scroll"
    
    98
    +            android:visibility="gone" />
    
    98 99
     
    
    99 100
         </com.google.android.material.appbar.AppBarLayout>
    
    100 101
     
    

  • app/src/main/res/layout/tor_info_banner.xml
    1
    +<?xml version="1.0" encoding="utf-8"?>
    
    2
    +<!-- This Source Code Form is subject to the terms of the Mozilla Public
    
    3
    +   - License, v. 2.0. If a copy of the MPL was not distributed with this
    
    4
    +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
    
    5
    +<androidx.constraintlayout.widget.ConstraintLayout
    
    6
    +    xmlns:android="http://schemas.android.com/apk/res/android"
    
    7
    +    xmlns:app="http://schemas.android.com/apk/res-auto"
    
    8
    +    android:id="@+id/info_banner_wrapper"
    
    9
    +    style="@style/OnboardingCardLightWithPadding"
    
    10
    +    android:layout_width="match_parent"
    
    11
    +    android:layout_height="wrap_content"
    
    12
    +    android:clipChildren="false"
    
    13
    +    android:clipToPadding="false">
    
    14
    +
    
    15
    +    <LinearLayout
    
    16
    +        android:id="@+id/info_banner_header_wrapper"
    
    17
    +        android:layout_width="match_parent"
    
    18
    +        android:layout_height="wrap_content"
    
    19
    +        app:layout_constraintStart_toStartOf="parent"
    
    20
    +        app:layout_constraintTop_toTopOf="parent"
    
    21
    +        android:importantForAccessibility="no">
    
    22
    +
    
    23
    +        <ImageView
    
    24
    +            android:id="@+id/tor_info_banner_icon"
    
    25
    +            android:layout_width="wrap_content"
    
    26
    +            android:layout_height="32dp"
    
    27
    +            android:layout_marginEnd="10dp"
    
    28
    +            android:adjustViewBounds="true"
    
    29
    +            android:clickable="false"
    
    30
    +            android:focusable="false"
    
    31
    +            android:importantForAccessibility="no"
    
    32
    +            app:srcCompat="@drawable/vpn_survey_icon"/>
    
    33
    +
    
    34
    +        <TextView
    
    35
    +            android:id="@+id/info_banner_header"
    
    36
    +            android:layout_width="match_parent"
    
    37
    +            android:layout_height="wrap_content"
    
    38
    +            android:ellipsize="none"
    
    39
    +            android:lineSpacingExtra="6dp"
    
    40
    +            android:paddingHorizontal="4dp"
    
    41
    +            android:paddingTop="4dp"
    
    42
    +            android:scrollHorizontally="false"
    
    43
    +            android:textAlignment="viewStart"
    
    44
    +            android:textColor="?primaryText"
    
    45
    +            android:textSize="20sp"
    
    46
    +            android:text="Do you use a VPN?" />
    
    47
    +    </LinearLayout>
    
    48
    +
    
    49
    +    <TextView
    
    50
    +        android:id="@+id/info_banner_description"
    
    51
    +        android:layout_width="match_parent"
    
    52
    +        android:layout_height="wrap_content"
    
    53
    +        android:ellipsize="none"
    
    54
    +        android:lineSpacingExtra="6dp"
    
    55
    +        android:paddingHorizontal="4dp"
    
    56
    +        android:paddingTop="4dp"
    
    57
    +        app:layout_constraintEnd_toEndOf="parent"
    
    58
    +        app:layout_constraintStart_toStartOf="parent"
    
    59
    +        app:layout_constraintTop_toBottomOf="@id/info_banner_header_wrapper"
    
    60
    +        android:scrollHorizontally="false"
    
    61
    +        android:textAlignment="viewStart"
    
    62
    +        android:textColor="?primaryText"
    
    63
    +        android:textSize="16sp"
    
    64
    +        android:text="We’d like to learn more about how and why our users use VPNs. Complete this short ten-minute survey to tell us about your experience:" />
    
    65
    +
    
    66
    +    <Button
    
    67
    +        style="@style/PositiveButton"
    
    68
    +        android:id="@+id/info_banner_launch_button"
    
    69
    +        android:text="Learn More"
    
    70
    +        android:layout_marginTop="16dp"
    
    71
    +        android:textSize="18dp"
    
    72
    +        android:textColor="@android:color/black"
    
    73
    +        android:background="@drawable/info_banner_padded_background"
    
    74
    +        android:fontFamily="Roboto-Medium"
    
    75
    +        app:layout_constraintEnd_toEndOf="parent"
    
    76
    +        app:layout_constraintStart_toStartOf="parent"
    
    77
    +        app:layout_constraintTop_toBottomOf="@id/info_banner_description" />
    
    78
    +
    
    79
    +</androidx.constraintlayout.widget.ConstraintLayout>

  • app/src/main/res/values/colors.xml
    ... ... @@ -424,4 +424,7 @@
    424 424
     
    
    425 425
         <!-- Toolbar menu icon colors -->
    
    426 426
         <color name="toolbar_menu_transparent">@android:color/transparent</color>
    
    427
    +
    
    428
    +    <!-- Tor -->
    
    429
    +    <color name="info_banner_padded_background_color">#A76FFA</color>
    
    427 430
     </resources>