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

Update nfc.ios.ts #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions src/nfc.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
WriteTagOptions
} from "./nfc.common";

import { Utils } from "@nativescript/core";

export interface NfcSessionInvalidator {
invalidateSession(): void;
}
Expand Down Expand Up @@ -78,7 +80,9 @@ export class Nfc implements NfcApi, NfcSessionInvalidator {
);
} else {
// execute on the main thread with this trick, so UI updates are not broken
Promise.resolve().then(() => callback(data));
Utils.mainThreadify(() => {
callback(data)
})
}
},
options
Expand Down Expand Up @@ -180,11 +184,11 @@ class NFCNDEFReaderSessionDelegateImpl
this.resultCallback(NFCNDEFReaderSessionDelegateImpl.ndefToJson(firstMessage));
}

readerSessionDidDetectTags(
/*readerSessionDidDetectTags(
session: NFCNDEFReaderSession,
tags: NSArray<NFCNDEFTag> | NFCNDEFTag[]
): void {
/*

// TODO prolly remember the tags for when the app wants to write to it (also: check Android impl for possibly sth similar)
const nfcNdefTag = tags[0];
session.connectToTagCompletionHandler(nfcNdefTag, (error: NSError) => {
Expand All @@ -203,8 +207,8 @@ class NFCNDEFReaderSessionDelegateImpl
console.log(">> writeNDEFCompletionHandler, error: " + error);
});
}
*/
}

}*/

// Called when the reader session becomes invalid due to the specified error
readerSessionDidInvalidateWithError(
Expand Down