Aperture: Add support for passkey QR codes
Change-Id: I045b10f584fd09449717cf93aa33439eaf150402
diff --git a/app/src/main/java/org/lineageos/aperture/qr/QrTextClassifier.kt b/app/src/main/java/org/lineageos/aperture/qr/QrTextClassifier.kt
index 68ebf5e..8820d9f 100644
--- a/app/src/main/java/org/lineageos/aperture/qr/QrTextClassifier.kt
+++ b/app/src/main/java/org/lineageos/aperture/qr/QrTextClassifier.kt
@@ -63,6 +63,26 @@
)
.build()
}
+
+ SCHEME_FIDO -> return TextClassification.Builder()
+ .setText(context.getString(R.string.qr_fido_content_description))
+ .setEntityType(TextClassifier.TYPE_OTHER, 1.0f)
+ .apply {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ addAction(
+ RemoteAction::class.build(
+ context,
+ R.drawable.ic_passkey,
+ R.string.qr_fido_title,
+ R.string.qr_fido_content_description,
+ Intent(Intent.ACTION_VIEW).apply {
+ data = uri
+ }
+ )
+ )
+ }
+ }
+ .build()
}
}
@@ -75,5 +95,6 @@
companion object {
private const val SCHEME_DPP = "dpp"
+ private const val SCHEME_FIDO = "fido"
}
}
diff --git a/app/src/main/res/drawable/ic_passkey.xml b/app/src/main/res/drawable/ic_passkey.xml
new file mode 100644
index 0000000..b3c3dbb
--- /dev/null
+++ b/app/src/main/res/drawable/ic_passkey.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: Material Design Authors / Google LLC
+ SPDX-License-Identifier: Apache-2.0
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:tint="#000000"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M120,800L120,688Q120,654 137.5,625.5Q155,597 184,582Q246,551 310,535.5Q374,520 440,520Q460,520 480,521.5Q500,523 520,526Q516,584 541,635.5Q566,687 614,720L614,800L120,800ZM760,920L700,860L700,674Q656,661 628,624.5Q600,588 600,540Q600,482 641,441Q682,400 740,400Q798,400 839,441Q880,482 880,540Q880,585 854.5,620Q829,655 790,670L840,720L780,780L840,840L760,920ZM440,480Q374,480 327,433Q280,386 280,320Q280,254 327,207Q374,160 440,160Q506,160 553,207Q600,254 600,320Q600,386 553,433Q506,480 440,480ZM740,560Q757,560 768.5,548.5Q780,537 780,520Q780,503 768.5,491.5Q757,480 740,480Q723,480 711.5,491.5Q700,503 700,520Q700,537 711.5,548.5Q723,560 740,560Z" />
+</vector>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f8655a1..1df5385 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -72,6 +72,8 @@
<string name="qr_dpp_description">Configure this device</string>
<string name="qr_email_title">Send a new email</string>
<string name="qr_email_content_description">Compose a new email to the specified emails</string>
+ <string name="qr_fido_title">Use passkey</string>
+ <string name="qr_fido_content_description">Handle this FIDO QR code</string>
<string name="qr_geo_title">Open this location</string>
<string name="qr_geo_content_description">Open this location</string>
<string name="qr_isbn_title">Lookup this ISBN</string>