Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified Changes to Support for special use case #479

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "phonegap-nfc",
"version": "1.2.0",
"name": "ziath-phonegap-nfc",
"version": "1.2.5",
"description": "Near Field Communication (NFC) Plugin. Read and write NDEF messages to NFC tags and share NDEF messages with peers.",
"cordova": {
"id": "phonegap-nfc",
"id": "ziath-phonegap-nfc",
"platforms": [
"android",
"wp8",
Expand All @@ -14,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/chariotsolutions/phonegap-nfc.git"
"url": "git+https://github.com/ZiathLtd/ziath-phonegap-nfc.git"
},
"keywords": [
"nfc",
Expand All @@ -30,7 +30,7 @@
"author": "Don Coleman <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/chariotsolutions/phonegap-nfc/issues"
"url": "https://github.com/ZiathLtd/ziath-phonegap-nfc/issues"
},
"homepage": "https://github.com/chariotsolutions/phonegap-nfc#readme"
"homepage": "https://github.com/ZiathLtd/ziath-phonegap-nfc#readme"
}
8 changes: 4 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<plugin
xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="phonegap-nfc"
version="1.2.0">
id="ziath-phonegap-nfc"
version="1.2.5">

<name>NFC</name>

<description>Near Field Communication (NFC) Plugin. Read and write NDEF messages to NFC tags and share NDEF messages with peers.</description>

<license>MIT</license>
<keywords>nfc, NFC, NDEF</keywords>
<repo>https://github.com/chariotsolutions/phonegap-nfc.git</repo>
<issue>https://github.com/chariotsolutions/phonegap-nfc/issues</issue>
<repo>https://github.com/ZiathLtd/ziath-phonegap-nfc.git</repo>
<issue>https://github.com/ZiathLtd/ziath-phonegap-nfc/issues</issue>

<platform name="android">
<js-module src="www/phonegap-nfc.js" name="NFC">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,18 @@ private void writeTag(JSONArray data, CallbackContext callbackContext) throws JS
callbackContext.error("Failed to write tag, received null intent");
}

Tag tag = savedIntent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
NdefRecord[] records = Util.jsonToNdefRecords(data.getString(0));
writeNdefMessage(new NdefMessage(records), tag, callbackContext);
}

private void writeNdefMessage(final NdefMessage message, final Tag tag, final CallbackContext callbackContext) {
cordova.getThreadPool().execute(() -> {
try {
if(tag == null)
{
throw new TagLostException("Tag is Null");
}
Ndef ndef = Ndef.get(tag);
if (ndef != null) {
ndef.connect();
Expand Down Expand Up @@ -483,7 +487,7 @@ private void createPendingIntent() {
Activity activity = getActivity();
Intent intent = new Intent(activity, activity.getClass());
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(activity, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(activity, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/ios/NfcPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

// Internal implementation
- (void)channel:(CDVInvokedUrlCommand *)command;
//- (void)transceive:(CDVInvokedUrlCommand *)command;

@end

Expand Down
Loading