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

v4.0.0 release #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

v4.0.0 release #128

wants to merge 1 commit into from

Conversation

okadan
Copy link
Owner

@okadan okadan commented Mar 5, 2023

  • [] Replace internal implementation with pigeon.
  • [] Covers all APIs for Android and iOS.
  • [] Move tag-specific APIs to external packages.
  • [] Add docs.
  • [] Test with a real world app.

@okadan okadan force-pushed the v4.0.0 branch 2 times, most recently from fa6a591 to bc4c865 Compare April 1, 2023 06:43
@okadan okadan force-pushed the v4.0.0 branch 2 times, most recently from c777285 to 0a40014 Compare April 15, 2023 02:23
@jakusb
Copy link

jakusb commented Apr 15, 2023

Hi @okadan ,
Any progress getting 4.0.0 released?
I was playing with it, but get an error message when running on an Android (Samsung A2):
E/flutter ( 9784): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument: Instance of 'PigeonReaderFlag'
E/flutter ( 9784): #0 StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:466:7)
E/flutter ( 9784): #1 _PigeonHostApiCodec.writeValue (package:nfc_manager/src/nfc_manager_android/pigeon.g.dart:608:13)
E/flutter ( 9784): #2 StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:456:9)
E/flutter ( 9784): #3 _PigeonHostApiCodec.writeValue (package:nfc_manager/src/nfc_manager_android/pigeon.g.dart:608:13)
E/flutter ( 9784): #4 StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:456:9)
E/flutter ( 9784): #5 _PigeonHostApiCodec.writeValue (package:nfc_manager/src/nfc_manager_android/pigeon.g.dart:608:13)
E/flutter ( 9784): #6 StandardMessageCodec.encodeMessage (package:flutter/src/services/message_codecs.dart:333:5)
E/flutter ( 9784): #7 BasicMessageChannel.send (package:flutter/src/services/platform_channel.dart:197:71)
E/flutter ( 9784): #8 PigeonHostApi.adapterEnableReaderMode (package:nfc_manager/src/nfc_manager_android/pigeon.g.dart:723:23)
E/flutter ( 9784): #9 NfcManagerAndroid.enableReaderMode (package:nfc_manager/src/nfc_manager_android/nfc_manager.dart:40:20)
E/flutter ( 9784): #10 NfcManagerAndroidPlatform.startSession (package:nfc_manager/src/nfc_manager_android/nfc_manager_platform.dart:18:39)
E/flutter ( 9784): #11 NfcManager.startSession (package:nfc_manager/src/nfc_manager/nfc_manager.dart:33:40)

I used this dependency:
nfc_manager:
git:
url: https://github.com/okadan/flutter-nfc-manager.git
ref: v4.0.0

Any ideas?

@jakusb
Copy link

jakusb commented Apr 15, 2023

When running on my iPhoneX I get a different message:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument: Instance of 'PigeonPollingOption'
#0 StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:466:7)
#1 _PigeonHostApiCodec.writeValue (package:nfc_manager/src/nfc_manager_ios/pigeon.g.dart:814:13)
#2 StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:456:9)
#3 _PigeonHostApiCodec.writeValue (package:nfc_manager/src/nfc_manager_ios/pigeon.g.dart:814:13)
#4 StandardMessageCodec.writeValue (package:flutter/src/services/message_codecs.dart:456:9)
#5 _PigeonHostApiCodec.writeValue (package:nfc_manager/src/nfc_manager_ios/pigeon.g.dart:814:13)
#6 StandardMessageCodec.encodeMessage (package:flutter/src/services/message_codecs.dart:333:5)
#7 BasicMessageChannel.send (package:flutter/src/services/platform_channel.dart:197:71)

@okadan okadan force-pushed the v4.0.0 branch 3 times, most recently from 95fadb2 to c0e0483 Compare April 21, 2023 11:32
@PeteClubSeven
Copy link

Hey, I was checking out this branch and I'm very much looking forward to this release because of problems I'm having with my particular use case seemingly causing tags to be disposed before I'm done with them. Do you perhaps have a timeline of when you expect the new version to be released?

@jakusb
Copy link

jakusb commented Apr 21, 2023

Hey, I was checking out this branch and I'm very much looking forward to this release because of problems I'm having with my particular use case seemingly causing tags to be disposed before I'm done with them. Do you perhaps have a timeline of when you expect the new version to be released?

I had similar issues, here a summary of what I did:

  • Android requires continues scanning session, simply to prevent it from triggering native response from outside of app. I simply stopSession after every read and immediately startSession again

  • I use a Cubit to emit event whenever a tag is read

  • iOS does not seem to support continuous scanning and requires explicit startSession, as it will timeout otherwise.

  • I added 2 functions to assist in preventing timing issues:

      String? nextAlertMessageIOS;
      String? nextErrorMessageIOS;
      Future<void> Function(NfcTag nfcTag, Ndef ndef)? onNextRead;
      Future<void> Function()? afterSessionStopped;
    
  • I used async/await everywhere to enforce single threaded processing.
    await NfcManager.instance.startSession(alertMessage: alertMessageIOS,onDiscovered: (NfcTag nfcTag) async {
    loggy.info('startSession tag[$nfcTag] handle[${nfcTag.handle}]');
    Ndef? ndef = Ndef.from(nfcTag);
    loggy.debug('PRE onReadTag');
    NfcState currentState = state;
    if (currentState is NfcStateLoaded) {
    emit(currentState.from(nfcTag: nfcTag, ndef: ndef));
    }
    await onReadTag(nfcTag, ndef, count);
    loggy.debug('POST onReadTag');
    Future Function(NfcTag nfcTag, Ndef ndef)? currentOnNextRead = onNextRead;
    if (currentOnNextRead != null && ndef != null) {
    await currentOnNextRead(nfcTag, ndef);
    onNextRead = null;
    }
    await stopSession(alertMessageIOS: nextAlertMessageIOS, errorMessageIOS: nextErrorMessageIOS);
    nextAlertMessageIOS = null;
    nextErrorMessageIOS = null;
    Future Function()? currentAfterSessionStopped = afterSessionStopped;
    if (currentAfterSessionStopped != null) {
    await currentAfterSessionStopped();
    }
    loggy.debug('stopSession done');
    if (continuous) {
    if (!kIsWeb && Platform.isIOS) {
    await Future.delayed(const Duration(seconds: 4)).then((value) {});
    }
    loggy.debug('stopSession continue [$count}]');
    count++;
    await readTag(continuous: continuous, count: count, alertMessageIOS: alertMessageIOS, onReadTag: onReadTag);
    }
    });
    loggy.debug('DONE readTag');

@sant0s
Copy link

sant0s commented Apr 24, 2023

I'm also looking forward to 4.0.0. In particular, I wonder if "Covers all APIs for Android and iOS." includes transceiving commands via NfcA.from(...).transceive(...) on iOS. Does anyone know?

@FTKhanFT
Copy link

Hi, @okadan
Any update on the new release?

@okadan okadan force-pushed the v4.0.0 branch 8 times, most recently from ebcac81 to 6912236 Compare September 20, 2023 11:21
@okadan okadan force-pushed the v4.0.0 branch 8 times, most recently from 8ea4ecd to 7e47bfc Compare October 4, 2023 13:09
@martijn00
Copy link

@okadan is there anything you need help with get this released?

@okadan
Copy link
Owner Author

okadan commented Oct 14, 2023

@martijn00 I`m planning to try implementing the Android HCE, but I would appreciate it if you can help me.

@philitell
Copy link

Any update on the new release?

@jeevareddy
Copy link

@okadan,
Any update on the release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants