Merge pull request #499 from meshtastic/qrcode

update QR code convention
pull/500/head
Andre K 2022-10-13 00:28:36 -03:00 zatwierdzone przez GitHub
commit 6dce06f51a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -137,7 +137,7 @@
<!-- The QR codes to share channel settings are shared as meshtastic URLS <!-- The QR codes to share channel settings are shared as meshtastic URLS
an approximate example: an approximate example:
http://www.meshtastic.org/e/YXNkZnF3ZXJhc2RmcXdlcmFzZGZxd2Vy http://meshtastic.org/e/YXNkZnF3ZXJhc2RmcXdlcmFzZGZxd2Vy
--> -->
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
@ -146,11 +146,11 @@
<data <data
android:scheme="https" android:scheme="https"
android:host="www.meshtastic.org" android:host="meshtastic.org"
android:pathPrefix="/e/" /> android:pathPrefix="/e/" />
<data <data
android:scheme="https" android:scheme="https"
android:host="www.meshtastic.org" android:host="meshtastic.org"
android:pathPrefix="/E/" /> android:pathPrefix="/E/" />
</intent-filter> </intent-filter>

Wyświetl plik

@ -15,7 +15,7 @@ data class ChannelSet(
) : Logging { ) : Logging {
companion object { companion object {
const val prefix = "https://www.meshtastic.org/e/#" const val prefix = "https://meshtastic.org/e/#"
private const val base64Flags = Base64.URL_SAFE + Base64.NO_WRAP + Base64.NO_PADDING private const val base64Flags = Base64.URL_SAFE + Base64.NO_WRAP + Base64.NO_PADDING
@ -65,7 +65,7 @@ data class ChannelSet(
// We encode as UPPER case for the QR code URL because QR codes are more efficient for that special case // We encode as UPPER case for the QR code URL because QR codes are more efficient for that special case
val bitMatrix = val bitMatrix =
multiFormatWriter.encode( multiFormatWriter.encode(
getChannelUrl(true).toString(), getChannelUrl(false).toString(),
BarcodeFormat.QR_CODE, BarcodeFormat.QR_CODE,
960, 960,
960 960

Wyświetl plik

@ -8,7 +8,7 @@ class ChannelSetTest {
/** make sure we match the python and device code behavior */ /** make sure we match the python and device code behavior */
@Test @Test
fun matchPython() { fun matchPython() {
val url = Uri.parse("https://www.meshtastic.org/e/#CgUYAiIBAQ") val url = Uri.parse("https://meshtastic.org/e/#CgUYAiIBAQ")
val cs = ChannelSet(url) val cs = ChannelSet(url)
Assert.assertEquals("LongFast", cs.primaryChannel!!.name) Assert.assertEquals("LongFast", cs.primaryChannel!!.name)
Assert.assertEquals("#LongFast-K", cs.primaryChannel!!.humanName) Assert.assertEquals("#LongFast-K", cs.primaryChannel!!.humanName)