Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

return com.google.zxing.Result type object instead of only string #131

Closed
AlexGreg opened this issue Jul 15, 2019 · 7 comments · Fixed by #185
Closed

return com.google.zxing.Result type object instead of only string #131

AlexGreg opened this issue Jul 15, 2019 · 7 comments · Fixed by #185
Labels
3.x Will be released in a 3.x release Feature Feature Request

Comments

@AlexGreg
Copy link

in order to have also information about the type of barcode

@AlexGreg AlexGreg changed the title return com.google.zxing.Result type object instead of only string return com.google.zxing.Result type object instead of only string Jul 15, 2019
@masewo
Copy link

masewo commented Jul 20, 2019

I needed barcode format too so I forked the project and added return of barcode format:
https://github.com/masewo/flutter_barcode_reader

@ghost7476
Copy link

I needed barcode format too so I forked the project and added return of barcode format:
https://github.com/masewo/flutter_barcode_reader

@masewo
Hello, I have cloned your code, I found you just add android barcode type, will you add this in iOS?

@masewo
Copy link

masewo commented Sep 24, 2019

Yes, I will do it for iOS soon.

@arne-kapell
Copy link

Hey, any updates on the iOS version?

@masewo
Copy link

masewo commented Dec 28, 2019

@ghost7476 @mdlmlr
Sorry that it took so long, but I had no iOS device to test this feature.
Here I added the support for iOS:
masewo@008b25d
I added code in our app to convert iOS types to Android types:

// convert barcode type coming from iOS
    if (Platform.isIOS) {
      switch (barcode["barcodeFormat"]) {
        case 'org.iso.Aztec':
          barcode["barcodeFormat"] = 'AZTEC';
          break;
        case 'org.iso.Code39':
          barcode["barcodeFormat"] = 'CODE_39';
          break;
        case 'org.iso.Code39Mod43': // will be always detected as Code39 by Apple ?!
          barcode["barcodeFormat"] = 'CODE_39';
          break;
        case 'com.intermec.Code93':
          barcode["barcodeFormat"] = 'CODE_93';
          break;
        case 'org.iso.Code128':
          barcode["barcodeFormat"] = 'CODE_128';
          break;
        case 'org.iso.DataMatrix':
          barcode["barcodeFormat"] = 'DATA_MATRIX';
          break;
        case 'org.gs1.EAN-8':
          barcode["barcodeFormat"] = 'EAN_8';
          break;
        case 'org.gs1.EAN-13':
          if (barcode["barcode"].startsWith('0')) {
            barcode["barcode"] = barcode["barcode"].substring(1);
            barcode["barcodeFormat"] = 'UPC_A';
          } else {
            barcode["barcodeFormat"] = 'EAN_13';
          }
          break;
        case 'org.ansi.Interleaved2of5':
          barcode["barcodeFormat"] = 'ITF';
          break;
        case 'org.gs1.ITF14':
          barcode["barcodeFormat"] = 'ITF';
          break;
        case 'org.iso.PDF417':
          barcode["barcodeFormat"] = 'PDF_417';
          break;
        case 'org.iso.QRCode':
          barcode["barcodeFormat"] = 'QR_CODE';
          break;
        case 'org.gs1.UPC-E':
          barcode["barcodeFormat"] = 'UPC_E';
          break;
        default:
          break;
      // support missing for:
      // CODABAR, MAXICODE, RSS_14, RSS_EXPANDED, UPC_EAN_EXTENSION
      }
    }

@devtronic devtronic added the Feature Feature Request label Feb 19, 2020
@devtronic
Copy link
Member

I'll rewrite the platform communication and extend it with more properties.

@devtronic devtronic added the 3.x Will be released in a 3.x release label Feb 22, 2020
@devtronic devtronic linked a pull request Apr 8, 2020 that will close this issue
2 tasks
@devtronic
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x Will be released in a 3.x release Feature Feature Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants