chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
718 stars 575 forks source link

fix android sdk 34 and removed all deprecated dependencies & fix ios #512

Open iabdullahbeker opened 4 months ago

iabdullahbeker commented 4 months ago

fix android sdk 34 and removed all deprecated dependencies & fix ios file.

msd117 commented 4 months ago

Can we get this pr merged in repo

iabdullahbeker commented 4 months ago

Can we get this pr merged in repo

There're alot of PR , but without merges !

CedricDALAT commented 3 months ago

Hi @iabdullahbeker , Thanks a lot for your fixes ! It works, but you've commited some changes on the tagToJson function where you've added a second argument, but you didn't change the function, so it crashes when building.

sendEvent(TAG_DEFAULT, Util.tagToJSON(tag, messages));
                                   ^
  required: Tag
  found:    Tag,Parcelable[]
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
iabdullahbeker commented 3 months ago

Hi @iabdullahbeker , Thanks a lot for your fixes ! It works, but you've commited some changes on the tagToJson function where you've added a second argument, but you didn't change the function, so it crashes when building.

sendEvent(TAG_DEFAULT, Util.tagToJSON(tag, messages));
                                   ^
  required: Tag
  found:    Tag,Parcelable[]
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

tha function has two params .. see it's here .

    static JSONObject tagToJSON(Tag tag, Parcelable[] messages) {
        JSONObject json = new JSONObject();

        if (tag != null) {
            try {
                json.put("id", byteArrayToJSON(tag.getId()));
                json.put("techTypes", new JSONArray(Arrays.asList(tag.getTechList())));

                if (messages != null && messages.length > 0) {
                    json.put("ndefMessage", messageToJSON((NdefMessage)messages[0]));
                }
            } catch (JSONException e) {
                Log.e(TAG, "Failed to convert tag into json: " + tag.toString(), e);
            }
        }
        return json;
    }
CedricDALAT commented 3 months ago

tha function has two params .. see it's here .

    static JSONObject tagToJSON(Tag tag, Parcelable[] messages) {
        JSONObject json = new JSONObject();

        if (tag != null) {
            try {
                json.put("id", byteArrayToJSON(tag.getId()));
                json.put("techTypes", new JSONArray(Arrays.asList(tag.getTechList())));

                if (messages != null && messages.length > 0) {
                    json.put("ndefMessage", messageToJSON((NdefMessage)messages[0]));
                }
            } catch (JSONException e) {
                Log.e(TAG, "Failed to convert tag into json: " + tag.toString(), e);
            }
        }
        return json;
    }

Well, i'm not an android developer, but, from what i understand, this function is defined in the Util.java file and in your project or in the master of this repo the function only has one parameter.

iabdullahbeker commented 3 months ago

tha function has two params .. see it's here .

    static JSONObject tagToJSON(Tag tag, Parcelable[] messages) {
        JSONObject json = new JSONObject();

        if (tag != null) {
            try {
                json.put("id", byteArrayToJSON(tag.getId()));
                json.put("techTypes", new JSONArray(Arrays.asList(tag.getTechList())));

                if (messages != null && messages.length > 0) {
                    json.put("ndefMessage", messageToJSON((NdefMessage)messages[0]));
                }
            } catch (JSONException e) {
                Log.e(TAG, "Failed to convert tag into json: " + tag.toString(), e);
            }
        }
        return json;
    }

Well, i'm not an android developer, but, from what i understand, this function is defined in the Util.java file and in your project or in the master of this repo the function only has one parameter.

in my research after i installed the package for first time , i found some issues in Util.java and NfcPlugin.java so i found an updated file for Util.java and with chatGPT help i've fixed NfcPlugin.java to be compatible with SDK 34 .

if you need those two files , just send me your email and i will send it over to you .