Ensure that we don't write to tags unless explicitly asked to do so. (#998)

This commit is contained in:
Justin Bassett 2020-10-02 08:40:17 -04:00 committed by GitHub
parent 09a4c5c563
commit 892d144a15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View file

@ -90,7 +90,8 @@ class NfcSetupActivity : AppCompatActivity() {
val url = ndefMessage?.records?.get(0)?.toUri().toString()
val nfcTagId = UrlHandler.splitNfcTagId(url)
if (nfcTagId == null) {
viewModel.postNewUUID()
Log.w(TAG, "Unable to read tag!")
Toast.makeText(this, R.string.nfc_invalid_tag, Toast.LENGTH_LONG).show()
} else {
viewModel.nfcReadEvent.postValue(nfcTagId)
}

View file

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/nfc_view"
tools:context="io.homeassistant.companion.android.nfc.NfcSetupActivity">
<com.google.android.material.appbar.AppBarLayout

View file

@ -317,4 +317,5 @@ like to connect to:</string>
<string name="widget_text_hint_service_service">Service</string>
<string name="widget_text_size_default">30</string>
<string name="widget_text_size_label">Widget text size:</string>
<string name="nfc_invalid_tag">This tag does not contain Home Assistant data</string>
</resources>