mirror of
https://github.com/home-assistant/android
synced 2024-09-19 16:11:37 +00:00
Ensure that we don't write to tags unless explicitly asked to do so. (#998)
This commit is contained in:
parent
09a4c5c563
commit
892d144a15
|
@ -90,7 +90,8 @@ class NfcSetupActivity : AppCompatActivity() {
|
||||||
val url = ndefMessage?.records?.get(0)?.toUri().toString()
|
val url = ndefMessage?.records?.get(0)?.toUri().toString()
|
||||||
val nfcTagId = UrlHandler.splitNfcTagId(url)
|
val nfcTagId = UrlHandler.splitNfcTagId(url)
|
||||||
if (nfcTagId == null) {
|
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 {
|
} else {
|
||||||
viewModel.nfcReadEvent.postValue(nfcTagId)
|
viewModel.nfcReadEvent.postValue(nfcTagId)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/nfc_view"
|
||||||
tools:context="io.homeassistant.companion.android.nfc.NfcSetupActivity">
|
tools:context="io.homeassistant.companion.android.nfc.NfcSetupActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
|
|
@ -317,4 +317,5 @@ like to connect to:</string>
|
||||||
<string name="widget_text_hint_service_service">Service</string>
|
<string name="widget_text_hint_service_service">Service</string>
|
||||||
<string name="widget_text_size_default">30</string>
|
<string name="widget_text_size_default">30</string>
|
||||||
<string name="widget_text_size_label">Widget text size:</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>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue