Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
For #12289 Implement the common part from Biometric in ac
Browse files Browse the repository at this point in the history
  • Loading branch information
iorgamgabriel committed Jun 8, 2022
2 parents a1404bf + e87c754 commit 40d95a2
Show file tree
Hide file tree
Showing 581 changed files with 16,378 additions and 4,090 deletions.
6 changes: 3 additions & 3 deletions .buildconfig.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Please keep this version in sync with version.txt
# version.txt should be the new source of truth for version numbers
componentsVersion: 101.0.0
componentsVersion: 103.0.0
# Please add a treeherder group in taskcluster/ci/config.yml if you add a new project here.
projects:
compose-awesomebar:
Expand All @@ -23,8 +23,8 @@ projects:
path: components/concept/awesomebar
description: 'An abstract definition of an awesomebar component.'
publish: true
feature-biometric-prompt:
path: components/feature/biometric-prompt
lib-auth:
path: components/lib/biometric-prompt
description: 'Component for authentication using biometric'
publish: true
concept-base:
Expand Down
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/---performance-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "⌛ Performance issue"
about: Create a performance issue if the app is slow or it uses too much memory, disk space, battery, or network data
title: ""
labels: "performance"
assignees: ''

---

## Steps to reproduce

### Expected behavior

### Actual behavior

### Device information

* Android device: ?
* App (fenix, focus, ...): ?
* App version: ?
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ High-level components for building browser(-like) apps.

* 🔵 [**Icons**](components/browser/icons/README.md) - A component for loading and storing website icons (like [Favicons](https://en.wikipedia.org/wiki/Favicon)).

* [**Menu**](components/browser/menu/README.md) - A generic menu with customizable items primarily for browser toolbars.
* 🔵 [**Menu**](components/browser/menu/README.md) - A generic menu with customizable items primarily for browser toolbars.

*[**Menu 2**](components/browser/menu2/README.md) - A generic menu with customizable items primarily for browser toolbars.

Expand All @@ -81,9 +81,9 @@ High-level components for building browser(-like) apps.

* 🔵 [**Storage-Sync**](components/browser/storage-sync/README.md) - A syncable implementation of browser storage backed by [application-services' Places lib](https://github.com/mozilla/application-services).

* [**Tabstray**](components/browser/tabstray/README.md) - A customizable tabs tray for browsers.
* 🔵 [**Tabstray**](components/browser/tabstray/README.md) - A customizable tabs tray for browsers.

* 🔴 [**Thumbnails**](components/browser/thumbnails/README.md) - A component for loading and storing website thumbnails (screenshot of the website).
* 🔵 [**Thumbnails**](components/browser/thumbnails/README.md) - A component for loading and storing website thumbnails (screenshot of the website).

* 🔵 [**Toolbar**](components/browser/toolbar/README.md) - A customizable toolbar for browsers.

Expand All @@ -101,7 +101,7 @@ _API contracts and abstraction layers for browser components._

* 🔵 [**Storage**](components/concept/storage/README.md) - Abstract definition of a browser storage component.

* [**Tabstray**](components/concept/tabstray/README.md) - Abstract definition of a tabs tray component.
* 🔵 [**Tabstray**](components/concept/tabstray/README.md) - Abstract definition of a tabs tray component.

* 🔵 [**Toolbar**](components/concept/toolbar/README.md) - Abstract definition of a browser toolbar component.

Expand All @@ -113,7 +113,7 @@ _Combined components to implement feature-specific use cases._

* 🔵 [**Accounts Push**](components/feature/accounts-push/README.md) - Feature of use cases for FxA Account that work with push support.

* 🔴 [**Autofill**](components/feature/autofill/README.md) - A component that provides support for Android's Autofill framework.
* 🔵 [**Autofill**](components/feature/autofill/README.md) - A component that provides support for Android's Autofill framework.

* 🔵 [**Awesomebar**](components/feature/awesomebar/README.md) - A component that connects a [concept-awesomebar](components/concept/awesomebar/README.md) implementation to a [concept-toolbar](components/concept/toolbar/README.md) implementation and provides implementations of various suggestion providers.

Expand All @@ -123,7 +123,7 @@ _Combined components to implement feature-specific use cases._

* 🔵 [**Custom Tabs**](components/feature/customtabs/README.md) - A component for providing [Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) functionality in browsers.

* [**Downloads**](components/feature/downloads/README.md) - A component to perform downloads using the [Android downloads manager](https://developer.android.com/reference/android/app/DownloadManager).
* 🔵 [**Downloads**](components/feature/downloads/README.md) - A component to perform downloads using the [Android downloads manager](https://developer.android.com/reference/android/app/DownloadManager).

* 🔵 [**Intent**](components/feature/intent/README.md) - A component that provides intent processing functionality by combining various other feature modules.

Expand Down Expand Up @@ -155,11 +155,11 @@ _Combined components to implement feature-specific use cases._

* 🔵 [**Find In Page**](components/feature/findinpage/README.md) - A component that provides an UI widget for [find in page functionality](https://support.mozilla.org/en-US/kb/search-contents-current-page-text-or-links).

* [**Remote Tabs**](components/feature/remotetabs/README.md) - Feature that provides access to other device's tabs in the same account.
* 🔵 [**Remote Tabs**](components/feature/remotetabs/README.md) - Feature that provides access to other device's tabs in the same account.

* 🔵 [**Site Permissions**](components/feature/sitepermissions/README.md) - A feature for showing site permission request prompts.

* [**WebAuthn**](components/feature/webauthn/README.md) - A feature that provides WebAuthn functionality for supported engines.
* 🔵 [**WebAuthn**](components/feature/webauthn/README.md) - A feature that provides WebAuthn functionality for supported engines.

* 🔵 [**Web Notifications**](components/feature/webnotifications/README.md) - A component for displaying web notifications.

Expand Down Expand Up @@ -191,17 +191,17 @@ _Components and libraries to interact with backend services._

* 🔵 [**Firefox Sync - Logins**](components/service/sync-logins/README.md) - A library for integrating with Firefox Sync - Logins.

* 🔴 [**Firefox Sync - Autofill**](components/service/sync-autofill/README.md) - A library for integrating with Firefox Sync - Autofill.
* 🔵 [**Firefox Sync - Autofill**](components/service/sync-autofill/README.md) - A library for integrating with Firefox Sync - Autofill.

* 🔵 [**Glean**](components/service/glean/README.md) - A client-side telemetry SDK for collecting metrics and sending them to Mozilla's telemetry service (eventually replacing [service-telemetry](components/service/telemetry/README.md)).

* 🔵 [**Location**](components/service/location/README.md) - A library for accessing Mozilla's and other location services.

* 🔴 [**Nimbus**](components/service/nimbus/README.md) - A wrapper for the Nimbus SDK.

* 🔴 [**Pocket**](components/service/pocket/README.md) - A library for communicating with the Pocket API.
* 🔵 [**Pocket**](components/service/pocket/README.md) - A library for communicating with the Pocket API.

* 🔴 [**Contile**](components/service/contile/README.md) - A library for communicating with the Contile services API.
* 🔵 [**Contile**](components/service/contile/README.md) - A library for communicating with the Contile services API.

## Support

Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ subprojects {
}
}

// Allow local Glean substitution in each subproject.
if (gradle.hasProperty('localProperties.autoPublish.glean.dir')) {
ext.gleanSrcDir = gradle."localProperties.autoPublish.glean.dir"
apply from: "${rootProject.projectDir}/${gleanSrcDir}/build-scripts/substitute-local-glean.gradle"
}

if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcdir')) {
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopobjdir')) {
ext.topobjdir = gradle."localProperties.dependencySubstitutions.geckoviewTopobjdir"
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Synchronized version numbers for dependencies used by (some) modules
object Versions {
const val kotlin = "1.6.10"
const val coroutines = "1.5.2"
const val coroutines = "1.6.1"

const val junit = "4.12"
const val robolectric = "4.7.3"
Expand All @@ -24,14 +24,14 @@ object Versions {
const val detekt = "1.19.0"

const val sentry_legacy = "1.7.21"
const val sentry_latest = "5.6.1"
const val sentry_latest = "5.7.3"
const val okhttp = "3.13.1"
const val zxing = "3.3.0"
const val jna = "5.8.0"
const val disklrucache = "2.0.2"
const val leakcanary = "2.8.1"

const val mozilla_appservices = "91.1.2"
const val mozilla_appservices = "93.2.2"

const val mozilla_glean = "44.1.1"

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Gecko.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object Gecko {
/**
* GeckoView Version.
*/
const val version = "101.0.20220426094609"
const val version = "103.0.20220605065813"

/**
* GeckoView channel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Description for the button to accept the search suggestion and continue editing the search. -->
<string name="mozac_browser_awesomebar_edit_suggestion">Aceutar y editar la suxerencia</string>
<string name="mozac_browser_awesomebar_edit_suggestion">Aceptar y editar la suxerencia</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Description for the button to accept the search suggestion and continue editing the search. -->
<string name="mozac_browser_awesomebar_edit_suggestion">تجویز کوں قبول کرو تے تبدیلی کرو</string>
</resources>
1 change: 1 addition & 0 deletions components/browser/domains/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {

testImplementation Dependencies.androidx_test_junit
testImplementation Dependencies.testing_robolectric
testImplementation Dependencies.testing_coroutines
}

apply from: '../../../publish.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package mozilla.components.browser.domains

import android.content.Context
import androidx.test.ext.junit.runners.AndroidJUnit4
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.ExperimentalCoroutinesApi
import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert.assertEquals
import org.junit.Before
Expand All @@ -24,11 +24,10 @@ class CustomDomainsTest {
.apply()
}

@ExperimentalCoroutinesApi
@Test
fun customListIsEmptyByDefault() {
val domains = runBlocking {
CustomDomains.load(testContext)
}
val domains = CustomDomains.load(testContext)

assertEquals(0, domains.size)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,12 @@ class GeckoEngineSession(
runtime.webExtensionController.setTabActive(geckoSession, active)
}

/**
* See [EngineSession.updateSessionPriority].
*/
override fun updateSessionPriority(priority: SessionPriority) {
geckoSession.setPriorityHint(priority.id)
}
/**
* Purges the history for the session (back and forward history).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import mozilla.components.browser.engine.gecko.ext.toCreditCardEntry
import mozilla.components.browser.engine.gecko.ext.toLoginEntry
import mozilla.components.concept.storage.CreditCard
import mozilla.components.concept.storage.CreditCardsAddressesStorageDelegate
Expand All @@ -31,15 +32,17 @@ class GeckoAutocompleteStorageDelegate(
private val loginStorageDelegate: LoginStorageDelegate
) : Autocomplete.StorageDelegate {

override fun onCreditCardFetch(): GeckoResult<Array<Autocomplete.CreditCard>>? {
override fun onCreditCardFetch(): GeckoResult<Array<Autocomplete.CreditCard>> {
val result = GeckoResult<Array<Autocomplete.CreditCard>>()

@OptIn(DelicateCoroutinesApi::class)
GlobalScope.launch(IO) {
val creditCards = creditCardsAddressesStorageDelegate.onCreditCardsFetch().await()
val key = creditCardsAddressesStorageDelegate.getOrGenerateKey()

val creditCards = creditCardsAddressesStorageDelegate.onCreditCardsFetch()
.mapNotNull {
val plaintextCardNumber =
creditCardsAddressesStorageDelegate.decrypt(it.encryptedCardNumber)?.number
creditCardsAddressesStorageDelegate.decrypt(key, it.encryptedCardNumber)?.number

if (plaintextCardNumber == null) {
null
Expand All @@ -54,17 +57,25 @@ class GeckoAutocompleteStorageDelegate(
}
}
.toTypedArray()

result.complete(creditCards)
}

return result
}

override fun onCreditCardSave(creditCard: Autocomplete.CreditCard) {
@OptIn(DelicateCoroutinesApi::class)
GlobalScope.launch(IO) {
creditCardsAddressesStorageDelegate.onCreditCardSave(creditCard.toCreditCardEntry())
}
}

override fun onLoginSave(login: Autocomplete.LoginEntry) {
loginStorageDelegate.onLoginSave(login.toLoginEntry())
}

override fun onLoginFetch(domain: String): GeckoResult<Array<Autocomplete.LoginEntry>>? {
override fun onLoginFetch(domain: String): GeckoResult<Array<Autocomplete.LoginEntry>> {
val result = GeckoResult<Array<Autocomplete.LoginEntry>>()

@OptIn(DelicateCoroutinesApi::class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* 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 mozilla.components.browser.engine.gecko.ext

import mozilla.components.concept.storage.Address
import org.mozilla.geckoview.Autocomplete

/**
* Converts a GeckoView [Autocomplete.Address] to an Android Components [Address].
*/
fun Autocomplete.Address.toAddress() = Address(
guid = guid ?: "",
givenName = givenName,
additionalName = additionalName,
familyName = familyName,
organization = organization,
streetAddress = streetAddress,
addressLevel3 = addressLevel3,
addressLevel2 = addressLevel2,
addressLevel1 = addressLevel1,
postalCode = postalCode,
country = country,
tel = tel,
email = email
)

/**
* Converts an Android Components [Address] to a GeckoView [Autocomplete.Address].
*/
fun Address.toAutocompleteAddress() = Autocomplete.Address.Builder()
.guid(guid)
.givenName(givenName)
.additionalName(additionalName)
.familyName(familyName)
.organization(organization)
.streetAddress(streetAddress)
.addressLevel3(addressLevel3)
.addressLevel2(addressLevel2)
.addressLevel1(addressLevel1)
.postalCode(postalCode)
.country(country)
.tel(tel)
.email(email)
.build()
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

package mozilla.components.browser.engine.gecko.ext

import mozilla.components.concept.engine.prompt.CreditCard
import mozilla.components.concept.storage.CreditCardEntry
import mozilla.components.support.utils.creditCardIIN
import org.mozilla.geckoview.Autocomplete

/**
* Converts a GeckoView [Autocomplete.CreditCard] to an Android Components [CreditCard].
* Converts a GeckoView [Autocomplete.CreditCard] to an Android Components [CreditCardEntry].
*/
fun Autocomplete.CreditCard.toCreditCard() = CreditCard(
fun Autocomplete.CreditCard.toCreditCardEntry() = CreditCardEntry(
guid = guid,
name = name,
number = number,
Expand All @@ -21,9 +21,9 @@ fun Autocomplete.CreditCard.toCreditCard() = CreditCard(
)

/**
* Converts an Android Components [CreditCard] to a GeckoView [Autocomplete.CreditCard].
* Converts an Android Components [CreditCardEntry] to a GeckoView [Autocomplete.CreditCard].
*/
fun CreditCard.toAutocompleteCreditCard() = Autocomplete.CreditCard.Builder()
fun CreditCardEntry.toAutocompleteCreditCard() = Autocomplete.CreditCard.Builder()
.guid(guid)
.name(name)
.number(number)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* 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 mozilla.components.browser.engine.gecko.ext

import mozilla.components.browser.engine.gecko.prompt.GeckoChoice
import mozilla.components.concept.engine.prompt.Choice

/**
* Converts a GeckoView [GeckoChoice] to an Android Components [Choice].
*/
private fun GeckoChoice.toChoice(): Choice {
val choiceChildren = items?.map { it.toChoice() }?.toTypedArray()
// On the GeckoView docs states that label is a @NonNull, but on run-time
// we are getting null values
// https://bugzilla.mozilla.org/show_bug.cgi?id=1771149
@Suppress("USELESS_ELVIS")
return Choice(id, !disabled, label ?: "", selected, separator, choiceChildren)
}

/**
* Convert an array of [GeckoChoice] to Choice array.
* @return array of Choice
*/
fun convertToChoices(
geckoChoices: Array<out GeckoChoice>
): Array<Choice> = geckoChoices.map { geckoChoice ->
val choice = geckoChoice.toChoice()
choice
}.toTypedArray()
Loading

0 comments on commit 40d95a2

Please sign in to comment.