[tbb-commits] [Git][tpo/applications/android-components][android-components-57.0.6-10.0-2] 3 commits: Bug 40013: Add option do overwrite timestamp in extension version

Matthew Finkel gitlab at torproject.org
Fri Oct 2 21:51:41 UTC 2020



Matthew Finkel pushed to branch android-components-57.0.6-10.0-2 at The Tor Project / Applications / android-components


Commits:
abf37979 by Georg Koppen at 2020-10-02T16:11:34+00:00
Bug 40013: Add option do overwrite timestamp in extension version

- - - - -
81be6dd2 by Alex Catarineu at 2020-10-02T21:12:32+02:00
Bug 34377: Port padlock states for .onion services

- - - - -
b9984e10 by Matthew Finkel at 2020-10-02T21:49:53+00:00
Merge remote-tracking branch 'acatgl/34377' into android-components-57.0.6-10.0-2

- - - - -


9 changed files:

- build.gradle
- components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt
- components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/SiteSecurityIconView.kt
- components/browser/toolbar/src/main/res/drawable/mozac_ic_site_security.xml
- components/browser/toolbar/src/main/res/values/attrs_browser_toolbar.xml
- components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt
- components/feature/toolbar/src/main/java/mozilla/components/feature/toolbar/ToolbarPresenter.kt
- components/support/ktx/src/main/java/mozilla/components/support/ktx/kotlin/String.kt
- + components/ui/icons/src/main/res/drawable/mozac_ic_onion.xml


Changes:

=====================================
build.gradle
=====================================
@@ -126,7 +126,13 @@ subprojects {
             rename { 'manifest.json' }
             into extDir
 
-            def values = ['version': rootProject.ext.config.componentsVersion + "." + new Date().format('MMddHHmmss')]
+            def systemEnvBuildDate = System.getenv('MOZ_BUILD_DATE')
+            // MOZ_BUILD_DATE is in the YYYYMMDDHHMMSS format. Thus, we only use a
+            // substring of it if it is available.
+            def values = ['version': rootProject.ext.config.componentsVersion + "." +
+                          (systemEnvBuildDate != null ?
+                           systemEnvBuildDate.substring(4) :
+                           new Date().format('MMddHHmmss'))]
             inputs.properties(values)
             expand(values)
         }


=====================================
components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt
=====================================
@@ -476,6 +476,7 @@ class DisplayToolbar internal constructor(
         @ColorInt val color = when (siteSecurity) {
             Toolbar.SiteSecurity.INSECURE -> colors.securityIconInsecure
             Toolbar.SiteSecurity.SECURE -> colors.securityIconSecure
+            Toolbar.SiteSecurity.ONION -> colors.securityIconSecure
         }
         if (color == Color.TRANSPARENT) {
             views.securityIndicator.clearColorFilter()


=====================================
components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/SiteSecurityIconView.kt
=====================================
@@ -43,6 +43,11 @@ internal class SiteSecurityIconView @JvmOverloads constructor(
                 View.mergeDrawableStates(drawableState, intArrayOf(R.attr.state_site_secure))
                 drawableState
             }
+            SiteSecurity.ONION -> {
+                val drawableState = super.onCreateDrawableState(extraSpace + 1)
+                View.mergeDrawableStates(drawableState, intArrayOf(R.attr.state_site_onion))
+                drawableState
+            }
         }
     }
 }


=====================================
components/browser/toolbar/src/main/res/drawable/mozac_ic_site_security.xml
=====================================
@@ -3,6 +3,9 @@
    - 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/. -->
 <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ac="http://schemas.android.com/apk/res-auto">
+    <item
+        android:drawable="@drawable/mozac_ic_onion"
+        ac:state_site_onion="true" />
     <item
         android:drawable="@drawable/mozac_ic_lock"
         ac:state_site_secure="true" />


=====================================
components/browser/toolbar/src/main/res/values/attrs_browser_toolbar.xml
=====================================
@@ -27,6 +27,10 @@
     <attr name="state_site_secure" format="boolean"/>
   </declare-styleable>
 
+  <declare-styleable name="BrowserToolbarSiteOnionState">
+    <attr name="state_site_onion" format="boolean"/>
+  </declare-styleable>
+
   <declare-styleable name="ActionContainer">
     <attr name="actionContainerItemSize" format="dimension" />
   </declare-styleable>


=====================================
components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt
=====================================
@@ -385,6 +385,7 @@ interface Toolbar {
     enum class SiteSecurity {
         INSECURE,
         SECURE,
+        ONION,
     }
 
     /**


=====================================
components/feature/toolbar/src/main/java/mozilla/components/feature/toolbar/ToolbarPresenter.kt
=====================================
@@ -16,6 +16,7 @@ import mozilla.components.concept.toolbar.Toolbar
 import mozilla.components.concept.toolbar.Toolbar.SiteTrackingProtection
 import mozilla.components.feature.toolbar.internal.URLRenderer
 import mozilla.components.lib.state.ext.flowScoped
+import mozilla.components.support.ktx.kotlin.isOnionUrl
 import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged
 
 /**
@@ -64,7 +65,11 @@ class ToolbarPresenter(
             toolbar.displayProgress(tab.content.progress)
 
             toolbar.siteSecure = if (tab.content.securityInfo.secure) {
-                Toolbar.SiteSecurity.SECURE
+                if (tab.content.url.isOnionUrl()) {
+                    Toolbar.SiteSecurity.ONION
+                } else {
+                    Toolbar.SiteSecurity.SECURE
+                }
             } else {
                 Toolbar.SiteSecurity.INSECURE
             }


=====================================
components/support/ktx/src/main/java/mozilla/components/support/ktx/kotlin/String.kt
=====================================
@@ -115,6 +115,15 @@ fun String.tryGetHostFromUrl(): String = try {
     this
 }
 
+/**
+ * Returns whether the string is an .onion URL.
+ */
+fun String.isOnionUrl(): Boolean = try {
+    URL(this).host.endsWith(".onion")
+} catch (e: MalformedURLException) {
+    false
+}
+
 /**
  * Compares 2 URLs and returns true if they have the same origin,
  * which means: same protocol, same host, same port.


=====================================
components/ui/icons/src/main/res/drawable/mozac_ic_onion.xml
=====================================
@@ -0,0 +1,14 @@
+<?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/. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24"
+        android:viewportHeight="24">
+    <path
+        android:pathData="m12.0215,20.5903c0,0 0,-1.2728 0,-1.2728 4.0319,-0.0117 7.2965,-3.283 7.2965,-7.3177 0,-4.0345 -3.2646,-7.3058 -7.2965,-7.3175 0,0 0,-1.2728 0,-1.2728 4.7348,0.0119 8.5691,3.8529 8.5691,8.5903 0,4.7377 -3.8342,8.5789 -8.5691,8.5906 0,0 0,0 0,0m0,-4.4551c2.2741,-0.012 4.1148,-1.8582 4.1148,-4.1355 0,-2.277 -1.8407,-4.1233 -4.1148,-4.1352 0,0 0,-1.2726 0,-1.2726 2.9773,0.0116 5.3877,2.4278 5.3877,5.4078 0,2.9802 -2.4103,5.3964 -5.3877,5.408 0,0 0,-1.2725 0,-1.2725m0,-6.3616c1.2199,0.0116 2.2057,1.0033 2.2057,2.2261 0,1.2231 -0.9858,2.2147 -2.2057,2.2264 0,0 0,-4.4525 0,-4.4525M1.5,11.9997C1.5,17.799 6.2008,22.5 12,22.5 17.799,22.5 22.5,17.799 22.5,11.9997 22.5,6.2008 17.799,1.5 12,1.5 6.2008,1.5 1.5,6.2008 1.5,11.9997c0,0 0,0 0,0"
+        android:strokeWidth="1.49999"
+        android:fillColor="@color/mozac_ui_icons_fill"/>
+</vector>



View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/compare/8de106baa5e269bfc6dac85f73cf75abe1948cce...b9984e1084c7e16d0f774257ec20a966370ea4b5

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/compare/8de106baa5e269bfc6dac85f73cf75abe1948cce...b9984e1084c7e16d0f774257ec20a966370ea4b5
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/20201002/51a1de10/attachment-0001.htm>


More information about the tbb-commits mailing list