Linking.getInitialURL() to work with NFC tags on Android (#25055)

Summary:
This PR solves bug https://github.com/facebook/react-native/issues/24393 for Android. Allows an app to be opened with an NFC tag and getting the url trough Linking.getInitialURL()

## Changelog
[Android] [Fixed] - This branch checks also for `ACTION_NDEF_DISCOVERED` intent matches to set the initialURL
Pull Request resolved: https://github.com/facebook/react-native/pull/25055

Differential Revision: D15516873

Pulled By: cpojer

fbshipit-source-id: e8803738d857a69e1063e926fc3858a416a0b25e
This commit is contained in:
Andrea Cimitan 2019-05-28 07:30:00 -07:00 коммит произвёл Facebook Github Bot
Родитель 0b14b6007d
Коммит 54abe1f599
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -12,6 +12,7 @@ import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.provider.Settings;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
@ -59,7 +60,7 @@ public class IntentModule extends ReactContextBaseJavaModule {
String action = intent.getAction();
Uri uri = intent.getData();
if (Intent.ACTION_VIEW.equals(action) && uri != null) {
if (uri != null && (Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))) {
initialURL = uri.toString();
}
}